Re: [PATCH v4 01/10] i3c: Add core I3C infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 Jul 2018 16:41:20 +0200
Boris Brezillon <boris.brezillon@xxxxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux