Skip to contentSkip to conversation

i2c: announce SMBus host controllers

PATCH Jean Delvare 2 participants 5 messages Dec 22, 2007 – Jan 4, 2008 4 messages not in the archive I2C subsystem host drivers

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive

Hi Bjorn,

Quoted 7 lines · Bjorn Helgaas

Would you consider adding a patch like this to your i2c tree? Unfortunately, I don't think I have hardware for any of these devices, so all I have done is compiled this.
(...)
i2c: announce SMBus host controllers

Note where we find SMBus host controllers and what resources they use.

I like the idea. The information printed is somewhat redundant with /proc/ioports but sometimes it's useful to see the information in dmesg directly, and having a common string to grep for should be convenient as well. Just a couple comments:

* i2c-i810, i2c-prosavage, i2c-savage4 and i2c-voodoo3 are NOT SMBus host controller drivers. They do I2C/DDC over GPIO for graphics adapters. I don't think that you really need to know about the resources they use, they are not candidates for conflicts with ACPI / BIOS / whatever. And 3 out of 4 are deprecated, so all in all they are probably just not worth modifying.

* I think that you should make sure that the device has been successfully registered before you print the message, otherwise it might be confusing. I only looked at i2c-pasemi and scx200_acb and for both drivers you print the message at a point where a failure could still happen. Please double-check for all drivers, adjust as needed and resubmit.

I can test the i2c-i801 driver now and i2c-viapro and i2c-piix4 later.

--
Jean Delvare

#4 lore raw
In reply to a message not in the archive
Quoted 23 lines · Jean Delvare

Hi Bjorn,

Quoted 7 lines · Bjorn Helgaas

Would you consider adding a patch like this to your i2c tree? Unfortunately, I don't think I have hardware for any of these devices, so all I have done is compiled this.
(...)
i2c: announce SMBus host controllers

Note where we find SMBus host controllers and what resources they use.

I like the idea. The information printed is somewhat redundant with /proc/ioports but sometimes it's useful to see the information in dmesg directly, and having a common string to grep for should be convenient as well. Just a couple comments:

* i2c-i810, i2c-prosavage, i2c-savage4 and i2c-voodoo3 are NOT SMBus host controller drivers. They do I2C/DDC over GPIO for graphics adapters. I don't think that you really need to know about the resources they use, they are not candidates for conflicts with ACPI / BIOS / whatever. And 3 out of 4 are deprecated, so all in all they are probably just not worth modifying.

Quoted 8 lines

* I think that you should make sure that the device has been successfully registered before you print the message, otherwise it might be confusing. I only looked at i2c-pasemi and scx200_acb and for both drivers you print the message at a point where a failure could still happen. Please double-check for all drivers, adjust as needed and resubmit.

I can test the i2c-i801 driver now and i2c-viapro and i2c-piix4 later.

Thanks for the comments! My work machine is powered off for the holidays, so I'll rework the patch after the new year.

Bjorn

#5 lore raw
In reply to a message not in the archive
Quoted 8 lines · Jean Delvare
Quoted 7 lines · Bjorn Helgaas

Would you consider adding a patch like this to your i2c tree? Unfortunately, I don't think I have hardware for any of these devices, so all I have done is compiled this.
(...)
i2c: announce SMBus host controllers

Note where we find SMBus host controllers and what resources they use.

Quoted 8 lines

...

* i2c-i810, i2c-prosavage, i2c-savage4 and i2c-voodoo3 are NOT SMBus host controller drivers. They do I2C/DDC over GPIO for graphics adapters. I don't think that you really need to know about the resources they use, they are not candidates for conflicts with ACPI / BIOS / whatever. And 3 out of 4 are deprecated, so all in all they are probably just not worth modifying.

I removed the patches for these drivers.

Quoted 6 lines

* I think that you should make sure that the device has been successfully registered before you print the message, otherwise it might be confusing. I only looked at i2c-pasemi and scx200_acb and for both drivers you print the message at a point where a failure could still happen. Please double-check for all drivers, adjust as needed and resubmit.

Take a look at i2c-ali1535.c. I put the new printk in ali1535_setup(), which does PCI initialization, even though a failure could happen later in i2c_add_adapter().

I picked that because putting the new printk in ali1535_probe() would mean:
- the printk would be far removed from the request_region(), so it's a little harder to be sure the "ali1535_smba + ALI1535_SMB_IOSIZE - 1" expression matches,
- I wouldn't be able print the SMBREV value, and
- I'd have to add a temporary to check the return from i2c_add_adapter() instead of just returning it directly,

I'd still be glad to change them if you prefer. I just want to do them all the same (either all before or all after i2c_add_adapter()). Let me know your preference.

Bjorn

#7 lore raw
In reply to a message not in the archive

Hi Bjorn,

Quoted 21 lines · Bjorn Helgaas
Quoted 6 lines · Jean Delvare

* I think that you should make sure that the device has been successfully registered before you print the message, otherwise it might be confusing. I only looked at i2c-pasemi and scx200_acb and for both drivers you print the message at a point where a failure could still happen. Please double-check for all drivers, adjust as needed and resubmit.

Take a look at i2c-ali1535.c. I put the new printk in ali1535_setup(), which does PCI initialization, even though a failure could happen later in i2c_add_adapter().

I picked that because putting the new printk in ali1535_probe() would mean:
- the printk would be far removed from the request_region(), so it's a little harder to be sure the "ali1535_smba + ALI1535_SMB_IOSIZE - 1" expression matches,
- I wouldn't be able print the SMBREV value, and
- I'd have to add a temporary to check the return from i2c_add_adapter() instead of just returning it directly,

Quoted 3 lines

I'd still be glad to change them if you prefer. I just want to do them all the same (either all before or all after i2c_add_adapter()). Let me know your preference.

If moving the message makes the code mode complex, then I agree that you shouldn't do that. After all, i2c_add_adapter() is very unlikely to fail, and if it does, I certainly hope that it'll clearly show in the kernel log so that no confusion is possible.

So just do what you think is best and I'll take that.

Thanks,

Signature · 1 line
Jean Delvare
#8 lore raw
In reply to a message not in the archive

Oh BTW your patch yields the following warning on x86_64:

drivers/i2c/busses/i2c-i801.c: In function "i801_probe":
drivers/i2c/busses/i2c-i801.c:669: warning: format "%lx" expects type "long unsigned int", but argument 5 has type "long long unsigned int"

Please fix in the next iteration of your patch.

Signature · 1 line
Jean Delvare