Commit e109374f authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: phy: fix checkpatch errors

checkpatch spotted a few checkpatch errors such as whitespace damages
and switch/case labels not being on the same column, fix them.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 756b5089
...@@ -332,7 +332,7 @@ int phy_mii_ioctl(struct phy_device *phydev, ...@@ -332,7 +332,7 @@ int phy_mii_ioctl(struct phy_device *phydev,
case SIOCSMIIREG: case SIOCSMIIREG:
if (mii_data->phy_id == phydev->addr) { if (mii_data->phy_id == phydev->addr) {
switch(mii_data->reg_num) { switch (mii_data->reg_num) {
case MII_BMCR: case MII_BMCR:
if ((val & (BMCR_RESET|BMCR_ANENABLE)) == 0) if ((val & (BMCR_RESET|BMCR_ANENABLE)) == 0)
phydev->autoneg = AUTONEG_DISABLE; phydev->autoneg = AUTONEG_DISABLE;
...@@ -714,16 +714,16 @@ void phy_start(struct phy_device *phydev) ...@@ -714,16 +714,16 @@ void phy_start(struct phy_device *phydev)
mutex_lock(&phydev->lock); mutex_lock(&phydev->lock);
switch (phydev->state) { switch (phydev->state) {
case PHY_STARTING: case PHY_STARTING:
phydev->state = PHY_PENDING; phydev->state = PHY_PENDING;
break; break;
case PHY_READY: case PHY_READY:
phydev->state = PHY_UP; phydev->state = PHY_UP;
break; break;
case PHY_HALTED: case PHY_HALTED:
phydev->state = PHY_RESUMING; phydev->state = PHY_RESUMING;
default: default:
break; break;
} }
mutex_unlock(&phydev->lock); mutex_unlock(&phydev->lock);
} }
...@@ -747,153 +747,138 @@ void phy_state_machine(struct work_struct *work) ...@@ -747,153 +747,138 @@ void phy_state_machine(struct work_struct *work)
if (phydev->adjust_state) if (phydev->adjust_state)
phydev->adjust_state(phydev->attached_dev); phydev->adjust_state(phydev->attached_dev);
switch(phydev->state) { switch (phydev->state) {
case PHY_DOWN: case PHY_DOWN:
case PHY_STARTING: case PHY_STARTING:
case PHY_READY: case PHY_READY:
case PHY_PENDING: case PHY_PENDING:
break; break;
case PHY_UP: case PHY_UP:
needs_aneg = 1; needs_aneg = 1;
phydev->link_timeout = PHY_AN_TIMEOUT; phydev->link_timeout = PHY_AN_TIMEOUT;
break;
case PHY_AN:
err = phy_read_status(phydev);
if (err < 0)
break; break;
case PHY_AN:
err = phy_read_status(phydev);
if (err < 0) /* If the link is down, give up on
break; * negotiation for now */
if (!phydev->link) {
phydev->state = PHY_NOLINK;
netif_carrier_off(phydev->attached_dev);
phydev->adjust_link(phydev->attached_dev);
break;
}
/* If the link is down, give up on /* Check if negotiation is done. Break
* negotiation for now */ * if there's an error */
if (!phydev->link) { err = phy_aneg_done(phydev);
phydev->state = PHY_NOLINK; if (err < 0)
netif_carrier_off(phydev->attached_dev); break;
phydev->adjust_link(phydev->attached_dev);
break;
}
/* Check if negotiation is done. Break /* If AN is done, we're running */
* if there's an error */ if (err > 0) {
err = phy_aneg_done(phydev); phydev->state = PHY_RUNNING;
if (err < 0) netif_carrier_on(phydev->attached_dev);
break; phydev->adjust_link(phydev->attached_dev);
/* If AN is done, we're running */ } else if (0 == phydev->link_timeout--) {
if (err > 0) { needs_aneg = 1;
phydev->state = PHY_RUNNING; /* If we have the magic_aneg bit,
netif_carrier_on(phydev->attached_dev); * we try again */
phydev->adjust_link(phydev->attached_dev); if (phydev->drv->flags & PHY_HAS_MAGICANEG)
break;
}
break;
case PHY_NOLINK:
err = phy_read_status(phydev);
} else if (0 == phydev->link_timeout--) { if (err)
needs_aneg = 1;
/* If we have the magic_aneg bit,
* we try again */
if (phydev->drv->flags & PHY_HAS_MAGICANEG)
break;
}
break; break;
case PHY_NOLINK:
err = phy_read_status(phydev);
if (err) if (phydev->link) {
break; phydev->state = PHY_RUNNING;
netif_carrier_on(phydev->attached_dev);
phydev->adjust_link(phydev->attached_dev);
}
break;
case PHY_FORCING:
err = genphy_update_link(phydev);
if (phydev->link) { if (err)
phydev->state = PHY_RUNNING;
netif_carrier_on(phydev->attached_dev);
phydev->adjust_link(phydev->attached_dev);
}
break; break;
case PHY_FORCING:
err = genphy_update_link(phydev);
if (err) if (phydev->link) {
break; phydev->state = PHY_RUNNING;
netif_carrier_on(phydev->attached_dev);
} else {
if (0 == phydev->link_timeout--)
needs_aneg = 1;
}
if (phydev->link) { phydev->adjust_link(phydev->attached_dev);
phydev->state = PHY_RUNNING; break;
netif_carrier_on(phydev->attached_dev); case PHY_RUNNING:
} else { /* Only register a CHANGE if we are
if (0 == phydev->link_timeout--) * polling or ignoring interrupts
needs_aneg = 1; */
} if (!phy_interrupt_is_valid(phydev))
phydev->state = PHY_CHANGELINK;
break;
case PHY_CHANGELINK:
err = phy_read_status(phydev);
phydev->adjust_link(phydev->attached_dev); if (err)
break; break;
case PHY_RUNNING:
/* Only register a CHANGE if we are
* polling or ignoring interrupts
*/
if (!phy_interrupt_is_valid(phydev))
phydev->state = PHY_CHANGELINK;
break;
case PHY_CHANGELINK:
err = phy_read_status(phydev);
if (err) if (phydev->link) {
break; phydev->state = PHY_RUNNING;
netif_carrier_on(phydev->attached_dev);
} else {
phydev->state = PHY_NOLINK;
netif_carrier_off(phydev->attached_dev);
}
if (phydev->link) { phydev->adjust_link(phydev->attached_dev);
phydev->state = PHY_RUNNING;
netif_carrier_on(phydev->attached_dev);
} else {
phydev->state = PHY_NOLINK;
netif_carrier_off(phydev->attached_dev);
}
if (phy_interrupt_is_valid(phydev))
err = phy_config_interrupt(phydev,
PHY_INTERRUPT_ENABLED);
break;
case PHY_HALTED:
if (phydev->link) {
phydev->link = 0;
netif_carrier_off(phydev->attached_dev);
phydev->adjust_link(phydev->attached_dev); phydev->adjust_link(phydev->attached_dev);
do_suspend = 1;
}
break;
case PHY_RESUMING:
if (phy_interrupt_is_valid(phydev)) err = phy_clear_interrupt(phydev);
err = phy_config_interrupt(phydev,
PHY_INTERRUPT_ENABLED);
break;
case PHY_HALTED:
if (phydev->link) {
phydev->link = 0;
netif_carrier_off(phydev->attached_dev);
phydev->adjust_link(phydev->attached_dev);
do_suspend = 1;
}
break;
case PHY_RESUMING:
err = phy_clear_interrupt(phydev); if (err)
break;
if (err) err = phy_config_interrupt(phydev,
break; PHY_INTERRUPT_ENABLED);
err = phy_config_interrupt(phydev, if (err)
PHY_INTERRUPT_ENABLED); break;
if (err) if (AUTONEG_ENABLE == phydev->autoneg) {
err = phy_aneg_done(phydev);
if (err < 0)
break; break;
if (AUTONEG_ENABLE == phydev->autoneg) { /* err > 0 if AN is done.
err = phy_aneg_done(phydev); * Otherwise, it's 0, and we're
if (err < 0) * still waiting for AN */
break; if (err > 0) {
/* err > 0 if AN is done.
* Otherwise, it's 0, and we're
* still waiting for AN */
if (err > 0) {
err = phy_read_status(phydev);
if (err)
break;
if (phydev->link) {
phydev->state = PHY_RUNNING;
netif_carrier_on(phydev->attached_dev);
} else
phydev->state = PHY_NOLINK;
phydev->adjust_link(phydev->attached_dev);
} else {
phydev->state = PHY_AN;
phydev->link_timeout = PHY_AN_TIMEOUT;
}
} else {
err = phy_read_status(phydev); err = phy_read_status(phydev);
if (err) if (err)
break; break;
...@@ -904,8 +889,23 @@ void phy_state_machine(struct work_struct *work) ...@@ -904,8 +889,23 @@ void phy_state_machine(struct work_struct *work)
} else } else
phydev->state = PHY_NOLINK; phydev->state = PHY_NOLINK;
phydev->adjust_link(phydev->attached_dev); phydev->adjust_link(phydev->attached_dev);
} else {
phydev->state = PHY_AN;
phydev->link_timeout = PHY_AN_TIMEOUT;
} }
break; } else {
err = phy_read_status(phydev);
if (err)
break;
if (phydev->link) {
phydev->state = PHY_RUNNING;
netif_carrier_on(phydev->attached_dev);
} else
phydev->state = PHY_NOLINK;
phydev->adjust_link(phydev->attached_dev);
}
break;
} }
mutex_unlock(&phydev->lock); mutex_unlock(&phydev->lock);
......
...@@ -162,7 +162,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, ...@@ -162,7 +162,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (NULL == dev) if (NULL == dev)
return (struct phy_device*) PTR_ERR((void*)-ENOMEM); return (struct phy_device *)PTR_ERR((void *)-ENOMEM);
dev->dev.release = phy_device_release; dev->dev.release = phy_device_release;
...@@ -459,7 +459,7 @@ EXPORT_SYMBOL(phy_connect_direct); ...@@ -459,7 +459,7 @@ EXPORT_SYMBOL(phy_connect_direct);
* choose to call only the subset of functions which provide * choose to call only the subset of functions which provide
* the desired functionality. * the desired functionality.
*/ */
struct phy_device * phy_connect(struct net_device *dev, const char *bus_id, struct phy_device *phy_connect(struct net_device *dev, const char *bus_id,
void (*handler)(struct net_device *), void (*handler)(struct net_device *),
phy_interface_t interface) phy_interface_t interface)
{ {
...@@ -494,7 +494,7 @@ void phy_disconnect(struct phy_device *phydev) ...@@ -494,7 +494,7 @@ void phy_disconnect(struct phy_device *phydev)
phy_stop_interrupts(phydev); phy_stop_interrupts(phydev);
phy_stop_machine(phydev); phy_stop_machine(phydev);
phydev->adjust_link = NULL; phydev->adjust_link = NULL;
phy_detach(phydev); phy_detach(phydev);
...@@ -792,7 +792,7 @@ int genphy_setup_forced(struct phy_device *phydev) ...@@ -792,7 +792,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); err = phy_write(phydev, MII_BMCR, ctl);
return err; return err;
...@@ -965,14 +965,14 @@ int genphy_read_status(struct phy_device *phydev) ...@@ -965,14 +965,14 @@ int genphy_read_status(struct phy_device *phydev)
phydev->duplex = DUPLEX_FULL; phydev->duplex = DUPLEX_FULL;
} else if (lpa & (LPA_100FULL | LPA_100HALF)) { } else if (lpa & (LPA_100FULL | LPA_100HALF)) {
phydev->speed = SPEED_100; phydev->speed = SPEED_100;
if (lpa & LPA_100FULL) if (lpa & LPA_100FULL)
phydev->duplex = DUPLEX_FULL; phydev->duplex = DUPLEX_FULL;
} else } else
if (lpa & LPA_10FULL) if (lpa & LPA_10FULL)
phydev->duplex = DUPLEX_FULL; phydev->duplex = DUPLEX_FULL;
if (phydev->duplex == DUPLEX_FULL){ if (phydev->duplex == DUPLEX_FULL) {
phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0; phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0;
phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0; phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0;
} }
...@@ -1213,7 +1213,7 @@ static struct phy_driver genphy_driver = { ...@@ -1213,7 +1213,7 @@ static struct phy_driver genphy_driver = {
.read_status = genphy_read_status, .read_status = genphy_read_status,
.suspend = genphy_suspend, .suspend = genphy_suspend,
.resume = genphy_resume, .resume = genphy_resume,
.driver = {.owner= THIS_MODULE, }, .driver = { .owner = THIS_MODULE, },
}; };
static int __init phy_init(void) static int __init phy_init(void)
......
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