2008-10-23 16:54:29

by Lennart Sorensen

[permalink] [raw]
Subject: scx200_i2c driver fails to detect any i2c devices in 2.6.26

In 2.6.18, the scx200_i2c driver was working just fine. Now while
moving to 2.6.26 I find that the bus no longer locates any devices when
drivers are loaded, even though i2cdetect has no problem locating
devices on the bus.

After some searching, I discovered that the scx200_i2c driver doesn't
have a .class parameter filled in, even though every other i2c driver
does. A small patch adding the .class parameter fixes the problem.

Not sure if it should be I2C_CLASS_ALL or I2C_CLASS_HWMON, or even
I2C_CLASS_HWMON | I2C_CLASS_SPD (in current git tree). Using
I2C_CLASS_ALL works for me and works with my lm75, m41t81 and spd
eeprom in 2.6.26.

--- a/drivers/i2c/busses/scx200_i2c.c 2008-07-13 17:51:29.000000000 -0400
+++ b/drivers/i2c/busses/scx200_i2c.c 2008-10-23 12:41:02.000000000 -0400
@@ -81,6 +81,7 @@

static struct i2c_adapter scx200_i2c_ops = {
.owner = THIS_MODULE,
+ .class = I2C_CLASS_ALL,
.id = I2C_HW_B_SCX200,
.algo_data = &scx200_i2c_data,
.name = "NatSemi SCx200 I2C",

--
Len Sorensen


2008-10-23 17:21:18

by Jean Delvare

[permalink] [raw]
Subject: Re: scx200_i2c driver fails to detect any i2c devices in 2.6.26

Hi Lennart,

On Thu, 23 Oct 2008 12:54:19 -0400, Lennart Sorensen wrote:
> In 2.6.18, the scx200_i2c driver was working just fine. Now while
> moving to 2.6.26 I find that the bus no longer locates any devices when
> drivers are loaded, even though i2cdetect has no problem locating
> devices on the bus.
>
> After some searching, I discovered that the scx200_i2c driver doesn't
> have a .class parameter filled in, even though every other i2c driver
> does. A small patch adding the .class parameter fixes the problem.

Correct. Not sure how we missed this for years.

> Not sure if it should be I2C_CLASS_ALL or I2C_CLASS_HWMON, or even
> I2C_CLASS_HWMON | I2C_CLASS_SPD (in current git tree). Using
> I2C_CLASS_ALL works for me and works with my lm75, m41t81 and spd
> eeprom in 2.6.26.

I2C_CLASS_HWMON | I2C_CLASS_SPD please. I2C_CLASS_ALL is almost never
what people want, and actually I'm thinking of removing it to prevent
developers from getting it wrong.

>
> --- a/drivers/i2c/busses/scx200_i2c.c 2008-07-13 17:51:29.000000000 -0400
> +++ b/drivers/i2c/busses/scx200_i2c.c 2008-10-23 12:41:02.000000000 -0400
> @@ -81,6 +81,7 @@
>
> static struct i2c_adapter scx200_i2c_ops = {
> .owner = THIS_MODULE,
> + .class = I2C_CLASS_ALL,
> .id = I2C_HW_B_SCX200,
> .algo_data = &scx200_i2c_data,
> .name = "NatSemi SCx200 I2C",
>


--
Jean Delvare

2008-10-23 17:25:22

by Lennart Sorensen

[permalink] [raw]
Subject: Re: scx200_i2c driver fails to detect any i2c devices in 2.6.26

On Thu, Oct 23, 2008 at 07:20:56PM +0200, Jean Delvare wrote:
> Correct. Not sure how we missed this for years.

scx200s are old, and the people using them in boxes don't upgrade
kernels very often. I am only now moving from 2.6.18 to 2.6.26 after
all, and noticed it now.

> I2C_CLASS_HWMON | I2C_CLASS_SPD please. I2C_CLASS_ALL is almost never
> what people want, and actually I'm thinking of removing it to prevent
> developers from getting it wrong.

Should I generate a patch against the latest git tree and submit it, or
will one of you add it to your i2c tree yourself?

--
Len Sorensen

2008-10-23 17:35:36

by Jean Delvare

[permalink] [raw]
Subject: Re: scx200_i2c driver fails to detect any i2c devices in 2.6.26

On Thu, 23 Oct 2008 12:54:19 -0400, Lennart Sorensen wrote:
> In 2.6.18, the scx200_i2c driver was working just fine. Now while
> moving to 2.6.26 I find that the bus no longer locates any devices when
> drivers are loaded, even though i2cdetect has no problem locating
> devices on the bus.
>
> After some searching, I discovered that the scx200_i2c driver doesn't
> have a .class parameter filled in, even though every other i2c driver
> does. A small patch adding the .class parameter fixes the problem.
>
> Not sure if it should be I2C_CLASS_ALL or I2C_CLASS_HWMON, or even
> I2C_CLASS_HWMON | I2C_CLASS_SPD (in current git tree). Using
> I2C_CLASS_ALL works for me and works with my lm75, m41t81 and spd
> eeprom in 2.6.26.
>

Oh, BTW... this patch is missing your Signed-off-by.

> --- a/drivers/i2c/busses/scx200_i2c.c 2008-07-13 17:51:29.000000000 -0400
> +++ b/drivers/i2c/busses/scx200_i2c.c 2008-10-23 12:41:02.000000000 -0400
> @@ -81,6 +81,7 @@
>
> static struct i2c_adapter scx200_i2c_ops = {
> .owner = THIS_MODULE,
> + .class = I2C_CLASS_ALL,
> .id = I2C_HW_B_SCX200,
> .algo_data = &scx200_i2c_data,
> .name = "NatSemi SCx200 I2C",
>


--
Jean Delvare

2008-10-23 17:53:25

by Lennart Sorensen

[permalink] [raw]
Subject: Re: scx200_i2c driver fails to detect any i2c devices in 2.6.26

On Thu, Oct 23, 2008 at 07:35:19PM +0200, Jean Delvare wrote:
> Oh, BTW... this patch is missing your Signed-off-by.

Yeah I know. I didn't think it would be accepted with I2C_CLASS_ALL so
I was expecting to have to make another one. I will send a new one with
a signed off.

--
Len Sorensen

2008-10-23 17:56:08

by Lennart Sorensen

[permalink] [raw]
Subject: Re: scx200_i2c driver fails to detect any i2c devices in 2.6.26 (new patch)

The scx200_i2c driver is missing the .class parameter, which means no
i2c drivers are willing to probe for devices on the bus and attach to
them.

This patch adds the missing .class parameter.

Signed-off-by: Len Sorensen <[email protected]>

--- scx200_i2c.c 2008-05-20 09:39:24.000000000 -0400
+++ scx200_i2c.c.new 2008-10-23 13:51:57.000000000 -0400
@@ -81,6 +81,7 @@

static struct i2c_adapter scx200_i2c_ops = {
.owner = THIS_MODULE,
+ .class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
.id = I2C_HW_B_SCX200,
.algo_data = &scx200_i2c_data,
.name = "NatSemi SCx200 I2C",



--
Len Sorensen

2008-10-23 18:04:17

by Jean Delvare

[permalink] [raw]
Subject: Re: scx200_i2c driver fails to detect any i2c devices in 2.6.26 (new patch)

On Thu, 23 Oct 2008 13:55:52 -0400, Lennart Sorensen wrote:
> The scx200_i2c driver is missing the .class parameter, which means no
> i2c drivers are willing to probe for devices on the bus and attach to
> them.
>
> This patch adds the missing .class parameter.
>
> Signed-off-by: Len Sorensen <[email protected]>
>
> --- scx200_i2c.c 2008-05-20 09:39:24.000000000 -0400
> +++ scx200_i2c.c.new 2008-10-23 13:51:57.000000000 -0400
> @@ -81,6 +81,7 @@
>
> static struct i2c_adapter scx200_i2c_ops = {
> .owner = THIS_MODULE,
> + .class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
> .id = I2C_HW_B_SCX200,
> .algo_data = &scx200_i2c_data,
> .name = "NatSemi SCx200 I2C",
>

Applied, thanks. I'll also take care to get this patch into
2.6.27-stable and 2.6.26-stable.

--
Jean Delvare