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>,
	Vladimir Zapolskiy <vz@mleia.com>,
	 Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>,
	 Charles Keepax <ckeepax@opensource.cirrus.com>,
	 Richard Fitzgerald <rf@opensource.cirrus.com>,
	 Andy Shevchenko <andy@kernel.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-sound@vger.kernel.org,  patches@opensource.cirrus.com,
	 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH 02/12] gpio: lp87565: use new GPIO line value setter callbacks
Date: Tue, 06 May 2025 11:01:45 +0200	[thread overview]
Message-ID: <20250506-gpiochip-set-rv-gpio-part3-v1-2-0fbdea5a9667@linaro.org> (raw)
In-Reply-To: <20250506-gpiochip-set-rv-gpio-part3-v1-0-0fbdea5a9667@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-lp87565.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-lp87565.c b/drivers/gpio/gpio-lp87565.c
index d3ce027de081f..8ea687d5d028a 100644
--- a/drivers/gpio/gpio-lp87565.c
+++ b/drivers/gpio/gpio-lp87565.c
@@ -30,13 +30,13 @@ static int lp87565_gpio_get(struct gpio_chip *chip, unsigned int offset)
 	return !!(val & BIT(offset));
 }
 
-static void lp87565_gpio_set(struct gpio_chip *chip, unsigned int offset,
-			     int value)
+static int lp87565_gpio_set(struct gpio_chip *chip, unsigned int offset,
+			    int value)
 {
 	struct lp87565_gpio *gpio = gpiochip_get_data(chip);
 
-	regmap_update_bits(gpio->map, LP87565_REG_GPIO_OUT,
-			   BIT(offset), value ? BIT(offset) : 0);
+	return regmap_update_bits(gpio->map, LP87565_REG_GPIO_OUT,
+				  BIT(offset), value ? BIT(offset) : 0);
 }
 
 static int lp87565_gpio_get_direction(struct gpio_chip *chip,
@@ -69,8 +69,11 @@ static int lp87565_gpio_direction_output(struct gpio_chip *chip,
 					 unsigned int offset, int value)
 {
 	struct lp87565_gpio *gpio = gpiochip_get_data(chip);
+	int ret;
 
-	lp87565_gpio_set(chip, offset, value);
+	ret = lp87565_gpio_set(chip, offset, value);
+	if (ret)
+		return ret;
 
 	return regmap_update_bits(gpio->map,
 				  LP87565_REG_GPIO_CONFIG,
@@ -136,7 +139,7 @@ static const struct gpio_chip template_chip = {
 	.direction_input	= lp87565_gpio_direction_input,
 	.direction_output	= lp87565_gpio_direction_output,
 	.get			= lp87565_gpio_get,
-	.set			= lp87565_gpio_set,
+	.set_rv			= lp87565_gpio_set,
 	.set_config		= lp87565_gpio_set_config,
 	.base			= -1,
 	.ngpio			= 3,

-- 
2.45.2


  parent reply	other threads:[~2025-05-06  9:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06  9:01 [PATCH 00/12] gpio: convert more GPIO chips to using new value setters - part 3 for v6.16 Bartosz Golaszewski
2025-05-06  9:01 ` [PATCH 01/12] gpio: lp873x: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-05-06  9:01 ` Bartosz Golaszewski [this message]
2025-05-06  9:01 ` [PATCH 03/12] gpio: lpc18xx: " Bartosz Golaszewski
2025-05-06  9:01 ` [PATCH 04/12] gpio: lpc32xx: " Bartosz Golaszewski
2025-05-06  9:01 ` [PATCH 05/12] gpio: madera: " Bartosz Golaszewski
2025-05-06  9:20   ` Charles Keepax
2025-05-06  9:01 ` [PATCH 06/12] gpio: max3191x: remove unused callbacks Bartosz Golaszewski
2025-05-06  9:01 ` [PATCH 07/12] gpio: max730x: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-05-06  9:01 ` [PATCH 08/12] gpio: max732x: " Bartosz Golaszewski
2025-05-06  9:01 ` [PATCH 09/12] gpio: max77620: " Bartosz Golaszewski
2025-05-06  9:01 ` [PATCH 10/12] gpio: mb86s7x: " Bartosz Golaszewski
2025-05-06  9:01 ` [PATCH 11/12] gpio: mc33880: " Bartosz Golaszewski
2025-05-06  9:01 ` [PATCH 12/12] gpio: ml-ioh: " Bartosz Golaszewski
2025-05-07 14:55   ` Andy Shevchenko
2025-05-13 13:15 ` [PATCH 00/12] gpio: convert more GPIO chips to using new value setters - part 3 for v6.16 Bartosz Golaszewski
2025-05-13 13:37   ` 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=20250506-gpiochip-set-rv-gpio-part3-v1-2-0fbdea5a9667@linaro.org \
    --to=brgl@bgdev.pl \
    --cc=andy@kernel.org \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=piotr.wojtaszczyk@timesys.com \
    --cc=rf@opensource.cirrus.com \
    --cc=vz@mleia.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).