[i2c] [patch 4/5] i2c board_info and i2c_new_device()

David Brownell david-b at pacbell.net
Tue Mar 6 07:14:55 CET 2007


On Monday 05 March 2007 7:22 pm, David Brownell wrote:

> The notion of using a device handle instead of a bus number may have
> potential, something like
> 
>   int i2c_register_board_info(struct device *dev,
> 	struct i2c_board_info const *info, unsigned n);
> 
> instead of the current signature, moving bus_num out of board_info, but
> otherwise still acting like the current code.  (That is, storing a copy
> of the data, which is inappropriate for those DVB card scenarios.)
> 
> One problem though is those device nodes are normally not available except
> through the driver model.  Mainboard init could change to pass board_info
> down to the code registering that device, but for add-on cards it looks
> like lookup-by-name, maybe with bus_find_device(), would be needed.
> 
> 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.

- Dave



More information about the i2c mailing list