* [PATCH v2] i2c: i2c-gpio: fix name issue when i2c gpio node GT 1
@ 2012-10-15 7:51 Bo Shen
[not found] ` <1350287477-30936-1-git-send-email-voice.shen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Bo Shen @ 2012-10-15 7:51 UTC (permalink / raw)
To: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
Cc: khali-PUYAD+kWke1g9hUCZPvPmw, swarren-3lzwWm7+Weoh9ZMKESR00Q,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
plagnioj-sclMFOaUSTBWk0Htik3J/w,
nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w, Bo Shen
When i2c-gpio node number is greater than 1, the name for each is same
So add the patch to fix it.
The adap->name printing information is add by myself
without this patch the log information is as following
---<8---
adap->name = i2c-gpio-1
i2c-gpio i2c.2: using pins 30 (SDA) and 31 (SCL)
adap->name = i2c-gpio-1
i2c-gpio i2c.3: using pins 64 (SDA) and 65 (SCL)
--->8---
with this patch, the log information is as following
---<8---
adap->name = i2c.2
i2c-gpio i2c.2: using pins 30 (SDA) and 31 (SCL)
adap->name = i2c.3
i2c-gpio i2c.3: using pins 64 (SDA) and 65 (SCL)
--->8---
Signed-off-by: Bo Shen <voice.shen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
drivers/i2c/busses/i2c-gpio.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index e62d2d9..257299a 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -184,7 +184,11 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
bit_data->data = pdata;
adap->owner = THIS_MODULE;
- snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
+ if (pdev->dev.of_node)
+ strlcpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name));
+ else
+ snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
+
adap->algo_data = bit_data;
adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
adap->dev.parent = &pdev->dev;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] i2c: i2c-gpio: fix name issue when i2c gpio node GT 1
[not found] ` <1350287477-30936-1-git-send-email-voice.shen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
@ 2012-10-15 16:03 ` Stephen Warren
2012-11-14 8:59 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2012-10-15 16:03 UTC (permalink / raw)
To: Bo Shen
Cc: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
plagnioj-sclMFOaUSTBWk0Htik3J/w,
nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w
On 10/15/2012 01:51 AM, Bo Shen wrote:
> When i2c-gpio node number is greater than 1, the name for each is same
> So add the patch to fix it.
>
> The adap->name printing information is add by myself
>
> without this patch the log information is as following
> ---<8---
> adap->name = i2c-gpio-1
> i2c-gpio i2c.2: using pins 30 (SDA) and 31 (SCL)
> adap->name = i2c-gpio-1
> i2c-gpio i2c.3: using pins 64 (SDA) and 65 (SCL)
> --->8---
>
> with this patch, the log information is as following
> ---<8---
> adap->name = i2c.2
> i2c-gpio i2c.2: using pins 30 (SDA) and 31 (SCL)
> adap->name = i2c.3
> i2c-gpio i2c.3: using pins 64 (SDA) and 65 (SCL)
> --->8---
I think this is reasonable, although I imagine this has zero effect on
the I2C bus number that's assigned to the device, so I'm not sure how it
interacts with or supports the other Atmel patch series you sent, which
I didn't really look at in much detail.
Reviewed-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] i2c: i2c-gpio: fix name issue when i2c gpio node GT 1
[not found] ` <1350287477-30936-1-git-send-email-voice.shen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-10-15 16:03 ` Stephen Warren
@ 2012-11-14 8:59 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2012-11-14 8:59 UTC (permalink / raw)
To: Bo Shen
Cc: khali-PUYAD+kWke1g9hUCZPvPmw, swarren-3lzwWm7+Weoh9ZMKESR00Q,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
plagnioj-sclMFOaUSTBWk0Htik3J/w,
nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w
[-- Attachment #1: Type: text/plain, Size: 973 bytes --]
On Mon, Oct 15, 2012 at 03:51:17PM +0800, Bo Shen wrote:
> When i2c-gpio node number is greater than 1, the name for each is same
> So add the patch to fix it.
>
> The adap->name printing information is add by myself
>
> without this patch the log information is as following
> ---<8---
> adap->name = i2c-gpio-1
> i2c-gpio i2c.2: using pins 30 (SDA) and 31 (SCL)
> adap->name = i2c-gpio-1
> i2c-gpio i2c.3: using pins 64 (SDA) and 65 (SCL)
> --->8---
>
> with this patch, the log information is as following
> ---<8---
> adap->name = i2c.2
> i2c-gpio i2c.2: using pins 30 (SDA) and 31 (SCL)
> adap->name = i2c.3
> i2c-gpio i2c.3: using pins 64 (SDA) and 65 (SCL)
> --->8---
>
> Signed-off-by: Bo Shen <voice.shen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Applied to for-next, thanks.
--
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] 3+ messages in thread
end of thread, other threads:[~2012-11-14 8:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-15 7:51 [PATCH v2] i2c: i2c-gpio: fix name issue when i2c gpio node GT 1 Bo Shen
[not found] ` <1350287477-30936-1-git-send-email-voice.shen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-10-15 16:03 ` Stephen Warren
2012-11-14 8:59 ` 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).