* [PATCH v2 0/2] i2c: Don't assume bus nr 0 if none was specified
@ 2012-03-27 9:10 Karol Lewandowski
[not found] ` <1332839428-29705-1-git-send-email-k.lewandowsk-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Karol Lewandowski @ 2012-03-27 9:10 UTC (permalink / raw)
To: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
Cc: ben-linux-elnMNo+KYs3YtjvyW6yDsg,
m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ,
hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w,
bigeasy-hfZtesqFncYOwBW4kG4KsQ,
dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w,
linux-lFZ/pmaqli7XmaaqVzeoHQ, Karol Lewandowski
Changes since v1:
- Dropped reduntant i2c-octeon change
i2c controller drivers used to assume bus number 0 when none (-1) was
specified.
This worked on non-device tree systems, where one could explicitly
specify bus number via platform data. On DT-enabled systems bus
number is always -1.
This patchset reworks few remaining drivers to use dynamic bus
allocation when no id has been provided.
[ I've found out this when I've tried to instantiate more than one
i2c-gpio instance on DT-enabled system. I've, hopefully, fixed few
other drivers too. ]
Karol Lewandowski (2):
i2c-pxa: Drop leftover comment
i2c: Dynamically assign adapter id if it wasn't explictly specified
drivers/i2c/busses/i2c-gpio.c | 7 +------
drivers/i2c/busses/i2c-pca-platform.c | 2 +-
drivers/i2c/busses/i2c-pxa.c | 5 -----
drivers/i2c/busses/i2c-versatile.c | 9 ++-------
4 files changed, 4 insertions(+), 19 deletions(-)
--
1.7.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <1332839428-29705-1-git-send-email-k.lewandowsk-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>]
* [PATCH 1/2] i2c-pxa: Drop leftover comment
[not found] ` <1332839428-29705-1-git-send-email-k.lewandowsk-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2012-03-27 9:10 ` Karol Lewandowski
0 siblings, 0 replies; 4+ messages in thread
From: Karol Lewandowski @ 2012-03-27 9:10 UTC (permalink / raw)
To: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
Cc: ben-linux-elnMNo+KYs3YtjvyW6yDsg,
m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ,
hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w,
bigeasy-hfZtesqFncYOwBW4kG4KsQ,
dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w,
linux-lFZ/pmaqli7XmaaqVzeoHQ, Karol Lewandowski
Commit 488bf314b ("i2c: Allow i2c_add_numbered_adapter() to assign a
bus id") reworked i2c-pxa driver leaving obsolete comment.
This commit simply drops it.
Signed-off-by: Karol Lewandowski <k.lewandowsk-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Kyungmin Park <kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
drivers/i2c/busses/i2c-pxa.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index d603646..b81fd10 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1074,11 +1074,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
spin_lock_init(&i2c->lock);
init_waitqueue_head(&i2c->wait);
- /*
- * 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.
- */
i2c->adap.nr = dev->id;
snprintf(i2c->adap.name, sizeof(i2c->adap.name), "pxa_i2c-i2c.%u",
i2c->adap.nr);
--
1.7.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] i2c: Dynamically assign adapter id if it wasn't explictly specified
2012-03-27 9:10 [PATCH v2 0/2] i2c: Don't assume bus nr 0 if none was specified Karol Lewandowski
[not found] ` <1332839428-29705-1-git-send-email-k.lewandowsk-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2012-03-27 9:10 ` Karol Lewandowski
2012-04-18 10:55 ` [PATCH v2 0/2] i2c: Don't assume bus nr 0 if none was specified Wolfram Sang
2 siblings, 0 replies; 4+ messages in thread
From: Karol Lewandowski @ 2012-03-27 9:10 UTC (permalink / raw)
To: w.sang
Cc: ben-linux, m.szyprowski, linux-kernel, linux-i2c, kyungmin.park,
hskinnemoen, bigeasy, dirk.brandewie, linux, Karol Lewandowski
Commit 488bf314b ("i2c: Allow i2c_add_numbered_adapter() to assign a
bus id") reworked i2c_add_numbered_adapter() to call i2c_add_adapter()
if requested bus was -1.
This allows to simplify driver's initialization procedure by using
just one function for static and dynamic adapter id registration.
This patch updates few more drivers (missed out in original patch)
to use this functionality.
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/i2c/busses/i2c-gpio.c | 7 +------
drivers/i2c/busses/i2c-pca-platform.c | 2 +-
drivers/i2c/busses/i2c-versatile.c | 9 ++-------
3 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index a651779..50a2a94 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -144,12 +144,7 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
adap->dev.parent = &pdev->dev;
- /*
- * 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.
- */
- adap->nr = (pdev->id != -1) ? pdev->id : 0;
+ adap->nr = pdev->id;
ret = i2c_bit_add_numbered_bus(adap);
if (ret)
goto err_add_bus;
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index 2adbf1a..675878f 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -171,7 +171,7 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev)
i2c->io_size = resource_size(res);
i2c->irq = irq;
- i2c->adap.nr = pdev->id >= 0 ? pdev->id : 0;
+ i2c->adap.nr = pdev->id;
i2c->adap.owner = THIS_MODULE;
snprintf(i2c->adap.name, sizeof(i2c->adap.name),
"PCA9564/PCA9665 at 0x%08lx",
diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
index 6055601..9458568 100644
--- a/drivers/i2c/busses/i2c-versatile.c
+++ b/drivers/i2c/busses/i2c-versatile.c
@@ -102,13 +102,8 @@ static int i2c_versatile_probe(struct platform_device *dev)
i2c->algo = i2c_versatile_algo;
i2c->algo.data = i2c;
- if (dev->id >= 0) {
- /* static bus numbering */
- i2c->adap.nr = dev->id;
- ret = i2c_bit_add_numbered_bus(&i2c->adap);
- } else
- /* dynamic bus numbering */
- ret = i2c_bit_add_bus(&i2c->adap);
+ i2c->adap.nr = dev->id;
+ ret = i2c_bit_add_numbered_bus(&i2c->adap);
if (ret >= 0) {
platform_set_drvdata(dev, i2c);
return 0;
--
1.7.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] i2c: Don't assume bus nr 0 if none was specified
2012-03-27 9:10 [PATCH v2 0/2] i2c: Don't assume bus nr 0 if none was specified Karol Lewandowski
[not found] ` <1332839428-29705-1-git-send-email-k.lewandowsk-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2012-03-27 9:10 ` [PATCH 2/2] i2c: Dynamically assign adapter id if it wasn't explictly specified Karol Lewandowski
@ 2012-04-18 10:55 ` Wolfram Sang
2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2012-04-18 10:55 UTC (permalink / raw)
To: Karol Lewandowski
Cc: ben-linux, m.szyprowski, linux-kernel, linux-i2c, kyungmin.park,
hskinnemoen, bigeasy, dirk.brandewie, linux
[-- Attachment #1: Type: text/plain, Size: 686 bytes --]
On Tue, Mar 27, 2012 at 11:10:26AM +0200, Karol Lewandowski wrote:
> Changes since v1:
> - Dropped reduntant i2c-octeon change
>
> i2c controller drivers used to assume bus number 0 when none (-1) was
> specified.
>
> This worked on non-device tree systems, where one could explicitly
> specify bus number via platform data. On DT-enabled systems bus
> number is always -1.
>
> This patchset reworks few remaining drivers to use dynamic bus
> allocation when no id has been provided.
Thanks, both applied.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-18 10:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-27 9:10 [PATCH v2 0/2] i2c: Don't assume bus nr 0 if none was specified Karol Lewandowski
[not found] ` <1332839428-29705-1-git-send-email-k.lewandowsk-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2012-03-27 9:10 ` [PATCH 1/2] i2c-pxa: Drop leftover comment Karol Lewandowski
2012-03-27 9:10 ` [PATCH 2/2] i2c: Dynamically assign adapter id if it wasn't explictly specified Karol Lewandowski
2012-04-18 10:55 ` [PATCH v2 0/2] i2c: Don't assume bus nr 0 if none was specified Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).