[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240914100103.37970b03@fedora.home>
Date: Sat, 14 Sep 2024 10:01:03 +0200
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: davem@...emloft.net, Pantelis Antoniou <pantelis.antoniou@...il.com>,
Andrew Lunn <andrew@...n.ch>, Jakub Kicinski <kuba@...nel.org>, Eric
Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Russell
King <linux@...linux.org.uk>, Christophe Leroy
<christophe.leroy@...roup.eu>, Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com, Herve Codina
<herve.codina@...tlin.com>, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH net-next v3 7/8] net: ethernet: fs_enet: simplify clock
handling with devm accessors
Hello Christophe,
On Fri, 13 Sep 2024 22:24:28 +0200
Christophe JAILLET <christophe.jaillet@...adoo.fr> wrote:
> Le 04/09/2024 à 19:18, Maxime Chevallier a écrit :
> > devm_clock_get_enabled() can be used to simplify clock handling for the
> > PER register clock.
> >
> > Reviewed-by: Andrew Lunn <andrew@...n.ch>
> > Signed-off-by: Maxime Chevallier <maxime.chevallier@...tlin.com>
> > ---
> > .../ethernet/freescale/fs_enet/fs_enet-main.c | 16 ++++------------
> > drivers/net/ethernet/freescale/fs_enet/fs_enet.h | 2 --
> > 2 files changed, 4 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> > index c96a6b9e1445..ec43b71c0eba 100644
> > --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> > +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> > @@ -900,14 +900,9 @@ static int fs_enet_probe(struct platform_device *ofdev)
> > * but require enable to succeed when a clock was specified/found,
> > * keep a reference to the clock upon successful acquisition
> > */
> > - clk = devm_clk_get(&ofdev->dev, "per");
> > - if (!IS_ERR(clk)) {
> > - ret = clk_prepare_enable(clk);
> > - if (ret)
> > - goto out_deregister_fixed_link;
> > -
> > - fpi->clk_per = clk;
> > - }
> > + clk = devm_clk_get_enabled(&ofdev->dev, "per");
> > + if (IS_ERR(clk))
> > + goto out_deregister_fixed_link;
>
> Hi,
>
> I don't know if this can lead to the same issue, but a similar change
> broke a use case in another driver. See the discussion at[1].
>
> It ended to using devm_clk_get_optional_enabled() to keep the same
> behavior as before.
After digging around, there appears to be some platforms that don't
have this clock indeed. Thanks for catching this, the optional is the
way to go.
Thanks,
Maxime
Powered by blists - more mailing lists