[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<AS8PR04MB88490FFC1ED17B686DC1CA5296712@AS8PR04MB8849.eurprd04.prod.outlook.com>
Date: Thu, 3 Oct 2024 19:37:33 +0000
From: Claudiu Manoil <claudiu.manoil@....com>
To: Rosen Penev <rosenp@...il.com>, Maxime Chevallier
<maxime.chevallier@...tlin.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>, "andrew@...n.ch"
<andrew@...n.ch>, "davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>, "kuba@...nel.org"
<kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH net-next 5/6] net: gianfar: use devm for request_irq
> -----Original Message-----
> From: Rosen Penev <rosenp@...il.com>
> Sent: Wednesday, October 2, 2024 10:29 PM
> To: Maxime Chevallier <maxime.chevallier@...tlin.com>
> Cc: netdev@...r.kernel.org; andrew@...n.ch; davem@...emloft.net;
> edumazet@...gle.com; kuba@...nel.org; pabeni@...hat.com; linux-
> kernel@...r.kernel.org; Claudiu Manoil <claudiu.manoil@....com>
> Subject: Re: [PATCH net-next 5/6] net: gianfar: use devm for request_irq
>
> On Wed, Oct 2, 2024 at 12:37 AM Maxime Chevallier
> <maxime.chevallier@...tlin.com> wrote:
> >
> > Hi Rosen,
> >
> > On Tue, 1 Oct 2024 14:22:03 -0700
> > Rosen Penev <rosenp@...il.com> wrote:
> >
> > > Signed-off-by: Rosen Penev <rosenp@...il.com>
> > > ---
> > > drivers/net/ethernet/freescale/gianfar.c | 67
> > > +++++++-----------------
> > > 1 file changed, 18 insertions(+), 49 deletions(-)
> > >
> > > diff --git a/drivers/net/ethernet/freescale/gianfar.c
> > > b/drivers/net/ethernet/freescale/gianfar.c
> > > index 07936dccc389..78fdab3c6f77 100644
> > > --- a/drivers/net/ethernet/freescale/gianfar.c
> > > +++ b/drivers/net/ethernet/freescale/gianfar.c
> > > @@ -2769,13 +2769,6 @@ static void gfar_netpoll(struct net_device
> > > *dev) } #endif
> > >
> > > -static void free_grp_irqs(struct gfar_priv_grp *grp) -{
> > > - free_irq(gfar_irq(grp, TX)->irq, grp);
> > > - free_irq(gfar_irq(grp, RX)->irq, grp);
> > > - free_irq(gfar_irq(grp, ER)->irq, grp);
> > > -}
> > > -
> > > static int register_grp_irqs(struct gfar_priv_grp *grp) {
> > > struct gfar_private *priv = grp->priv; @@ -2789,80 +2782,58 @@
> > > static int register_grp_irqs(struct gfar_priv_grp *grp)
> > > /* Install our interrupt handlers for Error,
> > > * Transmit, and Receive
> > > */
> > > - err = request_irq(gfar_irq(grp, ER)->irq, gfar_error, 0,
> > > - gfar_irq(grp, ER)->name, grp);
> > > + err = devm_request_irq(priv->dev, gfar_irq(grp, ER)->irq,
> > > + gfar_error, 0, gfar_irq(grp, ER)->name,
> > > + grp);
> >
> > This is called during open/close, so the lifetime of the irqs isn't
> > tied to the struct device, devm won't apply here. If you
> > open/close/re-open the device, you'll request the same irq multiple
> > times.
> Good point. Would it make sense to move to probe?
Hello,
Many drivers do request_irq() at device open(), i.e. Intel (e1000, igb),
Broadcom, Marvell, to name a few. And I think that calling request_irq()
at open() is a good practice at least. Do you plan to transition all these drivers
to devm_request_irq()?
-Claudiu
Powered by blists - more mailing lists