* [PATCH] i2c-nomadik: fix regression on adapter name
@ 2010-11-29 9:35 Linus Walleij
[not found] ` <1291023335-6430-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2010-11-29 9:35 UTC (permalink / raw)
To: Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Linus Walleij, Jean Delvare
The Nomadik I2C adapter does not provide a name for the struct
passed into i2c_add_numbered_adapter() causing a regression on
2.6.37-rc3 due to commit 2236baa75f704851d3cd3310569058151acb1f06
adding sanity checks for adapters. Fix this by providing a name
proper.
Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Signed-off-by: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
---
drivers/i2c/busses/i2c-nomadik.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index c9fffd0..f34a276 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -872,6 +872,7 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
adap->owner = THIS_MODULE;
adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
adap->algo = &nmk_i2c_algo;
+ strncpy(adap->name, DRIVER_NAME, sizeof(adap->name));
/* fetch the controller id */
adap->nr = pdev->id;
--
1.7.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c-nomadik: fix regression on adapter name
[not found] ` <1291023335-6430-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
@ 2010-11-29 9:45 ` Jean Delvare
0 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2010-11-29 9:45 UTC (permalink / raw)
To: Linus Walleij; +Cc: Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA
Hi Linus,
On Mon, 29 Nov 2010 10:35:35 +0100, Linus Walleij wrote:
> The Nomadik I2C adapter does not provide a name for the struct
> passed into i2c_add_numbered_adapter() causing a regression on
> 2.6.37-rc3 due to commit 2236baa75f704851d3cd3310569058151acb1f06
> adding sanity checks for adapters. Fix this by providing a name
> proper.
Thanks for the fix, but see below.
> Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Signed-off-by: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
> ---
> drivers/i2c/busses/i2c-nomadik.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
> index c9fffd0..f34a276 100644
> --- a/drivers/i2c/busses/i2c-nomadik.c
> +++ b/drivers/i2c/busses/i2c-nomadik.c
> @@ -872,6 +872,7 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
> adap->owner = THIS_MODULE;
> adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
> adap->algo = &nmk_i2c_algo;
> + strncpy(adap->name, DRIVER_NAME, sizeof(adap->name));
Please use strlcpy. strncpy is broken by design (result isn't
guaranteed to be NUL-terminated.)
Also, DRIVER_NAME ("nmk-i2c") is not a good adapter name. It's cryptic
and not unique if there is more than 1 such adapter on the system. I
would instead suggest something like:
snprintf(adap->name, sizeof(adap->name), "Nomadik I2C at %lx\n",
(unsigned long)res->start);
>
> /* fetch the controller id */
> adap->nr = pdev->id;
--
Jean Delvare
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] i2c-nomadik: fix regression on adapter name
@ 2010-11-30 15:59 Linus Walleij
[not found] ` <1291132769-20775-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2010-11-30 15:59 UTC (permalink / raw)
To: Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Linus Walleij, Jean Delvare
The Nomadik I2C adapter does not provide a name for the struct
passed into i2c_add_numbered_adapter() causing a regression on
2.6.37-rc3 due to commit 2236baa75f704851d3cd3310569058151acb1f06
adding sanity checks for adapters. Fix this by providing a name
proper.
Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Signed-off-by: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
---
Second version - giving an adapter name that provides the instance
number and resource address.
---
drivers/i2c/busses/i2c-nomadik.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index c9fffd0..f7148fd 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -872,6 +872,8 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
adap->owner = THIS_MODULE;
adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
adap->algo = &nmk_i2c_algo;
+ snprintf(adap->name, sizeof(adap->name),
+ "Nomadik I2C%d at %lx", pdev->id, (unsigned long)res->start);
/* fetch the controller id */
adap->nr = pdev->id;
@@ -891,8 +893,8 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
goto err_init_hw;
}
- dev_dbg(&pdev->dev, "initialize I2C%d bus on virtual "
- "base %p\n", pdev->id, dev->virtbase);
+ dev_info(&pdev->dev, "initialize %s on virtual "
+ "base %p\n", adap->name, dev->virtbase);
ret = i2c_add_numbered_adapter(adap);
if (ret) {
--
1.7.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c-nomadik: fix regression on adapter name
[not found] ` <1291132769-20775-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
@ 2010-11-30 16:03 ` Jean Delvare
0 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2010-11-30 16:03 UTC (permalink / raw)
To: Linus Walleij; +Cc: Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA
On Tue, 30 Nov 2010 16:59:29 +0100, Linus Walleij wrote:
> The Nomadik I2C adapter does not provide a name for the struct
> passed into i2c_add_numbered_adapter() causing a regression on
> 2.6.37-rc3 due to commit 2236baa75f704851d3cd3310569058151acb1f06
> adding sanity checks for adapters. Fix this by providing a name
> proper.
>
> Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Reviewed-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Ben, please apply.
> Signed-off-by: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
> ---
> Second version - giving an adapter name that provides the instance
> number and resource address.
> ---
> drivers/i2c/busses/i2c-nomadik.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
> index c9fffd0..f7148fd 100644
> --- a/drivers/i2c/busses/i2c-nomadik.c
> +++ b/drivers/i2c/busses/i2c-nomadik.c
> @@ -872,6 +872,8 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
> adap->owner = THIS_MODULE;
> adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
> adap->algo = &nmk_i2c_algo;
> + snprintf(adap->name, sizeof(adap->name),
> + "Nomadik I2C%d at %lx", pdev->id, (unsigned long)res->start);
>
> /* fetch the controller id */
> adap->nr = pdev->id;
> @@ -891,8 +893,8 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
> goto err_init_hw;
> }
>
> - dev_dbg(&pdev->dev, "initialize I2C%d bus on virtual "
> - "base %p\n", pdev->id, dev->virtbase);
> + dev_info(&pdev->dev, "initialize %s on virtual "
> + "base %p\n", adap->name, dev->virtbase);
>
> ret = i2c_add_numbered_adapter(adap);
> if (ret) {
--
Jean Delvare
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-30 16:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-30 15:59 [PATCH] i2c-nomadik: fix regression on adapter name Linus Walleij
[not found] ` <1291132769-20775-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2010-11-30 16:03 ` Jean Delvare
-- strict thread matches above, loose matches on Subject: below --
2010-11-29 9:35 Linus Walleij
[not found] ` <1291023335-6430-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2010-11-29 9:45 ` Jean Delvare
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).