linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>, Ray Jui <rjui@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Scott Branden <sbranden@broadcom.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: Re: [PATCH 04/15] gpio: bd71828: use new line value setter callbacks
Date: Mon, 10 Mar 2025 15:20:10 +0200	[thread overview]
Message-ID: <475375c9-9d72-4583-a21e-37b17c6b8c46@gmail.com> (raw)
In-Reply-To: <20250310-gpiochip-set-conversion-v1-4-03798bb833eb@linaro.org>

On 10/03/2025 14:40, Bartosz Golaszewski wrote:
> 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-bd71828.c | 15 ++++++---------
>   1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-bd71828.c b/drivers/gpio/gpio-bd71828.c
> index b2ccc320c7b5..4ba151e5cf25 100644
> --- a/drivers/gpio/gpio-bd71828.c
> +++ b/drivers/gpio/gpio-bd71828.c
> @@ -16,10 +16,9 @@ struct bd71828_gpio {
>   	struct gpio_chip gpio;
>   };
>   
> -static void bd71828_gpio_set(struct gpio_chip *chip, unsigned int offset,
> -			     int value)
> +static int bd71828_gpio_set(struct gpio_chip *chip, unsigned int offset,
> +			    int value)
>   {
> -	int ret;
>   	struct bd71828_gpio *bdgpio = gpiochip_get_data(chip);
>   	u8 val = (value) ? BD71828_GPIO_OUT_HI : BD71828_GPIO_OUT_LO;
>   
> @@ -28,12 +27,10 @@ static void bd71828_gpio_set(struct gpio_chip *chip, unsigned int offset,
>   	 * we are dealing with - then we are done
>   	 */
>   	if (offset == HALL_GPIO_OFFSET)
> -		return;
> +		return 0;

Should this be -EINVAL (or, can this check be just dropped?) Value of an 
input pin is tried to be set.

>   
> -	ret = regmap_update_bits(bdgpio->regmap, GPIO_OUT_REG(offset),
> -				 BD71828_GPIO_OUT_MASK, val);
> -	if (ret)
> -		dev_err(bdgpio->dev, "Could not set gpio to %d\n", value);
> +	return regmap_update_bits(bdgpio->regmap, GPIO_OUT_REG(offset),
> +				  BD71828_GPIO_OUT_MASK, val);
>   }
>   
>   static int bd71828_gpio_get(struct gpio_chip *chip, unsigned int offset)
> @@ -112,7 +109,7 @@ static int bd71828_probe(struct platform_device *pdev)
>   	bdgpio->gpio.set_config = bd71828_gpio_set_config;
>   	bdgpio->gpio.can_sleep = true;
>   	bdgpio->gpio.get = bd71828_gpio_get;
> -	bdgpio->gpio.set = bd71828_gpio_set;
> +	bdgpio->gpio.set_rv = bd71828_gpio_set;
>   	bdgpio->gpio.base = -1;
>   
>   	/*
> 


  reply	other threads:[~2025-03-10 13:20 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 [this message]
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 ` [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=475375c9-9d72-4583-a21e-37b17c6b8c46@gmail.com \
    --to=mazziesaccount@gmail.com \
    --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=brgl@bgdev.pl \
    --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=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).