lkml.org 
[lkml]   [2020]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 2/2] net: phy: call phy_disable_interrupts() in phy_init_hw()
From
Date
Le 2020-06-23 à 20:26, Jisheng Zhang a écrit :
> Call phy_disable_interrupts() in phy_init_hw() to "have a defined init
> state as we don't know in which state the PHY is if the PHY driver is
> loaded. We shouldn't assume that it's the chip power-on defaults, BIOS
> or boot loader could have changed this. Or in case of dual-boot
> systems the other OS could leave the PHY in whatever state." as pointed
> out by Heiner.
>
> Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> ---
> drivers/net/phy/phy_device.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 04946de74fa0..f17d397ba689 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -1090,10 +1090,13 @@ int phy_init_hw(struct phy_device *phydev)
> if (ret < 0)
> return ret;
>
> - if (phydev->drv->config_init)
> + if (phydev->drv->config_init) {
> ret = phydev->drv->config_init(phydev);
> + if (ret < 0)
> + return ret;
> + }
>
> - return ret;
> + return phy_disable_interrupts(phydev);

Not sure if the order makes sense here, it may seem more natural for a
driver writer to have interrupts disabled first and then config_init
called (which could enable interrupts not related to link management
like thermal events etc.)
--
Florian

\
 
 \ /
  Last update: 2020-06-24 05:37    [W:0.090 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site