[i2c] [PATCH 2/5] i2c: Allow preallocation of I2C bus numbers.

David Brownell david-b at pacbell.net
Fri May 18 19:07:00 CEST 2007


On Friday 18 May 2007, Scott Wood wrote:
> David Brownell wrote:
> > I confess I don't quite follow the intent of this patch.
> > 
> >  - i2c_alloc_bus_number() ... why not just have the platform
> >    maintainer define the numbers?
> 
> Because the platform isn't necessarily going to know about all buses. 
> There could be buses on PCI cards, etc.  Static allocation runs the risk 
> of duplicates.  This was discussed when this was first being brought up 
> back in November or so.

And the answer was, then as now, that the pre-defined busses are
necessarily board-specific (or often, more generally, cpu-specific),
and that when configuring add-on busses you'd use i2c_new_device().

Jean's respone highlighted the essential differences.


> >    (Or in the OF case, just
> >    have the OF glue assign them.)   And it's pointless to
> >    export this, given it supports calling a non-exported routine.
> 
> It needs to be exported so that PCI driver modules with on-board I2C can 
> use it.  And what non-exported routine are you talking about?

i2c_register_board_info(), which is all about (main)board-specific
stuff.  Plus of course, it allocates numbers after the range which
would kick in checks for data registered by that call ... while the
whole point of this "pre-allocated" thing is to allow its use!

 
> >  - i2c_add_prenumbered_adapter() ... caller should just set
> >    adapter->number itself and call i2c_add_numbered_adapter();
> >    no need for a new routine.
> 
> No, because it has no guarantee that the number has not been taken.

That "guarantee" doesn't work as intended though, so there's
still no point to this new routine.

- Dave






More information about the i2c mailing list