[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ycrfjr7wh6IhN+rF@lunn.ch>
Date: Tue, 28 Dec 2021 10:57:34 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Luiz Angelo Daros de Luca <luizluca@...il.com>
Cc: Alvin Šipraga <ALSI@...g-olufsen.dk>,
"open list:NETWORKING DRIVERS" <netdev@...r.kernel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
Arınç ÜNAL <arinc.unal@...nc9.com>
Subject: Re: [PATCH net-next v2 07/13] net: dsa: realtek: add new mdio
interface for drivers
> > > +int realtek_mdio_read_reg(struct realtek_priv *priv, u32 addr, u32 *data)
> > > +{
> > > + u32 phy_id = priv->phy_id;
> > > + struct mii_bus *bus = priv->bus;
> > > +
> > > + BUG_ON(in_interrupt());
> >
> > Again, please don't use BUG here - just make sure this never happens (it
> > looks OK to me). There is a separate warning in mutex_lock which may
> > print a stacktrace if the kernel is configured to do so.
>
> OK. So, is it safe to simply drop it?
Yes. The MDIO core will never call this in interrupt context.
If you want to be paranoid, use might_sleep(); and build your kernel
with CONFIG_DEBUG_ATOMIC_SLEEP.
Andrew
Powered by blists - more mailing lists