From patchwork Tue Nov 5 13:10:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 11227851 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 73084112B for ; Tue, 5 Nov 2019 13:41:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 059FE21D6C for ; Tue, 5 Nov 2019 13:41:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="glJmEsI3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 059FE21D6C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fi.rohmeurope.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3D84D16D0; Tue, 5 Nov 2019 14:40:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3D84D16D0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572961284; bh=GC2GHEJF3z5x8AeYThCyFg2BNQrbikcJ2v7B5kHqgKY=; h=Date:From:To:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=glJmEsI3vN0ji0jYNh8AGBar+wYfDdqAEIX+5S8ulO4DcRFtU0C1KTTFLIA+pe9Tc fSF2+BLUWlN+ZlIrseljVJHPtlTxCaxLUQ2JZG1c0RxETwlGGjeYV5pv8kgVaN7bnb DP00L0r5eJSP3wM/cy9Cb5VnNf2YO9MaylInhsw0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C74A1F80635; Tue, 5 Nov 2019 14:38:21 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1EA57F8049B; Tue, 5 Nov 2019 14:11:12 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 80A2FF80271 for ; Tue, 5 Nov 2019 14:11:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 80A2FF80271 Received: by mail-lf1-f65.google.com with SMTP id q28so15110810lfa.5 for ; Tue, 05 Nov 2019 05:11:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=l8Im5R3FQ0f+QIAnNwvzY4o+9bLtjTOzR+ED97CX0bQ=; b=Ggi0kUu9YYeSFrCLOY3TArWmAXMSY7FtCDMkhTgwEUqY0S4IskpWmFCHM+0j9huwxo u4WtiertstU8Q0hs2+CLU9+7BD6o1fC5qw1WjEBrqvP78u60kaf3RedKluWumRT375Z1 ELg6XEZBunzbd9qpgwiSksRoiLlOrM8uuSUpmRlE6X8BCLWjn4zzDINURm//S4cEUFF0 FOPLEzrKUW8uGxGz1aXW2a7dMHeUpjf/vcJ8EKjGR96DqWGtOSyWofO2h3Z9+Oka/2Lm 7ptVGX510Eizv3CRCyZwngJnhIjx1vHI5lrr0CU3nZIblLQPR/7BPg7Xwu90P4aMs1+v optg== X-Gm-Message-State: APjAAAVuzvltBIRn/fHELtlCV1za42Ak4J19WMrTaM5JlOWnqC3FcXAK /E2FTkXeK0yhsfuq75NZAGM= X-Google-Smtp-Source: APXvYqxG8YUAy+DwKkIGY9cWv77NiqqeBDme3G0xG3YGsXTNlOyWrcCj6kB+mRP7VfBCxP+SG4zG9Q== X-Received: by 2002:a19:5010:: with SMTP id e16mr7124449lfb.49.1572959468332; Tue, 05 Nov 2019 05:11:08 -0800 (PST) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id z22sm8538198ljm.92.2019.11.05.05.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 05:11:07 -0800 (PST) Date: Tue, 5 Nov 2019 15:10:54 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Message-ID: <9e233d62cc282f3b03196d638f2188d9ab394b75.1572875541.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Mailman-Approved-At: Tue, 05 Nov 2019 14:38:15 +0100 Cc: Semi Malinen , Kuppuswamy Sathyanarayanan , linux-aspeed@lists.ozlabs.org, David Daney , Linus Walleij , alsa-devel@alsa-project.org, Peter Tyser , Thierry Reding , Jonathan Hunter , Fabio Estevam , linux-stm32@st-md-mailman.stormreply.com, Marek Vasut , Florian Fainelli , Kevin Hilman , Michal Simek , Marek Behun , Bartosz Golaszewski , Ludovic Desroches , bcm-kernel-feedback-list@broadcom.com, Joel Stanley , Uwe =?iso-8859-1?q?Kleine-K=F6nig?= , Bamvor Jian Zhang , NXP Linux Team , linux-pwm@vger.kernel.org, Grygorii Strashko , Charles Keepax , Maxime Coquelin , linux-omap@vger.kernel.org, Alexandre Torgue , Ray Jui , Sascha Hauer , Nandor Han , William Breathitt Gray , linux-gpio@vger.kernel.org, Richard Fitzgerald , Santosh Shilimkar , linux-tegra@vger.kernel.org, Andy Shevchenko , linux-arm-kernel@lists.infradead.org, Scott Branden , Masahiro Yamada , Andrew Jeffery , "Enrico Weigelt, metux IT consult" , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Thorsten Scherer , Pengutronix Kernel Team , patches@opensource.cirrus.com, Shawn Guo Subject: [alsa-devel] [RESEND PATCH 01/62] gpio: Add definition for GPIO direction X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" At least for me it is difficult to remember the meaning of GPIO direction values. Define GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT so that occasional GPIO contributors would not need to always check the meaning of hard coded values 1 and 0. Signed-off-by: Matti Vaittinen --- Sorry for folks. I do resend this single patch as this was intended to be sent for _all_ reviewers. I accidentally did originally send this only to those the get_maintainer.py listed for this patch. include/linux/gpio/driver.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 5dd9c982e2cb..cc9ade4552d9 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -22,6 +22,9 @@ enum gpio_lookup_flags; struct gpio_chip; +#define GPIO_LINE_DIRECTION_IN 1 +#define GPIO_LINE_DIRECTION_OUT 0 + /** * struct gpio_irq_chip - GPIO interrupt controller */ From patchwork Tue Nov 5 10:19:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 11227579 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A253814E5 for ; Tue, 5 Nov 2019 11:52:37 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 32F6421D71 for ; Tue, 5 Nov 2019 11:52:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="lI4VuDgV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32F6421D71 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fi.rohmeurope.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 98EBB1712; Tue, 5 Nov 2019 12:51:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 98EBB1712 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572954753; bh=SzqGndOIHW2yLediw3PeSmTtqdfU/yxiSwECnF4ssSM=; h=Date:From:To:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lI4VuDgVu5TjxNoIfH1m5Kl4x3jkGCcyUiBQlipfRl17f04waMcGIVXULrfYo7lHu EefALVSVxNS76PDRCGwnGtwNNxHnjR0Hwp6/m/IVOS765pOSzayyJKR/r+SdPYUrdJ nlk6BZrqiG2oy2y7gyF0JQ6whjnq5NZfACWAleIU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8EA6BF805DF; Tue, 5 Nov 2019 12:50:47 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 96CC6F8049B; Tue, 5 Nov 2019 11:19:19 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 11F2CF800F3 for ; Tue, 5 Nov 2019 11:19:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 11F2CF800F3 Received: by mail-lf1-f65.google.com with SMTP id j14so14665201lfb.8 for ; Tue, 05 Nov 2019 02:19:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hmymdAmmLz7/1ts3Oc63nVM1gU1OUHbrPD3E1JaeYNM=; b=uUWDfTRWq0P6u+XPDrc1L0lzEFNts55caQlv5nNu7wmqBWln5mTg+7a9vDxYMSHpys NQ/j24FleydwgbnPKHg/IvoiZJueU2XHaR6zmfBIgJDuP9hBID4bRM0Xn1jAatNKkWjb frCxRR0r2S/l9f10uOyP+n+H4fP40eez0lp2g5EaACXZLlK6lcAJGaXnodD7WG5APRyF bOtjC6sSKMTlhdHvlAZd6S6bb4qxfBdIMISq6FWwySxmpQjp5gaQUwm6WwLYqf5/5DH2 F2j969LNv8yM7m1JcHFt9u/H1O5vORlrqqOM//zZSuDhkyiMc3UsxhQlBstMM34vBRhG 8oZA== X-Gm-Message-State: APjAAAXowS8KFLwj3RNdzziT7hOf3VTsRA/y+NrzH4URECEer25iXNET ZwaLxkB06p3zKp9KAIL5aJY= X-Google-Smtp-Source: APXvYqwA3ByHsXKNFTqbUXeoIjiBwAvnWHc+B8RB60mVSLtRlUkTAzBu16JIPrIeS4QzEPOsnHHLbg== X-Received: by 2002:a19:4314:: with SMTP id q20mr19474289lfa.146.1572949155808; Tue, 05 Nov 2019 02:19:15 -0800 (PST) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id h16sm8502164ljb.10.2019.11.05.02.19.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 02:19:15 -0800 (PST) Date: Tue, 5 Nov 2019 12:19:06 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Message-ID: <313330e496479b15f6dbc59d95bfa08c280415f1.1572945780.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Mailman-Approved-At: Tue, 05 Nov 2019 12:50:45 +0100 Cc: alsa-devel@alsa-project.org, Charles Keepax , linux-gpio@vger.kernel.org, patches@opensource.cirrus.com, Linus Walleij , linux-kernel@vger.kernel.org, Bartosz Golaszewski , Richard Fitzgerald Subject: [alsa-devel] [PATCH 20/62] gpio: gpio-madera: Use new GPIO_LINE_DIRECTION X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" It's hard for occasional GPIO code reader/writer to know if values 0/1 equal to IN or OUT. Use defined GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT to help them out. Signed-off-by: Matti Vaittinen --- drivers/gpio/gpio-madera.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-madera.c b/drivers/gpio/gpio-madera.c index 7086f8b5388f..8f38303fcbc4 100644 --- a/drivers/gpio/gpio-madera.c +++ b/drivers/gpio/gpio-madera.c @@ -34,7 +34,10 @@ static int madera_gpio_get_direction(struct gpio_chip *chip, if (ret < 0) return ret; - return !!(val & MADERA_GP1_DIR_MASK); + if (val & MADERA_GP1_DIR_MASK) + return GPIO_LINE_DIRECTION_IN; + + return GPIO_LINE_DIRECTION_OUT; } static int madera_gpio_direction_in(struct gpio_chip *chip, unsigned int offset) From patchwork Tue Nov 5 10:42:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 11227583 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03ECC1850 for ; Tue, 5 Nov 2019 11:53:25 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 87C0B21D71 for ; Tue, 5 Nov 2019 11:53:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="FQx+qt1i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87C0B21D71 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fi.rohmeurope.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BEC321718; Tue, 5 Nov 2019 12:52:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BEC321718 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572954802; bh=yVRGdkqBK922kkMdcNGwjOE3j7YI9JT5q0rmj2j+jl4=; h=Date:From:To:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=FQx+qt1iPHz30S03yBUFsWXyRwmQBDtr3drkZf1W3vz7QsyD+6fS3Mg9OQwZqAMsY u9OEqpADLmfeO9Kc1hyH2Fbet2tiG4ezV8aLmdzyJkvYM4lAWyqK2mIh3ynQfbpgOm KHxBKSGWCZZ1UZ4DdCJPbAmqlmDy8A1xHYxlrE4o= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C33FCF805FB; Tue, 5 Nov 2019 12:50:48 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id ECCA8F8049B; Tue, 5 Nov 2019 11:42:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 603D6F80271 for ; Tue, 5 Nov 2019 11:42:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 603D6F80271 Received: by mail-lj1-f193.google.com with SMTP id r7so12536323ljg.2 for ; Tue, 05 Nov 2019 02:42:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zJQtw6WsLKIdVwDZMV0Pz6fU4JFtWwFkbgS9iv+/IOA=; b=iPIXIKaIC9VXqexp1aCWwWlbteb7fcZPmVie2cv5FVY6vBfuHpqMTZPn+9fpYJnseM bPmcBOTv1imBYeSUGAVUWBRPdrh8OoHoPTDoPdGpeR2TB06+pdTdDa/G+yRF65xP12I9 Oat005Y2QjHgw2r1V6K3s28zwdhgZ4CDo58C4sGNdHGyN6i5DrEo7wjalc/RcYhOIuMb jTzoZ1+HdrDPgy0XwJXhJk81gNw5gKcBfvbFdBs4W3xolZkJczVq253fUJa4cT7p6Uo6 j6ckwAfaMlrB3jxA37dHNqr2B6tzNvYghLCyG3/SJcPEh1/CvN3F/iNRLK0Qd9SJuc0t rbcw== X-Gm-Message-State: APjAAAUDG00fmkThq5ZhqCJdSOpcnvJfk0NJCnAk/NSVVDvumkDiGhHZ 6+mbTgH0zQEjzrGykPOB9uU= X-Google-Smtp-Source: APXvYqwOFSWIOcTngdfrUrZTLUT1vT2lZ4x7hyEHAU08t2ea6kvg8p56NtVIkvH7brQqOjIrQEACtw== X-Received: by 2002:a2e:8e21:: with SMTP id r1mr22778902ljk.81.1572950548332; Tue, 05 Nov 2019 02:42:28 -0800 (PST) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id z22sm8386482ljm.92.2019.11.05.02.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 02:42:27 -0800 (PST) Date: Tue, 5 Nov 2019 12:42:21 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Message-ID: <06aa0acec5797fc5711354d8ecad18bc6e947122.1572875541.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Mailman-Approved-At: Tue, 05 Nov 2019 12:50:45 +0100 Cc: Semi Malinen , Kuppuswamy Sathyanarayanan , linux-aspeed@lists.ozlabs.org, David Daney , Linus Walleij , alsa-devel@alsa-project.org, Peter Tyser , Thierry Reding , Jonathan Hunter , Fabio Estevam , linux-stm32@st-md-mailman.stormreply.com, Marek Vasut , Florian Fainelli , Kevin Hilman , Michal Simek , Marek Behun , Bartosz Golaszewski , Ludovic Desroches , bcm-kernel-feedback-list@broadcom.com, Joel Stanley , Uwe =?iso-8859-1?q?Kleine-K=F6nig?= , Bamvor Jian Zhang , NXP Linux Team , linux-pwm@vger.kernel.org, Grygorii Strashko , Charles Keepax , Maxime Coquelin , linux-omap@vger.kernel.org, Alexandre Torgue , Ray Jui , Sascha Hauer , Nandor Han , William Breathitt Gray , linux-gpio@vger.kernel.org, Richard Fitzgerald , Santosh Shilimkar , linux-tegra@vger.kernel.org, Andy Shevchenko , linux-arm-kernel@lists.infradead.org, Scott Branden , Masahiro Yamada , Andrew Jeffery , "Enrico Weigelt, metux IT consult" , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Thorsten Scherer , Pengutronix Kernel Team , patches@opensource.cirrus.com, Shawn Guo Subject: [alsa-devel] [PATCH 62/62] gpiolib: Nag for INPUT direction values other than GPIO_LINE_DIRECTION_IN X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" It seems that bunch of drivers put some effort (namely use !! or ! when converting GPIO direction register value to direction) to only return 1 or 0 for direction INPUT/UOTPUT. Others do just return any positive value they happen to read from register for INPUT. Let's try iron out this habit by nagging if our cool new definitions GPIO_LINE_DIRECTION_IN and GPIO_LINE_DIRECTION_OUT are not used. Signed-off-by: Matti Vaittinen --- drivers/gpio/gpiolib.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 104ed299d5ea..ed292498afb6 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -226,6 +226,12 @@ int gpiod_get_direction(struct gpio_desc *desc) ret = chip->get_direction(chip, offset); if (ret > 0) { /* GPIOF_DIR_IN, or other positive */ + if (ret != GPIO_LINE_DIRECTION_IN) { + struct gpio_device *gdev = chip->gpiodev; + + dev_warn(&gdev->dev, + "drivers should use GPIO_LINE_DIRECTION_IN\n"); + } ret = 1; clear_bit(FLAG_IS_OUT, &desc->flags); } @@ -1389,12 +1395,18 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, for (i = 0; i < chip->ngpio; i++) { struct gpio_desc *desc = &gdev->descs[i]; + int dir; if (chip->get_direction && gpiochip_line_is_valid(chip, i)) { - if (!chip->get_direction(chip, i)) + dir = chip->get_direction(chip, i); + if (!dir) { set_bit(FLAG_IS_OUT, &desc->flags); - else + } else { + if (dir != GPIO_LINE_DIRECTION_IN) + dev_warn(&gdev->dev, + "drivers should use GPIO_LINE_DIRECTION_IN\n"); clear_bit(FLAG_IS_OUT, &desc->flags); + } } else { if (!chip->direction_input) set_bit(FLAG_IS_OUT, &desc->flags);