* [PATCH] net: phy: shift phy_init_hw after device_add during phy device registration
@ 2014-04-04 13:38 Grygorii Strashko
2014-04-04 13:41 ` Grygorii Strashko
0 siblings, 1 reply; 2+ messages in thread
From: Grygorii Strashko @ 2014-04-04 13:38 UTC (permalink / raw)
To: Florian Fainelli, netdev; +Cc: Grygorii Strashko
Now the call of phy_init_hw() in phy_device_register() is converted to
be just a NOP, because phy_init_hw() is called before PHY devices probing
and phydev->drv == NULL at this moment.
phy_device_register()
|- phy_init_hw() -> NOP
|- device_add()
|- phy_probe() -> may be if driver is ready
|- phydev->drv = <&phy_driver>
Hence, shift call of phy_init_hw() after device_add() and in such way
increase possibility of its execution.
This patch is RFC because:
- this patch will change PHY's callbacks call order: .config_init() will
be called after .probe()
- i'm not sure that phy_init_hw() need to be called from phy_device_register() and
maybe it can be moved in other place, like phy_probe()
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
drivers/net/phy/phy_device.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 2f6989b..496940be 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -352,16 +352,16 @@ int phy_device_register(struct phy_device *phydev)
return -EINVAL;
phydev->bus->phy_map[phydev->addr] = phydev;
- /* Run all of the fixups for this PHY */
- err = phy_init_hw(phydev);
+ err = device_add(&phydev->dev);
if (err) {
- pr_err("PHY %d failed to initialize\n", phydev->addr);
+ pr_err("PHY %d failed to add\n", phydev->addr);
goto out;
}
- err = device_add(&phydev->dev);
+ /* Run all of the fixups for this PHY */
+ err = phy_init_hw(phydev);
if (err) {
- pr_err("PHY %d failed to add\n", phydev->addr);
+ pr_err("PHY %d failed to initialize\n", phydev->addr);
goto out;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: phy: shift phy_init_hw after device_add during phy device registration
2014-04-04 13:38 [PATCH] net: phy: shift phy_init_hw after device_add during phy device registration Grygorii Strashko
@ 2014-04-04 13:41 ` Grygorii Strashko
0 siblings, 0 replies; 2+ messages in thread
From: Grygorii Strashko @ 2014-04-04 13:41 UTC (permalink / raw)
To: Florian Fainelli, netdev; +Cc: Grygorii.Strashko
Sorry, this is [RFC PATCH].
On 04/04/2014 04:38 PM, Grygorii Strashko wrote:
> Now the call of phy_init_hw() in phy_device_register() is converted to
> be just a NOP, because phy_init_hw() is called before PHY devices probing
> and phydev->drv == NULL at this moment.
>
> phy_device_register()
> |- phy_init_hw() -> NOP
> |- device_add()
> |- phy_probe() -> may be if driver is ready
> |- phydev->drv = <&phy_driver>
>
> Hence, shift call of phy_init_hw() after device_add() and in such way
> increase possibility of its execution.
>
> This patch is RFC because:
> - this patch will change PHY's callbacks call order: .config_init() will
> be called after .probe()
> - i'm not sure that phy_init_hw() need to be called from phy_device_register() and
> maybe it can be moved in other place, like phy_probe()
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
> drivers/net/phy/phy_device.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 2f6989b..496940be 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -352,16 +352,16 @@ int phy_device_register(struct phy_device *phydev)
> return -EINVAL;
> phydev->bus->phy_map[phydev->addr] = phydev;
>
> - /* Run all of the fixups for this PHY */
> - err = phy_init_hw(phydev);
> + err = device_add(&phydev->dev);
> if (err) {
> - pr_err("PHY %d failed to initialize\n", phydev->addr);
> + pr_err("PHY %d failed to add\n", phydev->addr);
> goto out;
> }
>
> - err = device_add(&phydev->dev);
> + /* Run all of the fixups for this PHY */
> + err = phy_init_hw(phydev);
> if (err) {
> - pr_err("PHY %d failed to add\n", phydev->addr);
> + pr_err("PHY %d failed to initialize\n", phydev->addr);
> goto out;
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-04 12:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-04 13:38 [PATCH] net: phy: shift phy_init_hw after device_add during phy device registration Grygorii Strashko
2014-04-04 13:41 ` Grygorii Strashko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.