Commit e62a768f authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by David S. Miller

phy: kill useless local variables

A number of functions (especially in phy.c) has local variables that were hardly
needed in the first place -- remove them.
Signed-off-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4017b4d3
...@@ -67,12 +67,10 @@ EXPORT_SYMBOL(phy_print_status); ...@@ -67,12 +67,10 @@ EXPORT_SYMBOL(phy_print_status);
*/ */
static int phy_clear_interrupt(struct phy_device *phydev) static int phy_clear_interrupt(struct phy_device *phydev)
{ {
int err = 0;
if (phydev->drv->ack_interrupt) if (phydev->drv->ack_interrupt)
err = phydev->drv->ack_interrupt(phydev); return phydev->drv->ack_interrupt(phydev);
return err; return 0;
} }
/** /**
...@@ -84,13 +82,11 @@ static int phy_clear_interrupt(struct phy_device *phydev) ...@@ -84,13 +82,11 @@ static int phy_clear_interrupt(struct phy_device *phydev)
*/ */
static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts) static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)
{ {
int err = 0;
phydev->interrupts = interrupts; phydev->interrupts = interrupts;
if (phydev->drv->config_intr) if (phydev->drv->config_intr)
err = phydev->drv->config_intr(phydev); return phydev->drv->config_intr(phydev);
return err; return 0;
} }
...@@ -314,7 +310,6 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) ...@@ -314,7 +310,6 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
{ {
struct mii_ioctl_data *mii_data = if_mii(ifr); struct mii_ioctl_data *mii_data = if_mii(ifr);
u16 val = mii_data->val_in; u16 val = mii_data->val_in;
int ret = 0;
switch (cmd) { switch (cmd) {
case SIOCGMIIPHY: case SIOCGMIIPHY:
...@@ -324,7 +319,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) ...@@ -324,7 +319,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
case SIOCGMIIREG: case SIOCGMIIREG:
mii_data->val_out = mdiobus_read(phydev->bus, mii_data->phy_id, mii_data->val_out = mdiobus_read(phydev->bus, mii_data->phy_id,
mii_data->reg_num); mii_data->reg_num);
break; return 0;
case SIOCSMIIREG: case SIOCSMIIREG:
if (mii_data->phy_id == phydev->addr) { if (mii_data->phy_id == phydev->addr) {
...@@ -358,8 +353,8 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) ...@@ -358,8 +353,8 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
if (mii_data->reg_num == MII_BMCR && if (mii_data->reg_num == MII_BMCR &&
val & BMCR_RESET) val & BMCR_RESET)
ret = phy_init_hw(phydev); return phy_init_hw(phydev);
break; return 0;
case SIOCSHWTSTAMP: case SIOCSHWTSTAMP:
if (phydev->drv->hwtstamp) if (phydev->drv->hwtstamp)
...@@ -369,8 +364,6 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) ...@@ -369,8 +364,6 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
return ret;
} }
EXPORT_SYMBOL(phy_mii_ioctl); EXPORT_SYMBOL(phy_mii_ioctl);
...@@ -557,8 +550,6 @@ static int phy_disable_interrupts(struct phy_device *phydev) ...@@ -557,8 +550,6 @@ static int phy_disable_interrupts(struct phy_device *phydev)
*/ */
int phy_start_interrupts(struct phy_device *phydev) int phy_start_interrupts(struct phy_device *phydev)
{ {
int err = 0;
atomic_set(&phydev->irq_disable, 0); atomic_set(&phydev->irq_disable, 0);
if (request_irq(phydev->irq, phy_interrupt, if (request_irq(phydev->irq, phy_interrupt,
IRQF_SHARED, IRQF_SHARED,
...@@ -570,9 +561,7 @@ int phy_start_interrupts(struct phy_device *phydev) ...@@ -570,9 +561,7 @@ int phy_start_interrupts(struct phy_device *phydev)
return 0; return 0;
} }
err = phy_enable_interrupts(phydev); return phy_enable_interrupts(phydev);
return err;
} }
EXPORT_SYMBOL(phy_start_interrupts); EXPORT_SYMBOL(phy_start_interrupts);
...@@ -615,7 +604,6 @@ EXPORT_SYMBOL(phy_stop_interrupts); ...@@ -615,7 +604,6 @@ EXPORT_SYMBOL(phy_stop_interrupts);
*/ */
void phy_change(struct work_struct *work) void phy_change(struct work_struct *work)
{ {
int err;
struct phy_device *phydev = struct phy_device *phydev =
container_of(work, struct phy_device, phy_queue); container_of(work, struct phy_device, phy_queue);
...@@ -623,9 +611,7 @@ void phy_change(struct work_struct *work) ...@@ -623,9 +611,7 @@ void phy_change(struct work_struct *work)
!phydev->drv->did_interrupt(phydev)) !phydev->drv->did_interrupt(phydev))
goto ignore; goto ignore;
err = phy_disable_interrupts(phydev); if (phy_disable_interrupts(phydev))
if (err)
goto phy_err; goto phy_err;
mutex_lock(&phydev->lock); mutex_lock(&phydev->lock);
...@@ -637,10 +623,8 @@ void phy_change(struct work_struct *work) ...@@ -637,10 +623,8 @@ void phy_change(struct work_struct *work)
enable_irq(phydev->irq); enable_irq(phydev->irq);
/* Reenable interrupts */ /* Reenable interrupts */
if (PHY_HALTED != phydev->state) if (PHY_HALTED != phydev->state &&
err = phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED); phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED))
if (err)
goto irq_enable_err; goto irq_enable_err;
/* reschedule state queue work to run as soon as possible */ /* reschedule state queue work to run as soon as possible */
...@@ -953,14 +937,10 @@ static inline void mmd_phy_indirect(struct mii_bus *bus, int prtad, int devad, ...@@ -953,14 +937,10 @@ static inline void mmd_phy_indirect(struct mii_bus *bus, int prtad, int devad,
static int phy_read_mmd_indirect(struct mii_bus *bus, int prtad, int devad, static int phy_read_mmd_indirect(struct mii_bus *bus, int prtad, int devad,
int addr) int addr)
{ {
u32 ret;
mmd_phy_indirect(bus, prtad, devad, addr); mmd_phy_indirect(bus, prtad, devad, addr);
/* Read the content of the MMD's selected register */ /* Read the content of the MMD's selected register */
ret = bus->read(bus, addr, MII_MMD_DATA); return bus->read(bus, addr, MII_MMD_DATA);
return ret;
} }
/** /**
...@@ -1000,8 +980,6 @@ static void phy_write_mmd_indirect(struct mii_bus *bus, int prtad, int devad, ...@@ -1000,8 +980,6 @@ static void phy_write_mmd_indirect(struct mii_bus *bus, int prtad, int devad,
*/ */
int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
{ {
int ret = -EPROTONOSUPPORT;
/* According to 802.3az,the EEE is supported only in full duplex-mode. /* According to 802.3az,the EEE is supported only in full duplex-mode.
* Also EEE feature is active when core is operating with MII, GMII * Also EEE feature is active when core is operating with MII, GMII
* or RGMII. * or RGMII.
...@@ -1027,7 +1005,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) ...@@ -1027,7 +1005,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap); cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap);
if (!cap) if (!cap)
goto eee_exit; return -EPROTONOSUPPORT;
/* Check which link settings negotiated and verify it in /* Check which link settings negotiated and verify it in
* the EEE advertising registers. * the EEE advertising registers.
...@@ -1046,7 +1024,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) ...@@ -1046,7 +1024,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp);
idx = phy_find_setting(phydev->speed, phydev->duplex); idx = phy_find_setting(phydev->speed, phydev->duplex);
if (!(lp & adv & settings[idx].setting)) if (!(lp & adv & settings[idx].setting))
goto eee_exit; return -EPROTONOSUPPORT;
if (clk_stop_enable) { if (clk_stop_enable) {
/* Configure the PHY to stop receiving xMII /* Configure the PHY to stop receiving xMII
...@@ -1063,11 +1041,10 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) ...@@ -1063,11 +1041,10 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
MDIO_MMD_PCS, phydev->addr, val); MDIO_MMD_PCS, phydev->addr, val);
} }
ret = 0; /* EEE supported */ return 0; /* EEE supported */
} }
eee_exit: return -EPROTONOSUPPORT;
return ret;
} }
EXPORT_SYMBOL(phy_init_eee); EXPORT_SYMBOL(phy_init_eee);
......
...@@ -327,7 +327,6 @@ static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id, ...@@ -327,7 +327,6 @@ static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id,
struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
{ {
struct phy_c45_device_ids c45_ids = {0}; struct phy_c45_device_ids c45_ids = {0};
struct phy_device *dev = NULL;
u32 phy_id = 0; u32 phy_id = 0;
int r; int r;
...@@ -339,9 +338,7 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) ...@@ -339,9 +338,7 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
if ((phy_id & 0x1fffffff) == 0x1fffffff) if ((phy_id & 0x1fffffff) == 0x1fffffff)
return NULL; return NULL;
dev = phy_device_create(bus, addr, phy_id, is_c45, &c45_ids); return phy_device_create(bus, addr, phy_id, is_c45, &c45_ids);
return dev;
} }
EXPORT_SYMBOL(get_phy_device); EXPORT_SYMBOL(get_phy_device);
...@@ -781,7 +778,6 @@ static int genphy_config_advert(struct phy_device *phydev) ...@@ -781,7 +778,6 @@ static int genphy_config_advert(struct phy_device *phydev)
*/ */
int genphy_setup_forced(struct phy_device *phydev) int genphy_setup_forced(struct phy_device *phydev)
{ {
int err;
int ctl = 0; int ctl = 0;
phydev->pause = 0; phydev->pause = 0;
...@@ -795,9 +791,7 @@ int genphy_setup_forced(struct phy_device *phydev) ...@@ -795,9 +791,7 @@ int genphy_setup_forced(struct phy_device *phydev)
if (DUPLEX_FULL == phydev->duplex) if (DUPLEX_FULL == phydev->duplex)
ctl |= BMCR_FULLDPLX; ctl |= BMCR_FULLDPLX;
err = phy_write(phydev, MII_BMCR, ctl); return phy_write(phydev, MII_BMCR, ctl);
return err;
} }
EXPORT_SYMBOL(genphy_setup_forced); EXPORT_SYMBOL(genphy_setup_forced);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment