From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Sean Wang <sean.wang@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH 1/5] pinctrl: mediatek: airoha: use new GPIO line value setter callbacks
Date: Tue, 29 Apr 2025 09:09:54 +0200 [thread overview]
Message-ID: <aBB7QkazpVxlUCJc@lore-desk> (raw)
In-Reply-To: <20250425-gpiochip-set-rv-pinctrl-mediatek-v1-1-93e6a01855e7@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 2629 bytes --]
> 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>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> drivers/pinctrl/mediatek/pinctrl-airoha.c | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/pinctrl/mediatek/pinctrl-airoha.c b/drivers/pinctrl/mediatek/pinctrl-airoha.c
> index 5d84a778683d..b97b28ebb37a 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-airoha.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-airoha.c
> @@ -2247,15 +2247,16 @@ static int airoha_convert_pin_to_reg_offset(struct pinctrl_dev *pctrl_dev,
> }
>
> /* gpio callbacks */
> -static void airoha_gpio_set(struct gpio_chip *chip, unsigned int gpio,
> - int value)
> +static int airoha_gpio_set(struct gpio_chip *chip, unsigned int gpio,
> + int value)
> {
> struct airoha_pinctrl *pinctrl = gpiochip_get_data(chip);
> u32 offset = gpio % AIROHA_PIN_BANK_SIZE;
> u8 index = gpio / AIROHA_PIN_BANK_SIZE;
>
> - regmap_update_bits(pinctrl->regmap, pinctrl->gpiochip.data[index],
> - BIT(offset), value ? BIT(offset) : 0);
> + return regmap_update_bits(pinctrl->regmap,
> + pinctrl->gpiochip.data[index],
> + BIT(offset), value ? BIT(offset) : 0);
> }
>
> static int airoha_gpio_get(struct gpio_chip *chip, unsigned int gpio)
> @@ -2280,9 +2281,7 @@ static int airoha_gpio_direction_output(struct gpio_chip *chip,
> if (err)
> return err;
>
> - airoha_gpio_set(chip, gpio, value);
> -
> - return 0;
> + return airoha_gpio_set(chip, gpio, value);
> }
>
> /* irq callbacks */
> @@ -2419,7 +2418,7 @@ static int airoha_pinctrl_add_gpiochip(struct airoha_pinctrl *pinctrl,
> gc->free = gpiochip_generic_free;
> gc->direction_input = pinctrl_gpio_direction_input;
> gc->direction_output = airoha_gpio_direction_output;
> - gc->set = airoha_gpio_set;
> + gc->set_rv = airoha_gpio_set;
> gc->get = airoha_gpio_get;
> gc->base = -1;
> gc->ngpio = AIROHA_NUM_PINS;
> @@ -2715,9 +2714,7 @@ static int airoha_pinconf_set_pin_value(struct pinctrl_dev *pctrl_dev,
> if (pin < 0)
> return pin;
>
> - airoha_gpio_set(&pinctrl->gpiochip.chip, pin, value);
> -
> - return 0;
> + return airoha_gpio_set(&pinctrl->gpiochip.chip, pin, value);
> }
>
> static int airoha_pinconf_set(struct pinctrl_dev *pctrl_dev,
>
> --
> 2.45.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-04-29 7:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-25 9:00 [PATCH 0/5] pinctrl: mediatek: convert GPIO chips to using new value setters Bartosz Golaszewski
2025-04-25 9:00 ` [PATCH 1/5] pinctrl: mediatek: airoha: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-04-29 7:09 ` Lorenzo Bianconi [this message]
2025-04-25 9:00 ` [PATCH 2/5] pinctrl: mediatek: paris: don't double-check the GPIO number Bartosz Golaszewski
2025-04-25 9:00 ` [PATCH 3/5] pinctrl: mediatek: paris: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-04-25 9:01 ` [PATCH 4/5] pinctrl: mediatek: moore: " Bartosz Golaszewski
2025-04-25 9:01 ` [PATCH 5/5] pinctrl: mediatek: common: " Bartosz Golaszewski
2025-05-09 8:05 ` [PATCH 0/5] pinctrl: mediatek: convert GPIO chips to using new value setters Linus Walleij
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=aBB7QkazpVxlUCJc@lore-desk \
--to=lorenzo@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--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-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=sean.wang@kernel.org \
/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