[SPAM] [PATCH 3/5] i2c: Add support for dynamic i2c bus numbers

Sascha Hauer s.hauer at pengutronix.de
Tue May 21 02:49:49 EDT 2013


On Tue, May 21, 2013 at 12:27:47AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 22:11 Mon 20 May     , Sascha Hauer wrote:
> > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > ---
> >  drivers/i2c/i2c.c | 13 +++++++++++--
> >  1 file changed, 11 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
> > index 53a11fe..ddf0082 100644
> > --- a/drivers/i2c/i2c.c
> > +++ b/drivers/i2c/i2c.c
> > @@ -384,8 +384,17 @@ int i2c_add_numbered_adapter(struct i2c_adapter *adapter)
> >  {
> >  	int ret;
> >  
> > -	if (i2c_get_adapter(adapter->nr))
> > -		return -EBUSY;
> > +	if (adapter->nr < 0) {
> > +		int nr;
> > +
> > +		for (nr = 0;; nr++)
> > +			if (!i2c_get_adapter(nr))
> > +				break;
> > +		adapter->nr = nr;
> > +	} else {
> > +		if (i2c_get_adapter(adapter->nr))
> > +			return -EBUSY;
> > +	}
> 
> I send a patch exactly the same on spi and you refuse it

The time you sent it we talked about platform devices and I still think
that it's not a good idea to register the SPI masters with dynamic bus
numbers and to have statically assigned numbers in the spi_board_info.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list