mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
net: phy: at803x: Use devm_regulator_get_enable_optional()
[ Upstream commit988e8d90b3] Use devm_regulator_get_enable_optional() instead of hand writing it. It saves some line of code. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Stable-dep-of:e58f30246c("net: phy: at803x: fix the wol setting functions") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0d52759710
commit
7dcc894e15
@@ -305,7 +305,6 @@ struct at803x_priv {
|
|||||||
bool is_1000basex;
|
bool is_1000basex;
|
||||||
struct regulator_dev *vddio_rdev;
|
struct regulator_dev *vddio_rdev;
|
||||||
struct regulator_dev *vddh_rdev;
|
struct regulator_dev *vddh_rdev;
|
||||||
struct regulator *vddio;
|
|
||||||
u64 stats[ARRAY_SIZE(at803x_hw_stats)];
|
u64 stats[ARRAY_SIZE(at803x_hw_stats)];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -825,11 +824,11 @@ static int at803x_parse_dt(struct phy_device *phydev)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
priv->vddio = devm_regulator_get_optional(&phydev->mdio.dev,
|
ret = devm_regulator_get_enable_optional(&phydev->mdio.dev,
|
||||||
"vddio");
|
"vddio");
|
||||||
if (IS_ERR(priv->vddio)) {
|
if (ret) {
|
||||||
phydev_err(phydev, "failed to get VDDIO regulator\n");
|
phydev_err(phydev, "failed to get VDDIO regulator\n");
|
||||||
return PTR_ERR(priv->vddio);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only AR8031/8033 support 1000Base-X for SFP modules */
|
/* Only AR8031/8033 support 1000Base-X for SFP modules */
|
||||||
@@ -857,12 +856,6 @@ static int at803x_probe(struct phy_device *phydev)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (priv->vddio) {
|
|
||||||
ret = regulator_enable(priv->vddio);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (phydev->drv->phy_id == ATH8031_PHY_ID) {
|
if (phydev->drv->phy_id == ATH8031_PHY_ID) {
|
||||||
int ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG);
|
int ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG);
|
||||||
int mode_cfg;
|
int mode_cfg;
|
||||||
@@ -870,10 +863,8 @@ static int at803x_probe(struct phy_device *phydev)
|
|||||||
.wolopts = 0,
|
.wolopts = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ccr < 0) {
|
if (ccr < 0)
|
||||||
ret = ccr;
|
return ccr;
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
mode_cfg = ccr & AT803X_MODE_CFG_MASK;
|
mode_cfg = ccr & AT803X_MODE_CFG_MASK;
|
||||||
|
|
||||||
switch (mode_cfg) {
|
switch (mode_cfg) {
|
||||||
@@ -891,25 +882,11 @@ static int at803x_probe(struct phy_device *phydev)
|
|||||||
ret = at803x_set_wol(phydev, &wol);
|
ret = at803x_set_wol(phydev, &wol);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
phydev_err(phydev, "failed to disable WOL on probe: %d\n", ret);
|
phydev_err(phydev, "failed to disable WOL on probe: %d\n", ret);
|
||||||
goto err;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
|
||||||
if (priv->vddio)
|
|
||||||
regulator_disable(priv->vddio);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void at803x_remove(struct phy_device *phydev)
|
|
||||||
{
|
|
||||||
struct at803x_priv *priv = phydev->priv;
|
|
||||||
|
|
||||||
if (priv->vddio)
|
|
||||||
regulator_disable(priv->vddio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int at803x_get_features(struct phy_device *phydev)
|
static int at803x_get_features(struct phy_device *phydev)
|
||||||
@@ -2022,7 +1999,6 @@ static struct phy_driver at803x_driver[] = {
|
|||||||
.name = "Qualcomm Atheros AR8035",
|
.name = "Qualcomm Atheros AR8035",
|
||||||
.flags = PHY_POLL_CABLE_TEST,
|
.flags = PHY_POLL_CABLE_TEST,
|
||||||
.probe = at803x_probe,
|
.probe = at803x_probe,
|
||||||
.remove = at803x_remove,
|
|
||||||
.config_aneg = at803x_config_aneg,
|
.config_aneg = at803x_config_aneg,
|
||||||
.config_init = at803x_config_init,
|
.config_init = at803x_config_init,
|
||||||
.soft_reset = genphy_soft_reset,
|
.soft_reset = genphy_soft_reset,
|
||||||
@@ -2044,7 +2020,6 @@ static struct phy_driver at803x_driver[] = {
|
|||||||
.name = "Qualcomm Atheros AR8030",
|
.name = "Qualcomm Atheros AR8030",
|
||||||
.phy_id_mask = AT8030_PHY_ID_MASK,
|
.phy_id_mask = AT8030_PHY_ID_MASK,
|
||||||
.probe = at803x_probe,
|
.probe = at803x_probe,
|
||||||
.remove = at803x_remove,
|
|
||||||
.config_init = at803x_config_init,
|
.config_init = at803x_config_init,
|
||||||
.link_change_notify = at803x_link_change_notify,
|
.link_change_notify = at803x_link_change_notify,
|
||||||
.set_wol = at803x_set_wol,
|
.set_wol = at803x_set_wol,
|
||||||
@@ -2060,7 +2035,6 @@ static struct phy_driver at803x_driver[] = {
|
|||||||
.name = "Qualcomm Atheros AR8031/AR8033",
|
.name = "Qualcomm Atheros AR8031/AR8033",
|
||||||
.flags = PHY_POLL_CABLE_TEST,
|
.flags = PHY_POLL_CABLE_TEST,
|
||||||
.probe = at803x_probe,
|
.probe = at803x_probe,
|
||||||
.remove = at803x_remove,
|
|
||||||
.config_init = at803x_config_init,
|
.config_init = at803x_config_init,
|
||||||
.config_aneg = at803x_config_aneg,
|
.config_aneg = at803x_config_aneg,
|
||||||
.soft_reset = genphy_soft_reset,
|
.soft_reset = genphy_soft_reset,
|
||||||
@@ -2083,7 +2057,6 @@ static struct phy_driver at803x_driver[] = {
|
|||||||
PHY_ID_MATCH_EXACT(ATH8032_PHY_ID),
|
PHY_ID_MATCH_EXACT(ATH8032_PHY_ID),
|
||||||
.name = "Qualcomm Atheros AR8032",
|
.name = "Qualcomm Atheros AR8032",
|
||||||
.probe = at803x_probe,
|
.probe = at803x_probe,
|
||||||
.remove = at803x_remove,
|
|
||||||
.flags = PHY_POLL_CABLE_TEST,
|
.flags = PHY_POLL_CABLE_TEST,
|
||||||
.config_init = at803x_config_init,
|
.config_init = at803x_config_init,
|
||||||
.link_change_notify = at803x_link_change_notify,
|
.link_change_notify = at803x_link_change_notify,
|
||||||
@@ -2099,7 +2072,6 @@ static struct phy_driver at803x_driver[] = {
|
|||||||
PHY_ID_MATCH_EXACT(ATH9331_PHY_ID),
|
PHY_ID_MATCH_EXACT(ATH9331_PHY_ID),
|
||||||
.name = "Qualcomm Atheros AR9331 built-in PHY",
|
.name = "Qualcomm Atheros AR9331 built-in PHY",
|
||||||
.probe = at803x_probe,
|
.probe = at803x_probe,
|
||||||
.remove = at803x_remove,
|
|
||||||
.suspend = at803x_suspend,
|
.suspend = at803x_suspend,
|
||||||
.resume = at803x_resume,
|
.resume = at803x_resume,
|
||||||
.flags = PHY_POLL_CABLE_TEST,
|
.flags = PHY_POLL_CABLE_TEST,
|
||||||
@@ -2116,7 +2088,6 @@ static struct phy_driver at803x_driver[] = {
|
|||||||
PHY_ID_MATCH_EXACT(QCA9561_PHY_ID),
|
PHY_ID_MATCH_EXACT(QCA9561_PHY_ID),
|
||||||
.name = "Qualcomm Atheros QCA9561 built-in PHY",
|
.name = "Qualcomm Atheros QCA9561 built-in PHY",
|
||||||
.probe = at803x_probe,
|
.probe = at803x_probe,
|
||||||
.remove = at803x_remove,
|
|
||||||
.suspend = at803x_suspend,
|
.suspend = at803x_suspend,
|
||||||
.resume = at803x_resume,
|
.resume = at803x_resume,
|
||||||
.flags = PHY_POLL_CABLE_TEST,
|
.flags = PHY_POLL_CABLE_TEST,
|
||||||
@@ -2182,7 +2153,6 @@ static struct phy_driver at803x_driver[] = {
|
|||||||
.name = "Qualcomm QCA8081",
|
.name = "Qualcomm QCA8081",
|
||||||
.flags = PHY_POLL_CABLE_TEST,
|
.flags = PHY_POLL_CABLE_TEST,
|
||||||
.probe = at803x_probe,
|
.probe = at803x_probe,
|
||||||
.remove = at803x_remove,
|
|
||||||
.config_intr = at803x_config_intr,
|
.config_intr = at803x_config_intr,
|
||||||
.handle_interrupt = at803x_handle_interrupt,
|
.handle_interrupt = at803x_handle_interrupt,
|
||||||
.get_tunable = at803x_get_tunable,
|
.get_tunable = at803x_get_tunable,
|
||||||
|
|||||||
Reference in New Issue
Block a user