From patchwork Thu Mar 14 19:32:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 10853451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1453C13B5 for ; Thu, 14 Mar 2019 19:34:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1F632A646 for ; Thu, 14 Mar 2019 19:34:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4CED2A64B; Thu, 14 Mar 2019 19:34:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 93D1B2A646 for ; Thu, 14 Mar 2019 19:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tNE5pbqojkv4/V6BZyZqWfKuKQUrNg41IdDY5sAt8X8=; b=a+NjwEsCD1rstB yBvGcUsdaTT5YOYYBlREYknuhLsRrZ9vJBCIt81TUxOoIS3CL/prGGqUp7evUtapeqhQ/Cm0rbCjK tRRpGX97dTyKBDreUoqM36wJ2o0XOALObENGq2n+j2jAiHOymHA0eucgtC6GkcDfCyB6LHfoyvQc1 gO6JcNvqRWj9nillEXjEqDp22DyzAuUmv5vQ2jbIj+NwOc9xk5KuxFWfp0cod7d1R9do/rSUslN/l lb0VzY4QtXlYd/JRpfviHQ0mctlJ+KmlV4u5FsZG5tcWTRHh97JuON6AGZ1URVijW79lW60+hZQNU rZGQUoWnZoJEAK6VDKcQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4W7a-0004mK-Ht; Thu, 14 Mar 2019 19:34:30 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4W6u-0003xK-Ap for linux-arm-kernel@bombadil.infradead.org; Thu, 14 Mar 2019 19:33:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SHWCf2hEc6rqCpFaTb7861l0T5CH+6wEYSt/Louu1/Q=; b=s0EGjKf73gZ3yfITaFydFAxJah 5Oxv1k8aveAHZ1a4NNwGrCi+4hrCq9JWAmNZpOGmKzUh68ku6e8KPFK83bdBM13RKR3+I4LOmlti9 QQ0jkSRX/pRnCTlErKxdNGmI2l4mB8bGV9dusJ/b8roWMd3rvD5OCtuTmQ+YXb2kZ0tS2OdhfD9KB xDSPTkjYRdIgptQ7g9xFHC12vZ/P2iaB+p7dWMvRiqd3YPQRfSAq2U2r6E7oBnxc2ieGiRydYVHBH bS+WUjCsf2JJBw1YkL1KGlRGaCfaKFGJ7PfDGZGol42skJkz0fAAPqCezyt9Wxu5hFWy3sij/X4Ak R/xZO9zA==; Received: from relay12.mail.gandi.net ([217.70.178.232]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4W6n-0000B4-Uf for linux-arm-kernel@lists.infradead.org; Thu, 14 Mar 2019 19:33:43 +0000 Received: from localhost (lfbn-1-10718-76.w90-89.abo.wanadoo.fr [90.89.68.76]) (Authenticated sender: maxime.ripard@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 44B49200005; Thu, 14 Mar 2019 19:33:02 +0000 (UTC) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , Linus Walleij , Bartosz Golaszewski Subject: [PATCH 1/6] gpio: Set proper argument value to set_config Date: Thu, 14 Mar 2019 20:32:50 +0100 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190314_153342_110892_5B239E3E X-CRM114-Status: GOOD ( 12.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-gpio@vger.kernel.org, Thomas Petazzoni , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The gpio_set_config function creates a pinconf configuration for a given pinc_config_param. However, it always uses an arg of 0, which might not be a valid argument for a given param. A good example of that would be the bias parameters, where 0 means that the pull up or down resistor is null, and the pin is directly connected to VCC/GND. The framework uses in some other places the value 1 as a default argument to enable the pull resistor, so let's use the same one here. Signed-off-by: Maxime Ripard --- drivers/gpio/gpiolib.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 144af0733581..27cb5783ef52 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2565,8 +2565,20 @@ EXPORT_SYMBOL_GPL(gpiochip_free_own_desc); static int gpio_set_config(struct gpio_chip *gc, unsigned offset, enum pin_config_param mode) { - unsigned long config = { PIN_CONF_PACKED(mode, 0) }; + unsigned long config; + unsigned arg; + switch (mode) { + case PIN_CONFIG_BIAS_PULL_DOWN: + case PIN_CONFIG_BIAS_PULL_UP: + arg = 1; + break; + + default: + arg = 0; + } + + config = PIN_CONF_PACKED(mode, arg); return gc->set_config ? gc->set_config(gc, offset, config) : -ENOTSUPP; }