phy: kill excess code
Remove some excess code: - convert assignments to initializers; - kill useless assignments before *return*. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
e62a768f55
commit
553fe92b26
@@ -100,9 +100,7 @@ static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)
|
|||||||
*/
|
*/
|
||||||
static inline int phy_aneg_done(struct phy_device *phydev)
|
static inline int phy_aneg_done(struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval = phy_read(phydev, MII_BMSR);
|
||||||
|
|
||||||
retval = phy_read(phydev, MII_BMSR);
|
|
||||||
|
|
||||||
return (retval < 0) ? retval : (retval & BMSR_ANEGCOMPLETE);
|
return (retval < 0) ? retval : (retval & BMSR_ANEGCOMPLETE);
|
||||||
}
|
}
|
||||||
@@ -498,16 +496,12 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat)
|
|||||||
*/
|
*/
|
||||||
static int phy_enable_interrupts(struct phy_device *phydev)
|
static int phy_enable_interrupts(struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
int err;
|
int err = phy_clear_interrupt(phydev);
|
||||||
|
|
||||||
err = phy_clear_interrupt(phydev);
|
|
||||||
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED);
|
return phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED);
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -571,9 +565,7 @@ EXPORT_SYMBOL(phy_start_interrupts);
|
|||||||
*/
|
*/
|
||||||
int phy_stop_interrupts(struct phy_device *phydev)
|
int phy_stop_interrupts(struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
int err;
|
int err = phy_disable_interrupts(phydev);
|
||||||
|
|
||||||
err = phy_disable_interrupts(phydev);
|
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
phy_error(phydev);
|
phy_error(phydev);
|
||||||
@@ -1108,9 +1100,8 @@ EXPORT_SYMBOL(phy_ethtool_get_eee);
|
|||||||
*/
|
*/
|
||||||
int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data)
|
int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data)
|
||||||
{
|
{
|
||||||
int val;
|
int val = ethtool_adv_to_mmd_eee_adv_t(data->advertised);
|
||||||
|
|
||||||
val = ethtool_adv_to_mmd_eee_adv_t(data->advertised);
|
|
||||||
phy_write_mmd_indirect(phydev->bus, MDIO_AN_EEE_ADV, MDIO_MMD_AN,
|
phy_write_mmd_indirect(phydev->bus, MDIO_AN_EEE_ADV, MDIO_MMD_AN,
|
||||||
phydev->addr, val);
|
phydev->addr, val);
|
||||||
|
|
||||||
|
|||||||
@@ -70,9 +70,8 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
|
|||||||
int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
|
int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
|
||||||
int (*run)(struct phy_device *))
|
int (*run)(struct phy_device *))
|
||||||
{
|
{
|
||||||
struct phy_fixup *fixup;
|
struct phy_fixup *fixup = kzalloc(sizeof(*fixup), GFP_KERNEL);
|
||||||
|
|
||||||
fixup = kzalloc(sizeof(*fixup), GFP_KERNEL);
|
|
||||||
if (!fixup)
|
if (!fixup)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@@ -130,9 +129,7 @@ int phy_scan_fixups(struct phy_device *phydev)
|
|||||||
mutex_lock(&phy_fixup_lock);
|
mutex_lock(&phy_fixup_lock);
|
||||||
list_for_each_entry(fixup, &phy_fixup_list, list) {
|
list_for_each_entry(fixup, &phy_fixup_list, list) {
|
||||||
if (phy_needs_fixup(phydev, fixup)) {
|
if (phy_needs_fixup(phydev, fixup)) {
|
||||||
int err;
|
int err = fixup->run(phydev);
|
||||||
|
|
||||||
err = fixup->run(phydev);
|
|
||||||
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
mutex_unlock(&phy_fixup_lock);
|
mutex_unlock(&phy_fixup_lock);
|
||||||
@@ -801,9 +798,7 @@ EXPORT_SYMBOL(genphy_setup_forced);
|
|||||||
*/
|
*/
|
||||||
int genphy_restart_aneg(struct phy_device *phydev)
|
int genphy_restart_aneg(struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
int ctl;
|
int ctl = phy_read(phydev, MII_BMCR);
|
||||||
|
|
||||||
ctl = phy_read(phydev, MII_BMCR);
|
|
||||||
|
|
||||||
if (ctl < 0)
|
if (ctl < 0)
|
||||||
return ctl;
|
return ctl;
|
||||||
@@ -813,9 +808,7 @@ int genphy_restart_aneg(struct phy_device *phydev)
|
|||||||
/* Don't isolate the PHY if we're negotiating */
|
/* Don't isolate the PHY if we're negotiating */
|
||||||
ctl &= ~BMCR_ISOLATE;
|
ctl &= ~BMCR_ISOLATE;
|
||||||
|
|
||||||
ctl = phy_write(phydev, MII_BMCR, ctl);
|
return phy_write(phydev, MII_BMCR, ctl);
|
||||||
|
|
||||||
return ctl;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(genphy_restart_aneg);
|
EXPORT_SYMBOL(genphy_restart_aneg);
|
||||||
|
|
||||||
@@ -1087,15 +1080,11 @@ EXPORT_SYMBOL(genphy_resume);
|
|||||||
*/
|
*/
|
||||||
static int phy_probe(struct device *dev)
|
static int phy_probe(struct device *dev)
|
||||||
{
|
{
|
||||||
struct phy_device *phydev;
|
struct phy_device *phydev = to_phy_device(dev);
|
||||||
struct phy_driver *phydrv;
|
struct device_driver *drv = phydev->dev.driver;
|
||||||
struct device_driver *drv;
|
struct phy_driver *phydrv = to_phy_driver(drv);
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
phydev = to_phy_device(dev);
|
|
||||||
|
|
||||||
drv = phydev->dev.driver;
|
|
||||||
phydrv = to_phy_driver(drv);
|
|
||||||
phydev->drv = phydrv;
|
phydev->drv = phydrv;
|
||||||
|
|
||||||
/* Disable the interrupt if the PHY doesn't support it
|
/* Disable the interrupt if the PHY doesn't support it
|
||||||
@@ -1130,9 +1119,7 @@ static int phy_probe(struct device *dev)
|
|||||||
|
|
||||||
static int phy_remove(struct device *dev)
|
static int phy_remove(struct device *dev)
|
||||||
{
|
{
|
||||||
struct phy_device *phydev;
|
struct phy_device *phydev = to_phy_device(dev);
|
||||||
|
|
||||||
phydev = to_phy_device(dev);
|
|
||||||
|
|
||||||
mutex_lock(&phydev->lock);
|
mutex_lock(&phydev->lock);
|
||||||
phydev->state = PHY_DOWN;
|
phydev->state = PHY_DOWN;
|
||||||
|
|||||||
Reference in New Issue
Block a user