* [PATCH] i2c-bfin-twi: Register adapter with a specific bus number
@ 2008-01-22 21:40 Kalle Pokki
[not found] ` <Pine.LNX.4.64.0801222335050.11948-er0LZAA46r2WwDxiJSwuDc1vFkv34tBQrE5yTffgRl4@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Kalle Pokki @ 2008-01-22 21:40 UTC (permalink / raw)
To: i2c-GZX6beZjE8VD60Wz+7aTrA; +Cc: bryan.wu-OyLXuOCK7orQT0dZR+AlfA
All the users of this driver explicitly specify the I2C bus numbers
to be used in their platform data. Make the driver respect that.
Signed-off-by: Kalle Pokki <kalle.pokki-loK5ZF7nR+A@public.gmane.org>
---
drivers/i2c/busses/i2c-bfin-twi.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index 67224a4..7dbdaeb 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -550,6 +550,7 @@ static int i2c_bfin_twi_probe(struct platform_device *dev)
p_adap = &iface->adap;
p_adap->id = I2C_HW_BLACKFIN;
+ p_adap->nr = dev->id;
strlcpy(p_adap->name, dev->name, sizeof(p_adap->name));
p_adap->algo = &bfin_twi_algorithm;
p_adap->algo_data = iface;
@@ -576,7 +577,7 @@ static int i2c_bfin_twi_probe(struct platform_device *dev)
bfin_write_TWI_CONTROL(bfin_read_TWI_CONTROL() | TWI_ENA);
SSYNC();
- rc = i2c_add_adapter(p_adap);
+ rc = i2c_add_numbered_adapter(p_adap);
if (rc < 0)
free_irq(iface->irq, iface);
else
--
1.4.4.2
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
^ permalink raw reply related [flat|nested] 5+ messages in thread[parent not found: <Pine.LNX.4.64.0801222335050.11948-er0LZAA46r2WwDxiJSwuDc1vFkv34tBQrE5yTffgRl4@public.gmane.org>]
* Re: [PATCH] i2c-bfin-twi: Register adapter with a specific bus number [not found] ` <Pine.LNX.4.64.0801222335050.11948-er0LZAA46r2WwDxiJSwuDc1vFkv34tBQrE5yTffgRl4@public.gmane.org> @ 2008-01-23 7:56 ` Bryan Wu 2008-01-23 8:54 ` Kalle Pokki 0 siblings, 1 reply; 5+ messages in thread From: Bryan Wu @ 2008-01-23 7:56 UTC (permalink / raw) To: Kalle Pokki; +Cc: bryan.wu-OyLXuOCK7orQT0dZR+AlfA, i2c-GZX6beZjE8VD60Wz+7aTrA On Tue, 2008-01-22 at 23:40 +0200, Kalle Pokki wrote: > All the users of this driver explicitly specify the I2C bus numbers > to be used in their platform data. Make the driver respect that. > > Signed-off-by: Kalle Pokki <kalle.pokki-loK5ZF7nR+A@public.gmane.org> > --- > drivers/i2c/busses/i2c-bfin-twi.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c > index 67224a4..7dbdaeb 100644 > --- a/drivers/i2c/busses/i2c-bfin-twi.c > +++ b/drivers/i2c/busses/i2c-bfin-twi.c > @@ -550,6 +550,7 @@ static int i2c_bfin_twi_probe(struct platform_device *dev) > > p_adap = &iface->adap; > p_adap->id = I2C_HW_BLACKFIN; > + p_adap->nr = dev->id; 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. > strlcpy(p_adap->name, dev->name, sizeof(p_adap->name)); > p_adap->algo = &bfin_twi_algorithm; > p_adap->algo_data = iface; > @@ -576,7 +577,7 @@ static int i2c_bfin_twi_probe(struct platform_device *dev) > bfin_write_TWI_CONTROL(bfin_read_TWI_CONTROL() | TWI_ENA); > SSYNC(); > > - rc = i2c_add_adapter(p_adap); > + rc = i2c_add_numbered_adapter(p_adap); > if (rc < 0) > free_irq(iface->irq, iface); > else Thanks a lot -Bryan Wu _______________________________________________ i2c mailing list i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org http://lists.lm-sensors.org/mailman/listinfo/i2c ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c-bfin-twi: Register adapter with a specific bus number 2008-01-23 7:56 ` Bryan Wu @ 2008-01-23 8:54 ` Kalle Pokki [not found] ` <Pine.LNX.4.64.0801231047230.30599-er0LZAA46r2WwDxiJSwuDc1vFkv34tBQrE5yTffgRl4@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Kalle Pokki @ 2008-01-23 8:54 UTC (permalink / raw) To: Bryan Wu; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA 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. 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. _______________________________________________ i2c mailing list i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org http://lists.lm-sensors.org/mailman/listinfo/i2c ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <Pine.LNX.4.64.0801231047230.30599-er0LZAA46r2WwDxiJSwuDc1vFkv34tBQrE5yTffgRl4@public.gmane.org>]
* Re: [PATCH] i2c-bfin-twi: Register adapter with a specific bus number [not found] ` <Pine.LNX.4.64.0801231047230.30599-er0LZAA46r2WwDxiJSwuDc1vFkv34tBQrE5yTffgRl4@public.gmane.org> @ 2008-01-23 13:26 ` Jean Delvare [not found] ` <20080123142634.2cc71cd2-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Jean Delvare @ 2008-01-23 13:26 UTC (permalink / raw) To: Kalle Pokki; +Cc: Bryan Wu, i2c-GZX6beZjE8VD60Wz+7aTrA 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 _______________________________________________ i2c mailing list i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org http://lists.lm-sensors.org/mailman/listinfo/i2c ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20080123142634.2cc71cd2-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>]
* Re: [PATCH] i2c-bfin-twi: Register adapter with a specific bus number [not found] ` <20080123142634.2cc71cd2-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org> @ 2008-01-24 10:55 ` Kalle Pokki 0 siblings, 0 replies; 5+ messages in thread From: Kalle Pokki @ 2008-01-24 10:55 UTC (permalink / raw) To: Jean Delvare; +Cc: Bryan Wu, i2c-GZX6beZjE8VD60Wz+7aTrA On Wed, 23 Jan 2008, Jean Delvare wrote: > > 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. OK, now I get it. I didn't even consider that the platform core handled this as a special case, too. Each in-tree user of the driver already sets dev->id = 0, even if there is only one device, so adding the extra check wouldn't make much difference now. _______________________________________________ i2c mailing list i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org http://lists.lm-sensors.org/mailman/listinfo/i2c ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-24 10:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-22 21:40 [PATCH] i2c-bfin-twi: Register adapter with a specific bus number Kalle Pokki
[not found] ` <Pine.LNX.4.64.0801222335050.11948-er0LZAA46r2WwDxiJSwuDc1vFkv34tBQrE5yTffgRl4@public.gmane.org>
2008-01-23 7:56 ` Bryan Wu
2008-01-23 8:54 ` Kalle Pokki
[not found] ` <Pine.LNX.4.64.0801231047230.30599-er0LZAA46r2WwDxiJSwuDc1vFkv34tBQrE5yTffgRl4@public.gmane.org>
2008-01-23 13:26 ` Jean Delvare
[not found] ` <20080123142634.2cc71cd2-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-24 10:55 ` Kalle Pokki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox