linux-sound.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 08/12] gpio: max732x: use new GPIO line value setter callbacks
Date: Tue, 06 May 2025 11:01:51 +0200	[thread overview]
Message-ID: <20250506-gpiochip-set-rv-gpio-part3-v1-8-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-max732x.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 49d362907bc7d..d5ffedb086af4 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -225,16 +225,19 @@ static void max732x_gpio_set_mask(struct gpio_chip *gc, unsigned off, int mask,
 	mutex_unlock(&chip->lock);
 }
 
-static void max732x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val)
+static int max732x_gpio_set_value(struct gpio_chip *gc, unsigned int off,
+				  int val)
 {
 	unsigned base = off & ~0x7;
 	uint8_t mask = 1u << (off & 0x7);
 
 	max732x_gpio_set_mask(gc, base, mask, val << (off & 0x7));
+
+	return 0;
 }
 
-static void max732x_gpio_set_multiple(struct gpio_chip *gc,
-				      unsigned long *mask, unsigned long *bits)
+static int max732x_gpio_set_multiple(struct gpio_chip *gc,
+				     unsigned long *mask, unsigned long *bits)
 {
 	unsigned mask_lo = mask[0] & 0xff;
 	unsigned mask_hi = (mask[0] >> 8) & 0xff;
@@ -243,6 +246,8 @@ static void max732x_gpio_set_multiple(struct gpio_chip *gc,
 		max732x_gpio_set_mask(gc, 0, mask_lo, bits[0] & 0xff);
 	if (mask_hi)
 		max732x_gpio_set_mask(gc, 8, mask_hi, (bits[0] >> 8) & 0xff);
+
+	return 0;
 }
 
 static int max732x_gpio_direction_input(struct gpio_chip *gc, unsigned off)
@@ -580,8 +585,8 @@ static int max732x_setup_gpio(struct max732x_chip *chip,
 		gc->direction_input = max732x_gpio_direction_input;
 	if (chip->dir_output) {
 		gc->direction_output = max732x_gpio_direction_output;
-		gc->set = max732x_gpio_set_value;
-		gc->set_multiple = max732x_gpio_set_multiple;
+		gc->set_rv = max732x_gpio_set_value;
+		gc->set_multiple_rv = max732x_gpio_set_multiple;
 	}
 	gc->get = max732x_gpio_get_value;
 	gc->can_sleep = true;

-- 
2.45.2


  parent reply	other threads:[~2025-05-06  9:02 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 ` [PATCH 02/12] gpio: lp87565: " Bartosz Golaszewski
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 ` Bartosz Golaszewski [this message]
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-8-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).