Re: [PATCH] i2c-bfin-twi: Register adapter with a specific bus number

Jean Delvare
2008-01-23T13:26:34Z

Hi Kalle,

On Wed, 23 Jan 2008 10:54:45 +0200 (EET), Kalle Pokki wrote:
> On Wed, 23 Jan 2008, Bryan Wu wrote:
>
> > How do you think of following code, Kalle?
> >
> > /*
> > * If "dev->id" is negative we consider it as zero.
> > * The reason to do so is to avoid sysfs names that only make
> > * sense when there are multiple adapters.
> > */
> > p_adap->nr = dev->id >= 0 ? dev->id : 0;
> >
> > I found some i2c-gpio, i2c-ibm_iic.c and i2c-pxa.c using this code,
> > while others use your idea.
>
> I don't see the point in ever defining dev->id as -1.

The point is spelled out just above:

"The reason to do so is to avoid sysfs names that only make sense when
there are multiple adapters."

I.e., some people prefer to have their platform device named just foo
instead of foo.0. Me, I wouldn't have bothered making an exception for
this, but the fact is that the platform core code supports it.

> None of the current
> users of i2c-bfin-twi does that. Another option could be to use dynamic
> bus numbers with dev->id == -1, but I think the only sane way to enumerate
> this kind of SOC busses is to fix the numbers in the machine
> initialization time.

I don't really care myself. I'll apply your patch as is, but if you
want to update it, that's equally fine.

--
Jean Delvare