# Re: \[PATCH 4/4\] net: phy: qca807x: use new GPIO line value setter callbacks

- From: Andrew Lunn \<andrew@lunn.ch\>
- Date: 2025-06-10 12:46:26 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2025/06/3085138
- Thread: https://ratatoskr.run/netdev/2025/06/3085112/t.md

```text
> -static void qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
> +static int qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
>  {
>  	struct qca807x_gpio_priv *priv = gpiochip_get_data(gc);
>  	u16 reg;
> @@ -390,14 +390,12 @@ static void qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int valu
>  	val |= QCA807X_GPIO_FORCE_EN;
>  	val |= FIELD_PREP(QCA807X_GPIO_FORCE_MODE_MASK, value);
>  
> -	phy_write_mmd(priv->phy, MDIO_MMD_AN, reg, val);
> +	return phy_write_mmd(priv->phy, MDIO_MMD_AN, reg, val);
>  }

The full function is:

static void qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
{
	struct qca807x_gpio_priv *priv = gpiochip_get_data(gc);
	u16 reg;
	int val;

	reg = QCA807X_MMD7_LED_FORCE_CTRL(offset);

	val = phy_read_mmd(priv->phy, MDIO_MMD_AN, reg);
	val &= ~QCA807X_GPIO_FORCE_MODE_MASK;
	val |= QCA807X_GPIO_FORCE_EN;
	val |= FIELD_PREP(QCA807X_GPIO_FORCE_MODE_MASK, value);

	phy_write_mmd(priv->phy, MDIO_MMD_AN, reg, val);
}

The phy_read_mmd() could also fail and return an error code.

    Andrew

---
pw-bot: cr

```
