[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180711170320.5b2b0114@bbrezillon>
Date: Wed, 11 Jul 2018 17:03:20 +0200
From: Boris Brezillon <boris.brezillon@...tlin.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Wolfram Sang <wsa@...-dreams.de>, linux-i2c@...r.kernel.org,
Jonathan Corbet <corbet@....net>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Przemyslaw Sroka <psroka@...ence.com>,
Arkadiusz Golec <agolec@...ence.com>,
Alan Douglas <adouglas@...ence.com>,
Bartosz Folta <bfolta@...ence.com>,
Damian Kos <dkos@...ence.com>,
Alicja Jurasik-Urbaniak <alicja@...ence.com>,
Cyprian Wronka <cwronka@...ence.com>,
Suresh Punnoose <sureshp@...ence.com>,
Rafal Ciepiela <rafalc@...ence.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Nishanth Menon <nm@...com>, Rob Herring <robh+dt@...nel.org>,
Pawel Moll <pawel.moll@....com>,
Mark Rutland <mark.rutland@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
DTML <devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Vitor Soares <Vitor.Soares@...opsys.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Linus Walleij <linus.walleij@...aro.org>,
Xiang Lin <Xiang.Lin@...aptics.com>, linux-gpio@...r.kernel.org
Subject: Re: [PATCH v4 01/10] i3c: Add core I3C infrastructure
On Wed, 11 Jul 2018 16:41:20 +0200
Boris Brezillon <boris.brezillon@...tlin.com> wrote:
> > > +/**
> > > + * i3cdev_to_dev() - Returns the device embedded in @i3cdev
> > > + * @i3cdev: I3C device
> > > + *
> > > + * Return: a pointer to a device object.
> > > + */
> > > +struct device *i3cdev_to_dev(struct i3c_device *i3cdev)
> > > +{
> > > + return &i3cdev->dev;
> > > +}
> > > +EXPORT_SYMBOL_GPL(i3cdev_to_dev);
> > > +
> > > +/**
> > > + * dev_to_i3cdev() - Returns the I3C device containing @dev
> > > + * @dev: device object
> > > + *
> > > + * Return: a pointer to an I3C device object.
> > > + */
> > > +struct i3c_device *dev_to_i3cdev(struct device *dev)
> > > +{
> > > + return container_of(dev, struct i3c_device, dev);
> > > +}
> > > +EXPORT_SYMBOL_GPL(dev_to_i3cdev);
> >
> > Many other subsystems just make the device structure available
> > to all client drivers so this can be an inline operation. Is there
> > a strong reason to hide it here?
>
> No, but I think most subsystem do provide dev_to_xxxdev() at least
> (to_platform_device() for instance)
>
My bad. I misunderstood you question. The main reason I did that was
because I didn't want to expose i3c_device internals to the I3C device
drivers. Anyway, this part will be reworked in my v6 to address one
problem we had when re-attaching a pre-existing device that had lost
its dynamic address and acquired a new one.
Since we want that operation to be transparent to I3C device drivers, I
had to decouple the I3C device driver representation from the I3C master
controller one. I thus end up with struct i3C_dev_desc on the controller
API side, and struct i3c_device on the driver side with a link between
the 2 object that can be updated at runtime. And as you can imagine,
i3c_device does not contain a lot of information now.
Powered by blists - more mailing lists