Skip to contentSkip to conversation

scx200_i2c driver fails to detect any i2c devices in 2.6.26

PATCH Applied Lennart Sorensen 2 participants 7 messages Oct 23, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

drivers/i2c/busses/scx200_i2c.c +1 -0
@@ -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",
Signature · 1 line
Len Sorensen
#1 lore raw

Hi Lennart,

Quoted 8 lines · Lennart Sorensen

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.

Quoted 4 lines

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.

Quoted 12 lines
drivers/i2c/busses/scx200_i2c.c +1 -0
@@ -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",
Signature · 1 line
Jean Delvare
#2 lore raw
Quoted 1 line · Jean Delvare

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.

Quoted 3 lines

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?

Signature · 1 line
Len Sorensen
#3 lore raw
In reply to Lennart Sorensen
Quoted 5 lines · Lennart Sorensen

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.

Quoted 9 lines

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.

Quoted 11 lines
drivers/i2c/busses/scx200_i2c.c +1 -0
@@ -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",
Signature · 1 line
Jean Delvare
#4 lore raw
Quoted 1 line · Jean Delvare

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.

Signature · 1 line
Len Sorensen
#5 lore raw

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.

scx200_i2c.c.new renamed from scx200_i2c.c +1 -0
@@ -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",
Signature · 1 line
	Len Sorensen
Applied
#6 lore raw

Re: scx200_i2c driver fails to detect any i2c devices in 2.6.26 (new patch)

Quoted 12 lines · Lennart Sorensen

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.

scx200_i2c.c.new line 87

Quoted 7 lines
scx200_i2c.c.new renamed from scx200_i2c.c +1 -0
@@ -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.

Signature · 1 line
Jean Delvare