[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e2c558cf-430d-40df-8829-0f68560bd22f@lunn.ch>
Date: Mon, 29 May 2023 17:21:04 +0200
From: Andrew Lunn <andrew@...n.ch>
To: andy.shevchenko@...il.com
Cc: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
Heiner Kallweit <hkallweit1@...il.com>,
Jiawen Wu <jiawenwu@...stnetic.com>,
Maxime Chevallier <maxime.chevallier@...tlin.com>,
Simon Horman <simon.horman@...igine.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 1/6] net: mdio: add mdio_device_get() and
mdio_device_put()
On Fri, May 26, 2023 at 09:20:17PM +0300, andy.shevchenko@...il.com wrote:
> Fri, May 26, 2023 at 11:14:24AM +0100, Russell King (Oracle) kirjoitti:
> > Add two new operations for a mdio device to manage the refcount on the
> > underlying struct device. This will be used by mdio PCS drivers to
> > simplify the creation and destruction handling, making it easier for
> > users to get it correct.
>
> ...
>
> > +static inline void mdio_device_get(struct mdio_device *mdiodev)
> > +{
> > + get_device(&mdiodev->dev);
>
> Dunno what is the practice in net, but it makes sense to have the pattern as
>
> if (mdiodev)
> return to_mdiodev(get_device(&mdiodev->dev));
>
> which might be helpful in some cases. This approach is used in many cases in
> the kernel.
The device should exist. If it does not, it is a bug, and the
resulting opps will help find the bug.
Andrew
Powered by blists - more mailing lists