Re: [PATCH 2/2] pinctrl: cirrus: cs42l43: use new GPIO line value setter callbacks

From: Charles Keepax
Date: Thu Jun 12 2025 - 08:36:52 EST


On Thu, Jun 12, 2025 at 02:19:54PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> 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@xxxxxxxxxx>
> ---
> +static int cs42l43_gpio_set(struct gpio_chip *chip, unsigned int offset,
> + int value)
> {
> struct cs42l43_pin *priv = gpiochip_get_data(chip);
> unsigned int shift = offset + CS42L43_GPIO1_LVL_SHIFT;
> @@ -493,23 +494,27 @@ static void cs42l43_gpio_set(struct gpio_chip *chip, unsigned int offset, int va
> offset + 1, str_high_low(value));
>
> ret = pm_runtime_resume_and_get(priv->dev);
> - if (ret) {
> - dev_err(priv->dev, "Failed to resume for set: %d\n", ret);
> - return;
> - }
> + if (ret)
> + return ret;

Is there a reason to lose the error message here? Always nice to
know which of the two paths failed when things go bad.

Thanks,
Charles
>
> ret = regmap_update_bits(priv->regmap, CS42L43_GPIO_CTRL1,
> BIT(shift), value << shift);
> if (ret)
> - dev_err(priv->dev, "Failed to set gpio%d: %d\n", offset + 1, ret);
> + return ret;
>
> pm_runtime_put(priv->dev);
> +
> + return 0;
> }