Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp565824imj; Thu, 7 Feb 2019 08:29:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IYzxHgVW2z/Of1zQCUnuXaO0ZGBVXBI1CNEICItALtMLFLqAs57gTr+ptVyc70cX/mWY/kb X-Received: by 2002:a62:798f:: with SMTP id u137mr17100685pfc.168.1549556985849; Thu, 07 Feb 2019 08:29:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549556985; cv=none; d=google.com; s=arc-20160816; b=uxnh9K/TBFdSgyfAVtfNEUfh5aOxd5gwAlCpXxG7LgzI7fkKJJ+Yq/IcalUiRrjRO2 oD70xjVAeIacFNfdbZkZrdbuFc1pIZDrU0M2V6l3NroJCAWCuJGvc/Nsh3miSBgc1a6V wLAl8lVvkBicN0McHOEgLsG5W77SQJtjrv8CtR3+CzfuOChArrun603TNtqWAHU0p/e0 g0SgAsPfs3nPGGMLZ5xxQnYMo1MZJRYCTxUJmr89Yqw+ED0hgkoT2k2EJxR4rIlSMK2w K2YxG0adKv8Z8NAiiTg6gESy0/PMV+RmAZYdrFfIU45K+1qLVoZ4P91s3Gvq4n7Hqv/V d2MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RNyc1agLUnzO82ccrxtqFSx2MgYzWNLF1/jcqn6LSgc=; b=cxe2mXSQXin0FCDkcOASOn5mI9GibOm1DsHXcBie1ieq+ApAs4FgTq0y1nJVdukpSD vGvF93+yFL26/oroMYrecMeT6orC1KBi7F2wOmfgpjBvNV53sTKXzxsHhkpffVVbKpcw VUTpkh4nLar8ZFCKZaX6dhTCM+GFL/xk69FpnHfVFO07XtCH52ubqDH7zvdr5KD9BZQo y8NK/u02XBM2wV2wv4Dm2tAegkPyXPqtBp9/G+FKjFlSwGkxdv/MpRO3Yct2h5Ht8d8g 2eFQiqawqXrjj8LC/Mw8ZJrEWworAFwn+jjXHrDbstjMGETKH/3HDIt8PTle1Hf3ROtb LX1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r184si8922961pgr.266.2019.02.07.08.29.29; Thu, 07 Feb 2019 08:29:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727039AbfBGQ3Q (ORCPT + 99 others); Thu, 7 Feb 2019 11:29:16 -0500 Received: from relay11.mail.gandi.net ([217.70.178.231]:39605 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726843AbfBGQ3O (ORCPT ); Thu, 7 Feb 2019 11:29:14 -0500 Received: from localhost (aaubervilliers-681-1-80-177.w90-88.abo.wanadoo.fr [90.88.22.177]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 902F4100013; Thu, 7 Feb 2019 16:29:10 +0000 (UTC) From: Thomas Petazzoni To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Mark Rutland , Frank Rowand Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Jan=20Kundr=C3=A1t?= , Thomas Petazzoni Subject: [PATCH v2 2/5] gpio: rename gpio_set_drive_single_ended() to gpio_set_config() Date: Thu, 7 Feb 2019 17:28:56 +0100 Message-Id: <20190207162859.26252-3-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190207162859.26252-1-thomas.petazzoni@bootlin.com> References: <20190207162859.26252-1-thomas.petazzoni@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit simply renames gpio_set_drive_single_ended() to gpio_set_config(), as the function is not specific to setting the GPIO drive type, and will be used for other purposes in followup commits. In addition, it moves the function above gpiod_direction_input(), as it will be used from gpiod_direction_input(). Signed-off-by: Thomas Petazzoni --- drivers/gpio/gpiolib.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 361a09c8138a..cf8a4402fef1 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2555,6 +2555,14 @@ EXPORT_SYMBOL_GPL(gpiochip_free_own_desc); * rely on gpio_request() having been called beforehand. */ +static int gpio_set_config(struct gpio_chip *gc, unsigned offset, + enum pin_config_param mode) +{ + unsigned long config = { PIN_CONF_PACKED(mode, 0) }; + + return gc->set_config ? gc->set_config(gc, offset, config) : -ENOTSUPP; +} + /** * gpiod_direction_input - set the GPIO direction to input * @desc: GPIO to set to input @@ -2608,14 +2616,6 @@ int gpiod_direction_input(struct gpio_desc *desc) } EXPORT_SYMBOL_GPL(gpiod_direction_input); -static int gpio_set_drive_single_ended(struct gpio_chip *gc, unsigned offset, - enum pin_config_param mode) -{ - unsigned long config = { PIN_CONF_PACKED(mode, 0) }; - - return gc->set_config ? gc->set_config(gc, offset, config) : -ENOTSUPP; -} - static int gpiod_direction_output_raw_commit(struct gpio_desc *desc, int value) { struct gpio_chip *gc = desc->gdev->chip; @@ -2712,8 +2712,8 @@ int gpiod_direction_output(struct gpio_desc *desc, int value) gc = desc->gdev->chip; if (test_bit(FLAG_OPEN_DRAIN, &desc->flags)) { /* First see if we can enable open drain in hardware */ - ret = gpio_set_drive_single_ended(gc, gpio_chip_hwgpio(desc), - PIN_CONFIG_DRIVE_OPEN_DRAIN); + ret = gpio_set_config(gc, gpio_chip_hwgpio(desc), + PIN_CONFIG_DRIVE_OPEN_DRAIN); if (!ret) goto set_output_value; /* Emulate open drain by not actively driving the line high */ @@ -2721,16 +2721,16 @@ int gpiod_direction_output(struct gpio_desc *desc, int value) return gpiod_direction_input(desc); } else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) { - ret = gpio_set_drive_single_ended(gc, gpio_chip_hwgpio(desc), - PIN_CONFIG_DRIVE_OPEN_SOURCE); + ret = gpio_set_config(gc, gpio_chip_hwgpio(desc), + PIN_CONFIG_DRIVE_OPEN_SOURCE); if (!ret) goto set_output_value; /* Emulate open source by not actively driving the line low */ if (!value) return gpiod_direction_input(desc); } else { - gpio_set_drive_single_ended(gc, gpio_chip_hwgpio(desc), - PIN_CONFIG_DRIVE_PUSH_PULL); + gpio_set_config(gc, gpio_chip_hwgpio(desc), + PIN_CONFIG_DRIVE_PUSH_PULL); } set_output_value: -- 2.20.1