[i2c] [patch 4/5] i2c board_info and i2c_new_device()
Jean Delvare
khali at linux-fr.org
Tue Mar 6 19:12:19 CET 2007
On Mon, 5 Mar 2007 22:14:55 -0800, David Brownell wrote:
> On Monday 05 March 2007 7:22 pm, David Brownell wrote:
> > For the "DVB card" scenarios, a similar function could be used ... but
> > it would take a "struct i2c_adapter *" not a "struct device *", and
> > would not store the data. That way you get your "loop in i2c-core".
>
> That could effectively be i2c_new_devices(adapter, info, n) ... some
> glitches there being that (a) since it doesn't return the i2c_client
> handles it'd be awkward to remove the individual, and (b) fault
> handling, if e.g. only one of three devices could be created, it'd
> be awkward to figure out which one. Maybe another parameter could be
> an array of i2c_client handles, stuffed with either the handle or an
> ERR_PTR() value. A create-one/remove-one style convention is more general.
You're right. I wanted to avoid code duplication in the individual
drivers but it might not be really possible. Fault handling wouldn't be
a problem, it's probably OK to fail all the client creations if one
fails, as the multimedia device is unlikely to work at all with one part
missing. But we need to return the struct i2c_client* pointers, and
there's no convenient way to do that if we create many devices at once,
even more so if they were created as part of i2c_add_adapter().
As a conclusion, the adapter code will most certainly want to call
i2c_new_device() for each device "manually" and we don't need to
bother. If there really is a need for more, I'm certain the v4l people
will let us know and propose something.
Thanks,
--
Jean Delvare
More information about the i2c
mailing list