9
0
Fork 0

net: phy: don't use 'dev' as name for variables of type struct phy_device

Using 'dev' as name for variables which are not of type
struct device(_d) is bad habit and leads to confusions. Use phydev
instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2014-09-15 15:47:52 +02:00
parent 1b5086995e
commit 1b4c08d2f2
1 changed files with 39 additions and 39 deletions

View File

@ -46,26 +46,26 @@ static int phy_aneg_done(struct phy_device *phydev)
return drv->aneg_done(phydev); return drv->aneg_done(phydev);
} }
int phy_update_status(struct phy_device *dev) int phy_update_status(struct phy_device *phydev)
{ {
struct phy_driver *drv = to_phy_driver(dev->dev.driver); struct phy_driver *drv = to_phy_driver(phydev->dev.driver);
struct eth_device *edev = dev->attached_dev; struct eth_device *edev = phydev->attached_dev;
int ret; int ret;
int oldspeed = dev->speed, oldduplex = dev->duplex; int oldspeed = phydev->speed, oldduplex = phydev->duplex;
ret = drv->read_status(dev); ret = drv->read_status(phydev);
if (ret) if (ret)
return ret; return ret;
if (dev->speed == oldspeed && dev->duplex == oldduplex) if (phydev->speed == oldspeed && phydev->duplex == oldduplex)
return 0; return 0;
if (dev->adjust_link) if (phydev->adjust_link)
dev->adjust_link(edev); phydev->adjust_link(edev);
if (dev->link) if (phydev->link)
dev_info(&edev->dev, "%dMbps %s duplex link detected\n", dev->speed, dev_info(&edev->dev, "%dMbps %s duplex link detected\n",
dev->duplex ? "full" : "half"); phydev->speed, phydev->duplex ? "full" : "half");
return 0; return 0;
} }
@ -151,28 +151,28 @@ int phy_scan_fixups(struct phy_device *phydev)
static struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id) static struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id)
{ {
struct phy_device *dev; struct phy_device *phydev;
/* We allocate the device, and initialize the /* We allocate the device, and initialize the
* default values */ * default values */
dev = xzalloc(sizeof(*dev)); phydev = xzalloc(sizeof(*phydev));
dev->speed = 0; phydev->speed = 0;
dev->duplex = -1; phydev->duplex = -1;
dev->pause = dev->asym_pause = 0; phydev->pause = phydev->asym_pause = 0;
dev->link = 1; phydev->link = 1;
dev->autoneg = AUTONEG_ENABLE; phydev->autoneg = AUTONEG_ENABLE;
dev->addr = addr; phydev->addr = addr;
dev->phy_id = phy_id; phydev->phy_id = phy_id;
dev->bus = bus; phydev->bus = bus;
dev->dev.bus = &mdio_bus_type; phydev->dev.bus = &mdio_bus_type;
strcpy(dev->dev.name, "phy"); strcpy(phydev->dev.name, "phy");
dev->dev.id = DEVICE_ID_DYNAMIC; phydev->dev.id = DEVICE_ID_DYNAMIC;
return dev; return phydev;
} }
/** /**
* get_phy_id - reads the specified addr for its ID. * get_phy_id - reads the specified addr for its ID.
@ -217,7 +217,7 @@ 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) struct phy_device *get_phy_device(struct mii_bus *bus, int addr)
{ {
struct phy_device *dev = NULL; struct phy_device *phydev = NULL;
u32 phy_id = 0; u32 phy_id = 0;
int r; int r;
@ -229,9 +229,9 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr)
if ((phy_id & 0x1fffffff) == 0x1fffffff) if ((phy_id & 0x1fffffff) == 0x1fffffff)
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
dev = phy_device_create(bus, addr, phy_id); phydev = phy_device_create(bus, addr, phy_id);
return dev; return phydev;
} }
static void phy_config_aneg(struct phy_device *phydev) static void phy_config_aneg(struct phy_device *phydev)
@ -242,31 +242,31 @@ static void phy_config_aneg(struct phy_device *phydev)
drv->config_aneg(phydev); drv->config_aneg(phydev);
} }
int phy_register_device(struct phy_device* dev) int phy_register_device(struct phy_device *phydev)
{ {
int ret; int ret;
if (dev->registered) if (phydev->registered)
return -EBUSY; return -EBUSY;
dev->dev.parent = &dev->bus->dev; phydev->dev.parent = &phydev->bus->dev;
ret = register_device(&dev->dev); ret = register_device(&phydev->dev);
if (ret) if (ret)
return ret; return ret;
dev->bus->phy_map[dev->addr] = dev; phydev->bus->phy_map[phydev->addr] = phydev;
dev->registered = 1; phydev->registered = 1;
if (dev->dev.driver) if (phydev->dev.driver)
return 0; return 0;
dev->dev.driver = &genphy_driver.drv; phydev->dev.driver = &genphy_driver.drv;
ret = device_probe(&dev->dev); ret = device_probe(&phydev->dev);
if (ret) { if (ret) {
unregister_device(&dev->dev); unregister_device(&phydev->dev);
dev->registered = 0; phydev->registered = 0;
} }
return ret; return ret;