mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
net: phy: add flag is_genphy_driven to struct phy_device
In order to get rid of phy_driver_is_genphy() and phy_driver_is_genphy_10g(), as first step add and use a flag phydev->is_genphy_driven. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/3f3ad6dc-402e-4915-8d5a-2306b6d5562b@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
c1864b2eb2
commit
2796ff1e3d
|
|
@ -1522,7 +1522,6 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
|
||||||
struct mii_bus *bus = phydev->mdio.bus;
|
struct mii_bus *bus = phydev->mdio.bus;
|
||||||
struct device *d = &phydev->mdio.dev;
|
struct device *d = &phydev->mdio.dev;
|
||||||
struct module *ndev_owner = NULL;
|
struct module *ndev_owner = NULL;
|
||||||
bool using_genphy = false;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* For Ethernet device drivers that register their own MDIO bus, we
|
/* For Ethernet device drivers that register their own MDIO bus, we
|
||||||
|
|
@ -1548,7 +1547,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
|
||||||
else
|
else
|
||||||
d->driver = &genphy_driver.mdiodrv.driver;
|
d->driver = &genphy_driver.mdiodrv.driver;
|
||||||
|
|
||||||
using_genphy = true;
|
phydev->is_genphy_driven = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!try_module_get(d->driver->owner)) {
|
if (!try_module_get(d->driver->owner)) {
|
||||||
|
|
@ -1557,7 +1556,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
|
||||||
goto error_put_device;
|
goto error_put_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (using_genphy) {
|
if (phydev->is_genphy_driven) {
|
||||||
err = d->driver->probe(d);
|
err = d->driver->probe(d);
|
||||||
if (err >= 0)
|
if (err >= 0)
|
||||||
err = device_bind_driver(d);
|
err = device_bind_driver(d);
|
||||||
|
|
@ -1627,7 +1626,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
|
||||||
* the generic PHY driver we can't figure it out, thus set the old
|
* the generic PHY driver we can't figure it out, thus set the old
|
||||||
* legacy PORT_MII value.
|
* legacy PORT_MII value.
|
||||||
*/
|
*/
|
||||||
if (using_genphy)
|
if (phydev->is_genphy_driven)
|
||||||
phydev->port = PORT_MII;
|
phydev->port = PORT_MII;
|
||||||
|
|
||||||
/* Initial carrier state is off as the phy is about to be
|
/* Initial carrier state is off as the phy is about to be
|
||||||
|
|
@ -1666,6 +1665,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
|
||||||
|
|
||||||
error_module_put:
|
error_module_put:
|
||||||
module_put(d->driver->owner);
|
module_put(d->driver->owner);
|
||||||
|
phydev->is_genphy_driven = 0;
|
||||||
d->driver = NULL;
|
d->driver = NULL;
|
||||||
error_put_device:
|
error_put_device:
|
||||||
put_device(d);
|
put_device(d);
|
||||||
|
|
@ -1799,9 +1799,10 @@ void phy_detach(struct phy_device *phydev)
|
||||||
* from the generic driver so that there's a chance a
|
* from the generic driver so that there's a chance a
|
||||||
* real driver could be loaded
|
* real driver could be loaded
|
||||||
*/
|
*/
|
||||||
if (phy_driver_is_genphy(phydev) ||
|
if (phydev->is_genphy_driven) {
|
||||||
phy_driver_is_genphy_10g(phydev))
|
|
||||||
device_release_driver(&phydev->mdio.dev);
|
device_release_driver(&phydev->mdio.dev);
|
||||||
|
phydev->is_genphy_driven = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Assert the reset signal */
|
/* Assert the reset signal */
|
||||||
phy_device_reset(phydev, 1);
|
phy_device_reset(phydev, 1);
|
||||||
|
|
|
||||||
|
|
@ -528,6 +528,7 @@ struct macsec_ops;
|
||||||
* @mac_managed_pm: Set true if MAC driver takes of suspending/resuming PHY
|
* @mac_managed_pm: Set true if MAC driver takes of suspending/resuming PHY
|
||||||
* @wol_enabled: Set to true if the PHY or the attached MAC have Wake-on-LAN
|
* @wol_enabled: Set to true if the PHY or the attached MAC have Wake-on-LAN
|
||||||
* enabled.
|
* enabled.
|
||||||
|
* @is_genphy_driven: PHY is driven by one of the generic PHY drivers
|
||||||
* @state: State of the PHY for management purposes
|
* @state: State of the PHY for management purposes
|
||||||
* @dev_flags: Device-specific flags used by the PHY driver.
|
* @dev_flags: Device-specific flags used by the PHY driver.
|
||||||
*
|
*
|
||||||
|
|
@ -631,6 +632,7 @@ struct phy_device {
|
||||||
unsigned is_on_sfp_module:1;
|
unsigned is_on_sfp_module:1;
|
||||||
unsigned mac_managed_pm:1;
|
unsigned mac_managed_pm:1;
|
||||||
unsigned wol_enabled:1;
|
unsigned wol_enabled:1;
|
||||||
|
unsigned is_genphy_driven:1;
|
||||||
|
|
||||||
unsigned autoneg:1;
|
unsigned autoneg:1;
|
||||||
/* The most recently read link state */
|
/* The most recently read link state */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user