linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Linus Walleij <linus.walleij@linaro.org>,
	 Bartosz Golaszewski <brgl@bgdev.pl>,
	 Thierry Reding <thierry.reding@gmail.com>,
	 Jonathan Hunter <jonathanh@nvidia.com>,
	Robert Richter <rric@kernel.org>,
	 Aaro Koskinen <aaro.koskinen@iki.fi>,
	 Andreas Kemnade <andreas@kemnade.info>,
	Kevin Hilman <khilman@baylibre.com>,
	 Roger Quadros <rogerq@kernel.org>,
	Tony Lindgren <tony@atomide.com>
Cc: linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH 07/12] gpio: tpic2810: use new GPIO line value setter callbacks
Date: Wed, 02 Jul 2025 11:14:08 +0200	[thread overview]
Message-ID: <20250702-gpiochip-set-rv-gpio-round3-v1-7-0d23be74f71d@linaro.org> (raw)
In-Reply-To: <20250702-gpiochip-set-rv-gpio-round3-v1-0-0d23be74f71d@linaro.org>

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpio-tpic2810.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-tpic2810.c b/drivers/gpio/gpio-tpic2810.c
index e99725bd3d63d47ed6dbb800aacac14b1ee96b9c..d5b8568ab0613be56965448277704336fd520090 100644
--- a/drivers/gpio/gpio-tpic2810.c
+++ b/drivers/gpio/gpio-tpic2810.c
@@ -25,7 +25,7 @@ struct tpic2810 {
 	struct mutex lock;
 };
 
-static void tpic2810_set(struct gpio_chip *chip, unsigned offset, int value);
+static int tpic2810_set(struct gpio_chip *chip, unsigned int offset, int value);
 
 static int tpic2810_get_direction(struct gpio_chip *chip,
 				  unsigned offset)
@@ -38,8 +38,7 @@ static int tpic2810_direction_output(struct gpio_chip *chip,
 				     unsigned offset, int value)
 {
 	/* This device always output */
-	tpic2810_set(chip, offset, value);
-	return 0;
+	return tpic2810_set(chip, offset, value);
 }
 
 static void tpic2810_set_mask_bits(struct gpio_chip *chip, u8 mask, u8 bits)
@@ -61,15 +60,19 @@ static void tpic2810_set_mask_bits(struct gpio_chip *chip, u8 mask, u8 bits)
 	mutex_unlock(&gpio->lock);
 }
 
-static void tpic2810_set(struct gpio_chip *chip, unsigned offset, int value)
+static int tpic2810_set(struct gpio_chip *chip, unsigned int offset, int value)
 {
 	tpic2810_set_mask_bits(chip, BIT(offset), value ? BIT(offset) : 0);
+
+	return 0;
 }
 
-static void tpic2810_set_multiple(struct gpio_chip *chip, unsigned long *mask,
-				  unsigned long *bits)
+static int tpic2810_set_multiple(struct gpio_chip *chip, unsigned long *mask,
+				 unsigned long *bits)
 {
 	tpic2810_set_mask_bits(chip, *mask, *bits);
+
+	return 0;
 }
 
 static const struct gpio_chip template_chip = {
@@ -77,8 +80,8 @@ static const struct gpio_chip template_chip = {
 	.owner			= THIS_MODULE,
 	.get_direction		= tpic2810_get_direction,
 	.direction_output	= tpic2810_direction_output,
-	.set			= tpic2810_set,
-	.set_multiple		= tpic2810_set_multiple,
+	.set_rv			= tpic2810_set,
+	.set_multiple_rv	= tpic2810_set_multiple,
 	.base			= -1,
 	.ngpio			= 8,
 	.can_sleep		= true,

-- 
2.48.1


  parent reply	other threads:[~2025-07-02  9:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-02  9:14 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-07-02  9:14 ` [PATCH 01/12] gpio: tegra186: don't call the set() callback directly Bartosz Golaszewski
2025-07-02  9:14 ` [PATCH 02/12] gpio: tegra186: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-07-02  9:14 ` [PATCH 03/12] gpio: tegra: " Bartosz Golaszewski
2025-07-02  9:14 ` [PATCH 04/12] gpio: thunderx: " Bartosz Golaszewski
2025-07-02  9:14 ` [PATCH 05/12] gpio: timberdale: " Bartosz Golaszewski
2025-07-02  9:14 ` [PATCH 06/12] gpio: tpic2810: remove unneeded callbacks Bartosz Golaszewski
2025-07-02  9:14 ` Bartosz Golaszewski [this message]
2025-07-02  9:14 ` [PATCH 08/12] gpio: tps65086: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-07-02  9:14 ` [PATCH 09/12] gpio: tps65218: remove unneeded callbacks Bartosz Golaszewski
2025-07-02  9:14 ` [PATCH 10/12] gpio: tps65218: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-07-02  9:14 ` [PATCH 11/12] gpio: tps65219: " Bartosz Golaszewski
2025-07-02  9:14 ` [PATCH 12/12] gpio: tps6586x: " Bartosz Golaszewski
2025-07-07  7:46 ` [PATCH 00/12] gpio: " Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250702-gpiochip-set-rv-gpio-round3-v1-7-0d23be74f71d@linaro.org \
    --to=brgl@bgdev.pl \
    --cc=aaro.koskinen@iki.fi \
    --cc=andreas@kemnade.info \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=jonathanh@nvidia.com \
    --cc=khilman@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=rogerq@kernel.org \
    --cc=rric@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).