devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bo Shen <voice.shen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH] i2c: i2c-gpio: fix issue when DT node greater than 1
Date: Wed, 19 Sep 2012 09:15:08 +0800	[thread overview]
Message-ID: <50591C9C.2080809@atmel.com> (raw)
In-Reply-To: <50588A8F.30203-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>

Hi Stephen Warren,

On 9/18/2012 22:51, Stephen Warren wrote:
> On 09/18/2012 03:02 AM, Bo Shen wrote:
>> When i2c-gpio node number is greater than 1, the second can not sucessfully
>> regiter
>>
>> Using alias method to get the pdev->id, or else the second device will use
>> the same id which will cause fail to register
>
> pdev->id shouldn't be used at all with device tree. Why does
> registration fail without this change?

I add the debug info, and it give the following error without this patch.

--<8----------------------------------
adap->name = i2c-gpio-1
i2c-gpio i2c.2: using pins 30 (SDA) and 31 (SCL)
adap->name = i2c-gpio-1
i2c-gpio: probe of i2c.3 failed with error -16
-->8----------------------------------

With this patch, it successfully registered.
--<8----------------------------------
adap->name = i2c-gpio0
i2c-gpio i2c.2: using pins 30 (SDA) and 31 (SCL)
adap->name = i2c-gpio1
i2c-gpio i2c.3: using pins 90 (SDA) and 91 (SCL)
-->8----------------------------------

>
>> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
>> index e62d2d9..051fbb3 100644
>> --- a/drivers/i2c/busses/i2c-gpio.c
>> +++ b/drivers/i2c/busses/i2c-gpio.c
>> @@ -136,6 +136,7 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
>>   		ret = of_i2c_gpio_probe(pdev->dev.of_node, pdata);
>>   		if (ret)
>>   			return ret;
>> +		pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c-gpio");
>>   	} else {
>>   		if (!pdev->dev.platform_data)
>>   			return -ENXIO;
>>
>
>

  parent reply	other threads:[~2012-09-19  1:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18  9:02 [PATCH] i2c: i2c-gpio: fix issue when DT node greater than 1 Bo Shen
     [not found] ` <1347958949-5598-1-git-send-email-voice.shen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-09-18 14:51   ` Stephen Warren
     [not found]     ` <50588A8F.30203-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-09-19  1:15       ` Bo Shen [this message]
     [not found]         ` <50591C9C.2080809-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-09-19 15:28           ` Stephen Warren
     [not found]             ` <5059E484.6090708-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-09-19 15:54               ` Jean Delvare
     [not found]                 ` <20120919175433.3841a954-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-10-10  2:54                   ` Bo Shen
     [not found]                     ` <5074E349.30605-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-10-15  2:59                       ` Bo Shen
     [not found]                         ` <507B7C07.3070702-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-10-15  5:55                           ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-15  6:49                           ` Jean Delvare
     [not found]                             ` <20121015084920.75d4aa53-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-10-15  7:32                               ` Bo Shen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50591C9C.2080809@atmel.com \
    --to=voice.shen-aife0yeh4naavxtiumwx3w@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org \
    --cc=plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).