[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 2 Feb 2023 17:09:13 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
Cc: hkallweit1@...il.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, netdev@...r.kernel.org, nic_swsd@...ltek.com,
pabeni@...hat.com, linux-sh@...r.kernel.org,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Rich Felker <dalias@...c.org>
Subject: Re: [PATCH net-next] r8169: use devm_clk_get_optional_enabled() to
simplify the code
Hi Adrian,
On Thu, Feb 2, 2023 at 3:11 PM John Paul Adrian Glaubitz
<glaubitz@...sik.fu-berlin.de> wrote:
> > Now that we have devm_clk_get_optional_enabled(), we don't have to
> > open-code it.
> >
> > Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
> > --- a/drivers/net/ethernet/realtek/r8169_main.c
> > +++ b/drivers/net/ethernet/realtek/r8169_main.c
> > @@ -5216,9 +5185,9 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
> > return -ENOMEM;
> >
> > /* Get the *optional* external "ether_clk" used on some boards */
> > - rc = rtl_get_ether_clk(tp);
> > - if (rc)
> > - return rc;
> > + tp->clk = devm_clk_get_optional_enabled(&pdev->dev, "ether_clk");
> > + if (IS_ERR(tp->clk))
> > + return dev_err_probe(&pdev->dev, PTR_ERR(tp->clk), "failed to get ether_clk\n");
> >
> > /* enable device (incl. PCI PM wakeup and hotplug setup) */
> > rc = pcim_enable_device(pdev);
> > --
> > 2.37.3
>
> This change broke the r8169 driver on my SH7785LCR SuperH Evaluation Board.
>
> With your patch, the driver initialization fails with:
>
> [ 1.648000] r8169 0000:00:00.0: error -EINVAL: failed to get ether_clk
> [ 1.676000] r8169: probe of 0000:00:00.0 failed with error -22
>
> Any idea what could be the problem?
SH's clk_enable() returns -EINVAL if clk == NULL, which is wrong.
Preparing a patch...
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists