Skip to content

Commit dea3be4

Browse files
Bartosz Golaszewskikuba-moo
authored andcommitted
net: phy: qca807x: use new GPIO line value setter callbacks
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 <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5d31311 commit dea3be4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/net/phy/qcom/qca807x.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ static int qca807x_gpio_get(struct gpio_chip *gc, unsigned int offset)
377377
return FIELD_GET(QCA807X_GPIO_FORCE_MODE_MASK, val);
378378
}
379379

380-
static void qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
380+
static int qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
381381
{
382382
struct qca807x_gpio_priv *priv = gpiochip_get_data(gc);
383383
u16 reg;
@@ -386,18 +386,19 @@ static void qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int valu
386386
reg = QCA807X_MMD7_LED_FORCE_CTRL(offset);
387387

388388
val = phy_read_mmd(priv->phy, MDIO_MMD_AN, reg);
389+
if (val < 0)
390+
return val;
391+
389392
val &= ~QCA807X_GPIO_FORCE_MODE_MASK;
390393
val |= QCA807X_GPIO_FORCE_EN;
391394
val |= FIELD_PREP(QCA807X_GPIO_FORCE_MODE_MASK, value);
392395

393-
phy_write_mmd(priv->phy, MDIO_MMD_AN, reg, val);
396+
return phy_write_mmd(priv->phy, MDIO_MMD_AN, reg, val);
394397
}
395398

396399
static int qca807x_gpio_dir_out(struct gpio_chip *gc, unsigned int offset, int value)
397400
{
398-
qca807x_gpio_set(gc, offset, value);
399-
400-
return 0;
401+
return qca807x_gpio_set(gc, offset, value);
401402
}
402403

403404
static int qca807x_gpio(struct phy_device *phydev)
@@ -425,7 +426,7 @@ static int qca807x_gpio(struct phy_device *phydev)
425426
gc->get_direction = qca807x_gpio_get_direction;
426427
gc->direction_output = qca807x_gpio_dir_out;
427428
gc->get = qca807x_gpio_get;
428-
gc->set = qca807x_gpio_set;
429+
gc->set_rv = qca807x_gpio_set;
429430

430431
return devm_gpiochip_add_data(dev, gc, priv);
431432
}

0 commit comments

Comments
 (0)