[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5G5ZyO1XRgjfN90@shell.armlinux.org.uk>
Date: Thu, 8 Dec 2022 10:16:07 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Mika Westerberg <mika.westerberg@...ux.intel.com>
Cc: linux-acpi@...r.kernel.org, linux-i2c@...r.kernel.org,
netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Wolfram Sang <wsa@...nel.org>
Subject: Re: [PATCH RFC 1/2] i2c: add fwnode APIs
Hi Mika,
On Thu, Dec 08, 2022 at 12:04:02PM +0200, Mika Westerberg wrote:
> Hi,
>
> On Wed, Dec 07, 2022 at 11:22:24AM +0000, Russell King (Oracle) wrote:
> > +struct i2c_client *i2c_find_device_by_fwnode(struct fwnode_handle *fwnode)
> > +{
> > + struct i2c_client *client;
> > + struct device *dev;
> > +
> > + if (!fwnode)
> > + return NULL;
> > +
> > + dev = bus_find_device_by_fwnode(&i2c_bus_type, fwnode);
> > + if (!dev)
> > + return NULL;
> > +
> > + client = i2c_verify_client(dev);
> > + if (!client)
> > + put_device(dev);
> > +
> > + return client;
> > +}
> > +EXPORT_SYMBOL(i2c_find_device_by_fwnode);
> > +
>
> Drop this empty line.
The additional empty line was there before, and I guess is something the
I2C maintainer wants to logically separate the i2c device stuff from
the rest of the file.
> > +/* must call put_device() when done with returned i2c_client device */
> > +struct i2c_client *i2c_find_device_by_fwnode(struct fwnode_handle *fwnode);
>
> With the kernel-docs in place you probably can drop these comments.
It's what is there against the other prototypes - and is very easy to
get wrong, as I've recently noticed in the sfp.c code as a result of
creating this series.
I find the whole _find_ vs _get_ thing a tad confusing, and there
probably should be just one interface with one way of putting
afterwards to avoid subtle long-standing bugs like this.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists