linux-gpio.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>,
	Orson Zhai <orsonzhai@gmail.com>,
	 Baolin Wang <baolin.wang@linux.alibaba.com>,
	 Chunyan Zhang <zhang.lyra@gmail.com>,
	Andy Shevchenko <andy@kernel.org>,
	 Peter Tyser <ptyser@xes-inc.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH 06/12] gpio: f7188: use new line value setter callbacks
Date: Mon, 07 Apr 2025 09:13:15 +0200	[thread overview]
Message-ID: <20250407-gpiochip-set-rv-gpio-part1-v1-6-78399683ca38@linaro.org> (raw)
In-Reply-To: <20250407-gpiochip-set-rv-gpio-part1-v1-0-78399683ca38@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-f7188x.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-f7188x.c b/drivers/gpio/gpio-f7188x.c
index 3875fd940ccb..dfcd3634f279 100644
--- a/drivers/gpio/gpio-f7188x.c
+++ b/drivers/gpio/gpio-f7188x.c
@@ -159,7 +159,8 @@ static int f7188x_gpio_direction_in(struct gpio_chip *chip, unsigned offset);
 static int f7188x_gpio_get(struct gpio_chip *chip, unsigned offset);
 static int f7188x_gpio_direction_out(struct gpio_chip *chip,
 				     unsigned offset, int value);
-static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value);
+static int f7188x_gpio_set(struct gpio_chip *chip, unsigned int offset,
+			   int value);
 static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset,
 				  unsigned long config);
 
@@ -172,7 +173,7 @@ static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset,
 			.direction_input  = f7188x_gpio_direction_in,	\
 			.get              = f7188x_gpio_get,		\
 			.direction_output = f7188x_gpio_direction_out,	\
-			.set              = f7188x_gpio_set,		\
+			.set_rv           = f7188x_gpio_set,		\
 			.set_config	  = f7188x_gpio_set_config,	\
 			.base             = -1,				\
 			.ngpio            = _ngpio,			\
@@ -391,7 +392,8 @@ static int f7188x_gpio_direction_out(struct gpio_chip *chip,
 	return 0;
 }
 
-static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+static int f7188x_gpio_set(struct gpio_chip *chip, unsigned int offset,
+			   int value)
 {
 	int err;
 	struct f7188x_gpio_bank *bank = gpiochip_get_data(chip);
@@ -400,7 +402,8 @@ static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 
 	err = superio_enter(sio->addr);
 	if (err)
-		return;
+		return err;
+
 	superio_select(sio->addr, sio->device);
 
 	data_out = superio_inb(sio->addr, f7188x_gpio_data_out(bank->regbase));
@@ -411,6 +414,8 @@ static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 	superio_outb(sio->addr, f7188x_gpio_data_out(bank->regbase), data_out);
 
 	superio_exit(sio->addr);
+
+	return 0;
 }
 
 static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset,

-- 
2.45.2


  parent reply	other threads:[~2025-04-07  7:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07  7:13 [PATCH 00/12] gpio: convert more GPIO chips to using new value setters Bartosz Golaszewski
2025-04-07  7:13 ` [PATCH 01/12] gpio: dln2: use new line value setter callbacks Bartosz Golaszewski
2025-04-07  8:50   ` Andy Shevchenko
2025-04-07  7:13 ` [PATCH 02/12] gpio: eic-sprd: " Bartosz Golaszewski
2025-04-07  7:13 ` [PATCH 03/12] gpio: em: " Bartosz Golaszewski
2025-04-07  7:13 ` [PATCH 04/12] gpio: exar: " Bartosz Golaszewski
2025-04-07  8:51   ` Andy Shevchenko
2025-04-07  7:13 ` [PATCH 05/12] gpio: allow building port-mapped GPIO drivers with COMPILE_TEST=y Bartosz Golaszewski
2025-04-07  9:00   ` Andy Shevchenko
2025-04-15  8:30   ` Linus Walleij
2025-04-17 11:57   ` Bartosz Golaszewski
2025-04-07  7:13 ` Bartosz Golaszewski [this message]
2025-04-07  9:02   ` [PATCH 06/12] gpio: f7188: use new line value setter callbacks Andy Shevchenko
2025-04-07  7:13 ` [PATCH 07/12] gpio: graniterapids: " Bartosz Golaszewski
2025-04-07  9:02   ` Andy Shevchenko
2025-04-07  7:13 ` [PATCH 08/12] gpio: gw-pld: " Bartosz Golaszewski
2025-04-07  7:13 ` [PATCH 09/12] gpio: htc-egpio: enable building with COMPILE_TEST=y Bartosz Golaszewski
2025-04-15  8:33   ` Linus Walleij
2025-04-07  7:13 ` [PATCH 10/12] gpio: htc-egpio: use new line value setter callbacks Bartosz Golaszewski
2025-04-07  7:13 ` [PATCH 11/12] gpio: ich: enable building with COMPILE_TEST=y Bartosz Golaszewski
2025-04-07  8:54   ` Andy Shevchenko
2025-04-15  8:30   ` Linus Walleij
2025-04-07  7:13 ` [PATCH 12/12] gpio: ich: use new line value setter callbacks Bartosz Golaszewski
2025-04-07  8:54   ` Andy Shevchenko
2025-04-16 15:56 ` [PATCH 00/12] gpio: convert more GPIO chips to using new value setters Bartosz Golaszewski
2025-04-16 18:05   ` Andy Shevchenko

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=20250407-gpiochip-set-rv-gpio-part1-v1-6-78399683ca38@linaro.org \
    --to=brgl@bgdev.pl \
    --cc=andy@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=ptyser@xes-inc.com \
    --cc=zhang.lyra@gmail.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).