Commit 55cc0519 authored by David S. Miller's avatar David S. Miller

Merge branch 'phylib-simplifications'

Sergei Shtylyov says:

====================
Some phylib simplifications

   Here's 2 patches against DaveM's 'net-next.git' repo. We simplify a bogus
string of type casts in the 1st patch and make the code respect some coding
standards of the networking code in the 2nd one. I may follow with fixing of
checkpatch.pl's complaints. if I have time..
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c1b3b199 ef899c07
...@@ -1040,7 +1040,7 @@ int phy_read_mmd_indirect(struct phy_device *phydev, int prtad, ...@@ -1040,7 +1040,7 @@ int phy_read_mmd_indirect(struct phy_device *phydev, int prtad,
struct phy_driver *phydrv = phydev->drv; struct phy_driver *phydrv = phydev->drv;
int value = -1; int value = -1;
if (phydrv->read_mmd_indirect == NULL) { if (!phydrv->read_mmd_indirect) {
struct mii_bus *bus = phydev->bus; struct mii_bus *bus = phydev->bus;
mutex_lock(&bus->mdio_lock); mutex_lock(&bus->mdio_lock);
...@@ -1077,7 +1077,7 @@ void phy_write_mmd_indirect(struct phy_device *phydev, int prtad, ...@@ -1077,7 +1077,7 @@ void phy_write_mmd_indirect(struct phy_device *phydev, int prtad,
{ {
struct phy_driver *phydrv = phydev->drv; struct phy_driver *phydrv = phydev->drv;
if (phydrv->write_mmd_indirect == NULL) { if (!phydrv->write_mmd_indirect) {
struct mii_bus *bus = phydev->bus; struct mii_bus *bus = phydev->bus;
mutex_lock(&bus->mdio_lock); mutex_lock(&bus->mdio_lock);
......
...@@ -156,8 +156,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, ...@@ -156,8 +156,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
/* We allocate the device, and initialize the default values */ /* We allocate the device, and initialize the default values */
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (NULL == dev) if (!dev)
return (struct phy_device *)PTR_ERR((void *)-ENOMEM); return ERR_PTR(-ENOMEM);
dev->dev.release = phy_device_release; dev->dev.release = phy_device_release;
...@@ -178,7 +178,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, ...@@ -178,7 +178,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
dev->bus = bus; dev->bus = bus;
dev->dev.parent = &bus->dev; dev->dev.parent = &bus->dev;
dev->dev.bus = &mdio_bus_type; dev->dev.bus = &mdio_bus_type;
dev->irq = bus->irq != NULL ? bus->irq[addr] : PHY_POLL; dev->irq = bus->irq ? bus->irq[addr] : PHY_POLL;
dev_set_name(&dev->dev, PHY_ID_FMT, bus->id, addr); dev_set_name(&dev->dev, PHY_ID_FMT, bus->id, addr);
dev->state = PHY_DOWN; dev->state = PHY_DOWN;
...@@ -589,7 +589,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, ...@@ -589,7 +589,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
/* Assume that if there is no driver, that it doesn't /* Assume that if there is no driver, that it doesn't
* exist, and we should use the genphy driver. * exist, and we should use the genphy driver.
*/ */
if (NULL == d->driver) { if (!d->driver) {
if (phydev->is_c45) if (phydev->is_c45)
d->driver = &genphy_driver[GENPHY_DRV_10G].driver; d->driver = &genphy_driver[GENPHY_DRV_10G].driver;
else else
......
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