Re: [PATCH 1/2] pinctrl: cirrus: lochnagar: use new GPIO line value setter callbacks
From: Charles Keepax
Date: Thu Jun 12 2025 - 08:34:55 EST
On Thu, Jun 12, 2025 at 02:19:53PM +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>
> ---
> @@ -1075,29 +1074,31 @@ static void lochnagar_gpio_set(struct gpio_chip *chip,
> case LN_PTYPE_MUX:
> value |= LN2_OP_GPIO;
>
> - ret = lochnagar_pin_set_mux(priv, pin, value);
> + return lochnagar_pin_set_mux(priv, pin, value);
> break;
> case LN_PTYPE_GPIO:
> if (pin->invert)
> value = !value;
>
> - ret = regmap_update_bits(lochnagar->regmap, pin->reg,
> - BIT(pin->shift), value << pin->shift);
> + return regmap_update_bits(lochnagar->regmap, pin->reg,
> + BIT(pin->shift),
> + value << pin->shift);
> break;
> default:
> - ret = -EINVAL;
> break;
> }
>
> - if (ret < 0)
> - dev_err(chip->parent, "Failed to set %s value: %d\n",
> - pin->name, ret);
> + return -EINVAL;
Nit: I would be tempted just to move this return up into the
default case, the other two cases return so its slightly more
symmetical that way. But I don't feel super strongly:
Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
Thanks,
Charles