linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 10/15] gpio: creg-snps: use new line value setter callbacks
Date: Mon, 10 Mar 2025 13:40:24 +0100	[thread overview]
Message-ID: <20250310-gpiochip-set-conversion-v1-10-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-creg-snps.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-creg-snps.c b/drivers/gpio/gpio-creg-snps.c
index 4968232f70f2..8b49f02c7896 100644
--- a/drivers/gpio/gpio-creg-snps.c
+++ b/drivers/gpio/gpio-creg-snps.c
@@ -27,7 +27,7 @@ struct creg_gpio {
 	const struct creg_layout *layout;
 };
 
-static void creg_gpio_set(struct gpio_chip *gc, unsigned int offset, int val)
+static int creg_gpio_set(struct gpio_chip *gc, unsigned int offset, int val)
 {
 	struct creg_gpio *hcg = gpiochip_get_data(gc);
 	const struct creg_layout *layout = hcg->layout;
@@ -47,13 +47,13 @@ static void creg_gpio_set(struct gpio_chip *gc, unsigned int offset, int val)
 	reg |=  (value << reg_shift);
 	writel(reg, hcg->regs);
 	spin_unlock_irqrestore(&hcg->lock, flags);
+
+	return 0;
 }
 
 static int creg_gpio_dir_out(struct gpio_chip *gc, unsigned int offset, int val)
 {
-	creg_gpio_set(gc, offset, val);
-
-	return 0;
+	return creg_gpio_set(gc, offset, val);
 }
 
 static int creg_gpio_validate_pg(struct device *dev, struct creg_gpio *hcg,
@@ -167,7 +167,7 @@ static int creg_gpio_probe(struct platform_device *pdev)
 	hcg->gc.label = dev_name(dev);
 	hcg->gc.base = -1;
 	hcg->gc.ngpio = ngpios;
-	hcg->gc.set = creg_gpio_set;
+	hcg->gc.set_rv = creg_gpio_set;
 	hcg->gc.direction_output = creg_gpio_dir_out;
 
 	ret = devm_gpiochip_add_data(dev, &hcg->gc, hcg);

-- 
2.45.2


  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 ` Bartosz Golaszewski [this message]
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 ` [PATCH 14/15] gpio: da9052: " Bartosz Golaszewski
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-10-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).