phy: Add phydev_err() and phydev_dbg() macros
In preparation for moving some of the phy_device structure members, add macros for printing errors and debug information. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
cd690e48f5
commit
72ba48be3e
@@ -281,8 +281,8 @@ static void at803x_link_change_notify(struct phy_device *phydev)
|
|||||||
|
|
||||||
at803x_context_restore(phydev, &context);
|
at803x_context_restore(phydev, &context);
|
||||||
|
|
||||||
dev_dbg(&phydev->dev, "%s(): phy was reset\n",
|
phydev_dbg(phydev, "%s(): phy was reset\n",
|
||||||
__func__);
|
__func__);
|
||||||
priv->phy_reset = true;
|
priv->phy_reset = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -163,8 +163,9 @@ static int bcm87xx_did_interrupt(struct phy_device *phydev)
|
|||||||
reg = phy_read(phydev, BCM87XX_LASI_STATUS);
|
reg = phy_read(phydev, BCM87XX_LASI_STATUS);
|
||||||
|
|
||||||
if (reg < 0) {
|
if (reg < 0) {
|
||||||
dev_err(&phydev->dev,
|
phydev_err(phydev,
|
||||||
"Error: Read of BCM87XX_LASI_STATUS failed: %d\n", reg);
|
"Error: Read of BCM87XX_LASI_STATUS failed: %d\n",
|
||||||
|
reg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (reg & 1) != 0;
|
return (reg & 1) != 0;
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ static int kszphy_setup_led(struct phy_device *phydev, u32 reg, int val)
|
|||||||
rc = phy_write(phydev, reg, temp);
|
rc = phy_write(phydev, reg, temp);
|
||||||
out:
|
out:
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
dev_err(&phydev->dev, "failed to set led mode\n");
|
phydev_err(phydev, "failed to set led mode\n");
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ static int kszphy_broadcast_disable(struct phy_device *phydev)
|
|||||||
ret = phy_write(phydev, MII_KSZPHY_OMSO, ret | KSZPHY_OMSO_B_CAST_OFF);
|
ret = phy_write(phydev, MII_KSZPHY_OMSO, ret | KSZPHY_OMSO_B_CAST_OFF);
|
||||||
out:
|
out:
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(&phydev->dev, "failed to disable broadcast address\n");
|
phydev_err(phydev, "failed to disable broadcast address\n");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ static int kszphy_nand_tree_disable(struct phy_device *phydev)
|
|||||||
ret & ~KSZPHY_OMSO_NAND_TREE_ON);
|
ret & ~KSZPHY_OMSO_NAND_TREE_ON);
|
||||||
out:
|
out:
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(&phydev->dev, "failed to disable NAND tree mode\n");
|
phydev_err(phydev, "failed to disable NAND tree mode\n");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -288,7 +288,8 @@ static int kszphy_config_init(struct phy_device *phydev)
|
|||||||
if (priv->rmii_ref_clk_sel) {
|
if (priv->rmii_ref_clk_sel) {
|
||||||
ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val);
|
ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&phydev->dev, "failed to set rmii reference clock\n");
|
phydev_err(phydev,
|
||||||
|
"failed to set rmii reference clock\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -649,8 +650,8 @@ static int kszphy_probe(struct phy_device *phydev)
|
|||||||
priv->led_mode = -1;
|
priv->led_mode = -1;
|
||||||
|
|
||||||
if (priv->led_mode > 3) {
|
if (priv->led_mode > 3) {
|
||||||
dev_err(&phydev->dev, "invalid led mode: 0x%02x\n",
|
phydev_err(phydev, "invalid led mode: 0x%02x\n",
|
||||||
priv->led_mode);
|
priv->led_mode);
|
||||||
priv->led_mode = -1;
|
priv->led_mode = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -672,7 +673,8 @@ static int kszphy_probe(struct phy_device *phydev)
|
|||||||
} else if (rate > 49500000 && rate < 50500000) {
|
} else if (rate > 49500000 && rate < 50500000) {
|
||||||
priv->rmii_ref_clk_sel_val = !rmii_ref_clk_sel_25_mhz;
|
priv->rmii_ref_clk_sel_val = !rmii_ref_clk_sel_25_mhz;
|
||||||
} else {
|
} else {
|
||||||
dev_err(&phydev->dev, "Clock rate out of range: %ld\n", rate);
|
phydev_err(phydev, "Clock rate out of range: %ld\n",
|
||||||
|
rate);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -995,8 +995,9 @@ void phy_state_machine(struct work_struct *work)
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
phy_error(phydev);
|
phy_error(phydev);
|
||||||
|
|
||||||
dev_dbg(&phydev->dev, "PHY state change %s -> %s\n",
|
phydev_dbg(phydev, "PHY state change %s -> %s\n",
|
||||||
phy_state_to_str(old_state), phy_state_to_str(phydev->state));
|
phy_state_to_str(old_state),
|
||||||
|
phy_state_to_str(phydev->state));
|
||||||
|
|
||||||
queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
|
queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
|
||||||
PHY_STATE_TIME * HZ);
|
PHY_STATE_TIME * HZ);
|
||||||
|
|||||||
@@ -777,6 +777,12 @@ static inline int phy_read_status(struct phy_device *phydev)
|
|||||||
return phydev->drv->read_status(phydev);
|
return phydev->drv->read_status(phydev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define phydev_err(_phydev, format, args...) \
|
||||||
|
dev_err(&_phydev->dev, format, ##args)
|
||||||
|
|
||||||
|
#define phydev_dbg(_phydev, format, args...) \
|
||||||
|
dev_dbg(&_phydev->dev, format, ##args)
|
||||||
|
|
||||||
int genphy_config_init(struct phy_device *phydev);
|
int genphy_config_init(struct phy_device *phydev);
|
||||||
int genphy_setup_forced(struct phy_device *phydev);
|
int genphy_setup_forced(struct phy_device *phydev);
|
||||||
int genphy_restart_aneg(struct phy_device *phydev);
|
int genphy_restart_aneg(struct phy_device *phydev);
|
||||||
|
|||||||
Reference in New Issue
Block a user