From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Ray Jui <rjui@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Marek Vasut <marek.vasut+renesas@gmail.com>,
Michael Buesch <m@bues.ch>,
Thomas Richard <thomas.richard@bootlin.com>,
Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
Benson Leung <bleung@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
Andy Shevchenko <andy@kernel.org>,
Support Opensource <support.opensource@diasemi.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
chrome-platform@lists.linux.dev,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH 14/15] gpio: da9052: use new line value setter callbacks
Date: Mon, 10 Mar 2025 13:40:28 +0100 [thread overview]
Message-ID: <20250310-gpiochip-set-conversion-v1-14-03798bb833eb@linaro.org> (raw)
In-Reply-To: <20250310-gpiochip-set-conversion-v1-0-03798bb833eb@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-da9052.c | 34 ++++++++++++----------------------
1 file changed, 12 insertions(+), 22 deletions(-)
diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c
index 6f3905f1b8f5..6482c5b267db 100644
--- a/drivers/gpio/gpio-da9052.c
+++ b/drivers/gpio/gpio-da9052.c
@@ -89,30 +89,20 @@ static int da9052_gpio_get(struct gpio_chip *gc, unsigned offset)
}
}
-static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
+static int da9052_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
{
struct da9052_gpio *gpio = gpiochip_get_data(gc);
- int ret;
- if (da9052_gpio_port_odd(offset)) {
- ret = da9052_reg_update(gpio->da9052, (offset >> 1) +
- DA9052_GPIO_0_1_REG,
- DA9052_GPIO_ODD_PORT_MODE,
- value << DA9052_GPIO_ODD_SHIFT);
- if (ret != 0)
- dev_err(gpio->da9052->dev,
- "Failed to updated gpio odd reg,%d",
- ret);
- } else {
- ret = da9052_reg_update(gpio->da9052, (offset >> 1) +
- DA9052_GPIO_0_1_REG,
- DA9052_GPIO_EVEN_PORT_MODE,
- value << DA9052_GPIO_EVEN_SHIFT);
- if (ret != 0)
- dev_err(gpio->da9052->dev,
- "Failed to updated gpio even reg,%d",
- ret);
- }
+ if (da9052_gpio_port_odd(offset))
+ return da9052_reg_update(gpio->da9052, (offset >> 1) +
+ DA9052_GPIO_0_1_REG,
+ DA9052_GPIO_ODD_PORT_MODE,
+ value << DA9052_GPIO_ODD_SHIFT);
+
+ return da9052_reg_update(gpio->da9052,
+ (offset >> 1) + DA9052_GPIO_0_1_REG,
+ DA9052_GPIO_EVEN_PORT_MODE,
+ value << DA9052_GPIO_EVEN_SHIFT);
}
static int da9052_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
@@ -182,7 +172,7 @@ static const struct gpio_chip reference_gp = {
.label = "da9052-gpio",
.owner = THIS_MODULE,
.get = da9052_gpio_get,
- .set = da9052_gpio_set,
+ .set_rv = da9052_gpio_set,
.direction_input = da9052_gpio_direction_input,
.direction_output = da9052_gpio_direction_output,
.to_irq = da9052_gpio_to_irq,
--
2.45.2
next prev parent reply other threads:[~2025-03-10 12:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 12:40 [PATCH 00/15] gpio: more gpio_chip setter conversions Bartosz Golaszewski
2025-03-10 12:40 ` [PATCH 01/15] gpio: bcm-kona: use lock guards Bartosz Golaszewski
2025-03-10 12:40 ` [PATCH 02/15] gpio: bcm-kona: use new line value setter callbacks Bartosz Golaszewski
2025-03-10 12:40 ` [PATCH 03/15] gpio: bd71815: " Bartosz Golaszewski
2025-03-10 13:16 ` Matti Vaittinen
2025-03-10 12:40 ` [PATCH 04/15] gpio: bd71828: " Bartosz Golaszewski
2025-03-10 13:20 ` Matti Vaittinen
2025-03-10 13:22 ` Bartosz Golaszewski
2025-03-10 14:44 ` Matti Vaittinen
2025-03-10 12:40 ` [PATCH 05/15] gpio: bd9571mwv: " Bartosz Golaszewski
2025-03-10 13:21 ` Matti Vaittinen
2025-03-10 12:40 ` [PATCH 06/15] gpio: bt8xx: allow to build the module with COMPILE_TEST=y Bartosz Golaszewski
2025-03-10 12:40 ` [PATCH 07/15] gpio: bt8xx: use lock guards Bartosz Golaszewski
2025-03-10 12:40 ` [PATCH 08/15] gpio: bt8xx: use new line value setter callbacks Bartosz Golaszewski
2025-03-10 12:40 ` [PATCH 09/15] gpio: cgbc: " Bartosz Golaszewski
2025-03-10 12:40 ` [PATCH 10/15] gpio: creg-snps: " Bartosz Golaszewski
2025-03-10 12:40 ` [PATCH 11/15] gpio: cros-ec: " Bartosz Golaszewski
2025-03-12 3:13 ` Tzung-Bi Shih
2025-03-10 12:40 ` [PATCH 12/15] gpio: crystalcove: " Bartosz Golaszewski
2025-03-10 12:40 ` [PATCH 13/15] gpio: cs5535: " Bartosz Golaszewski
2025-03-10 12:40 ` Bartosz Golaszewski [this message]
2025-03-10 12:40 ` [PATCH 15/15] gpio: da9055: " Bartosz Golaszewski
2025-03-17 7:28 ` [PATCH 00/15] gpio: more gpio_chip setter conversions 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=20250310-gpiochip-set-conversion-v1-14-03798bb833eb@linaro.org \
--to=brgl@bgdev.pl \
--cc=Eugeniy.Paltsev@synopsys.com \
--cc=andy@kernel.org \
--cc=bartosz.golaszewski@linaro.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=florian.fainelli@broadcom.com \
--cc=groeck@chromium.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=m@bues.ch \
--cc=marek.vasut+renesas@gmail.com \
--cc=mazziesaccount@gmail.com \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=support.opensource@diasemi.com \
--cc=thomas.richard@bootlin.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).