linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c-eg20t: use dynamically registered adapter number
@ 2016-08-23  9:05 Yadi Hu
  2016-08-26 15:30 ` Jean Delvare
  0 siblings, 1 reply; 10+ messages in thread
From: Yadi Hu @ 2016-08-23  9:05 UTC (permalink / raw)
  To: yadi.hu, jdelvare, khali, wsa; +Cc: linux-i2c

From: Hu Yadi <Yadi.hu@windriver.com>

The eg20t driver uses i2c_add_numbered_adapter() to register adapter:

    pch_adap->nr = i;
    ret = i2c_add_numbered_adapter(pch_adap);

Variable i is assigned to 0, it means that i2c_eg20t is the first adapter
by default. if another adapter registers before eg20t, above code return
error for index conflict:

    i2c_eg20t 0000:05:0c.2: pch_i2c_probe :i2c_add_adapter[ch:0] FAILED
    i2c_eg20t: probe of 0000:05:0c.2 failed with error -16

So, we can replace i2c_add_numbered_adapter() with i2c_add_adapter()
interface.since it dynamically allocates the index number.

Signed-off-by: Hu Yadi <Yadi.hu@windriver.com>
---
 drivers/i2c/busses/i2c-eg20t.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 7a51ddc..2f4c2af 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -913,8 +913,7 @@ static int __devinit pch_i2c_probe(struct pci_dev *pdev,
 
 		pch_i2c_init(&adap_info->pch_data[i]);
 
-		pch_adap->nr = i;
-		ret = i2c_add_numbered_adapter(pch_adap);
+               ret = i2c_add_adapter(pch_adap);
 		if (ret) {
 			pch_pci_err(pdev, "i2c_add_adapter[ch:%d] FAILED\n", i);
 			goto err_add_adapter;
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] i2c-eg20t: use dynamically registered adapter number
@ 2016-08-23  8:55 Yadi Hu
  0 siblings, 0 replies; 10+ messages in thread
From: Yadi Hu @ 2016-08-23  8:55 UTC (permalink / raw)
  To: yadi.hu, jdelvare, wsa; +Cc: linux-i2c

From: Hu Yadi <Yadi.hu@windriver.com>

The eg20t driver uses i2c_add_numbered_adapter() to register adapter:

    pch_adap->nr = i;
    ret = i2c_add_numbered_adapter(pch_adap);

Variable i is assigned to 0, it means that i2c_eg20t is the first adapter
by default. if another adapter registers before eg20t, above code return
error for index conflict:

    i2c_eg20t 0000:05:0c.2: pch_i2c_probe :i2c_add_adapter[ch:0] FAILED
    i2c_eg20t: probe of 0000:05:0c.2 failed with error -16

So, we can replace i2c_add_numbered_adapter() with i2c_add_adapter()
interface.since it dynamically allocates the index number.

Signed-off-by: Hu Yadi <Yadi.hu@windriver.com>
---
 drivers/i2c/busses/i2c-eg20t.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 7a51ddc..2f4c2af 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -913,8 +913,7 @@ static int __devinit pch_i2c_probe(struct pci_dev *pdev,
 
 		pch_i2c_init(&adap_info->pch_data[i]);
 
-		pch_adap->nr = i;
-		ret = i2c_add_numbered_adapter(pch_adap);
+               ret = i2c_add_adapter(pch_adap);
 		if (ret) {
 			pch_pci_err(pdev, "i2c_add_adapter[ch:%d] FAILED\n", i);
 			goto err_add_adapter;
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-09-20 15:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-23  9:05 [PATCH] i2c-eg20t: use dynamically registered adapter number Yadi Hu
2016-08-26 15:30 ` Jean Delvare
2016-09-02  9:44   ` Yadi
2016-09-17 21:49   ` Wolfram Sang
2016-09-19  3:25     ` Yadi
2016-09-19  6:44       ` Wolfram Sang
2016-09-18 19:22   ` Wolfram Sang
2016-09-19  9:02     ` Jean Delvare
2016-09-20 15:48       ` Jean Delvare
  -- strict thread matches above, loose matches on Subject: below --
2016-08-23  8:55 Yadi Hu

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).