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>,
	 Kuppuswamy Sathyanarayanan
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	 Andy Shevchenko <andy@kernel.org>,
	 Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>,
	 Srinivas Neeli <srinivas.neeli@amd.com>,
	 Michal Simek <michal.simek@amd.com>,
	Nandor Han <nandor.han@ge.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	 patches@opensource.cirrus.com,
	linux-arm-kernel@lists.infradead.org,
	 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH 06/19] gpio: wm831x: use new GPIO line value setter callbacks
Date: Wed, 09 Jul 2025 08:41:43 +0200	[thread overview]
Message-ID: <20250709-gpiochip-set-rv-gpio-remaining-v1-6-b8950f69618d@linaro.org> (raw)
In-Reply-To: <20250709-gpiochip-set-rv-gpio-remaining-v1-0-b8950f69618d@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-wm831x.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c
index 61bb83a1e8ae4de29c57066944ce25beacdb454c..ab58aa7c0b9965ff13ea82efa22dbf6fa5d06c92 100644
--- a/drivers/gpio/gpio-wm831x.c
+++ b/drivers/gpio/gpio-wm831x.c
@@ -58,13 +58,14 @@ static int wm831x_gpio_get(struct gpio_chip *chip, unsigned offset)
 		return 0;
 }
 
-static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+static int wm831x_gpio_set(struct gpio_chip *chip, unsigned int offset,
+			   int value)
 {
 	struct wm831x_gpio *wm831x_gpio = gpiochip_get_data(chip);
 	struct wm831x *wm831x = wm831x_gpio->wm831x;
 
-	wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset,
-			value << offset);
+	return wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset,
+			       value << offset);
 }
 
 static int wm831x_gpio_direction_out(struct gpio_chip *chip,
@@ -85,9 +86,7 @@ static int wm831x_gpio_direction_out(struct gpio_chip *chip,
 		return ret;
 
 	/* Can only set GPIO state once it's in output mode */
-	wm831x_gpio_set(chip, offset, value);
-
-	return 0;
+	return wm831x_gpio_set(chip, offset, value);
 }
 
 static int wm831x_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
@@ -254,7 +253,7 @@ static const struct gpio_chip template_chip = {
 	.direction_input	= wm831x_gpio_direction_in,
 	.get			= wm831x_gpio_get,
 	.direction_output	= wm831x_gpio_direction_out,
-	.set			= wm831x_gpio_set,
+	.set_rv			= wm831x_gpio_set,
 	.to_irq			= wm831x_gpio_to_irq,
 	.set_config		= wm831x_set_config,
 	.dbg_show		= wm831x_gpio_dbg_show,

-- 
2.48.1


  parent reply	other threads:[~2025-07-09  6:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09  6:41 [PATCH 00/19] gpio: use new GPIO line value setter callbacks in remaining drivers Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 01/19] gpio: vx855: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 02/19] gpio: wcd934x: check the return value of regmap_update_bits() Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 03/19] gpio: wcd934x: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 04/19] gpio: wcove: " Bartosz Golaszewski
2025-07-09  8:32   ` Andy Shevchenko
2025-07-09  8:41     ` Andy Shevchenko
2025-07-09 14:21   ` Sathyanarayanan Kuppuswamy
2025-07-09  6:41 ` [PATCH 05/19] gpio: winbond: " Bartosz Golaszewski
2025-07-09  6:41 ` Bartosz Golaszewski [this message]
2025-07-09  9:41   ` [PATCH 06/19] gpio: wm831x: " Charles Keepax
2025-07-09  6:41 ` [PATCH 07/19] gpio: wm8350: " Bartosz Golaszewski
2025-07-09  9:42   ` Charles Keepax
2025-07-09  6:41 ` [PATCH 08/19] gpio: wm8994: " Bartosz Golaszewski
2025-07-09  9:43   ` Charles Keepax
2025-07-09  6:41 ` [PATCH 09/19] gpio: xgene: " Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 10/19] gpio: xilinx: " Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 11/19] gpio: xlp: drop unneeded ngpio checks Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 12/19] gpio: xlp: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 13/19] gpio: xra1403: " Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 14/19] gpio: xtensa: remove unneeded .set() callback Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 15/19] gpio: xtensa: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 16/19] gpio: zevio: " Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 17/19] gpio: zynq: " Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 18/19] gpio: zynqmp-modepin: " Bartosz Golaszewski
2025-07-09  6:41 ` [PATCH 19/19] gpio: zynqmp-modepin: set line value in .direction_output() Bartosz Golaszewski
2025-07-15  7:56 ` (subset) [PATCH 00/19] gpio: use new GPIO line value setter callbacks in remaining drivers 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=20250709-gpiochip-set-rv-gpio-remaining-v1-6-b8950f69618d@linaro.org \
    --to=brgl@bgdev.pl \
    --cc=andy@kernel.org \
    --cc=bartosz.golaszewski@linaro.org \
    --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=michal.simek@amd.com \
    --cc=nandor.han@ge.com \
    --cc=patches@opensource.cirrus.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=shubhrajyoti.datta@amd.com \
    --cc=srinivas.neeli@amd.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).