Bug 11239

Summary: w83793 -> kobject_add_internal failed for 0-004b with -EEXIST
Product: Drivers Reporter: Ed Martin (edman007)
Component: I2CAssignee: Jean Delvare (jdelvare)
Status: RESOLVED CODE_FIX    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.26.1 Subsystem:
Regression: --- Bisected commit-id:
Attachments: i2c: Check for address business before creating clients

Description Ed Martin 2008-08-03 00:52:41 UTC
Latest working kernel version:2.6.24.5 did not appear to have this
Earliest failing kernel version:2.6.26.1 is the one where i'm seeing this
Distribution: Slamd64
Hardware Environment: Tyan i5400PW w/ 8GB RAM
Software Environment: 64-bit kernel
Problem Description:
On boot i get this (from dmesg)

----SNIP---
usbcore: registered new interface driver i2c-tiny-usb
w83627hf: Found W83627HF chip at 0x290
w83627hf w83627hf.656: Enabling temp2, readings might not make sense
w83627hf w83627hf.656: Enabling temp3, readings might not make sense
kobject_add_internal failed for 0-004b with -EEXIST, don't try to register things with the same name in the same directory.
Pid: 1, comm: swapper Not tainted 2.6.26.1 #2

Call Trace:
 [<ffffffff8053f513>] kobject_add_internal+0x173/0x1c0
 [<ffffffff8053fa64>] kobject_add+0x54/0x80
 [<ffffffff80911a79>] klist_node_init+0x39/0x70
 [<ffffffff8053f322>] kobject_get+0x12/0x20
 [<ffffffff805c9287>] get_device+0x17/0x30
 [<ffffffff805c99fa>] device_add+0xba/0x5d0
 [<ffffffff8053f0c3>] kobject_init+0x33/0x90
 [<ffffffff8073ce54>] i2c_attach_client+0x94/0x170
 [<ffffffff8075072c>] w83793_create_subclient+0x8c/0xf0
 [<ffffffff80750d16>] w83793_detect+0x586/0x930
 [<ffffffff80750790>] w83793_detect+0x0/0x930
 [<ffffffff8073cc0c>] i2c_probe_address+0x4c/0x130
 [<ffffffff8073da93>] i2c_probe+0x203/0x230
 [<ffffffff80750790>] w83793_detect+0x0/0x930
 [<ffffffff8073d1c8>] i2c_register_driver+0xb8/0x120
 [<ffffffff80da1390>] sensors_w83793_init+0x0/0x10
 [<ffffffff80d78a23>] kernel_init+0x133/0x300
 [<ffffffff802260e8>] child_rip+0xa/0x12
 [<ffffffff80d788f0>] kernel_init+0x0/0x300
 [<ffffffff802260de>] child_rip+0x0/0x12

i2c-adapter i2c-0: Failed to attach i2c client w83793 subclient at 0x4b (-17)
w83793 0-002f: subclient registration at address 0x4b failed
i2c-adapter i2c-0: Client creation failed at 0x2f (-17)
i2c-adapter i2c-0: Client creation failed at 0x2d (-22)
i2c-adapter i2c-0: detect fail: unknown manuf, 0x00
i2c-adapter i2c-0: detect fail: address match, 0x2f
---SNIP---

I don't notice anything not working...but then again i'm not really sure if i can see whatever sensors that is suppose to provide

Steps to reproduce:
boot my computer, i get this before init starts
Comment 1 Jean Delvare 2008-08-07 08:37:16 UTC
Please provide a dump of your W83793 chip:

modprobe i2c-dev
i2cdump 0 0x2f b

Did you pass any parameter when loading module w83793?

Please also provide a scan of the SMBus:

modprobe i2c-dev
i2cdetect 0

And a list of registered i2c clients:

grep . /sys/bus/i2c/devices/*/name
Comment 2 Ed Martin 2008-08-07 18:46:25 UTC
root@octal:~$ i2cdump 0 0x2f b
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c/0, address 0x2f, mode byte
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 00 00 00 03 04 03 14 64 64 5e 73 a3 7b 12    .....????dd^s?{?
10: 8d 8d 88 ff 60 72 00 00 c9 cb 00 34 0b 09 00 00    ???.`r..??.4??..
20: 2a 2b 00 0f ff 0f ff 0f ff 01 ab 01 b4 0f ff 03    *+.?.?.?.?????.?
30: 3f 03 44 0f ff 0f ff 0f ff 0f ff ff ff ff ff ff    ??D?.?.?.?......
40: 01 00 00 9c 3c 00 f7 ff ff 7f 3f 00 00 9c 3c 00    ?..?<.?..??..?<.
50: 00 00 00 00 00 00 00 00 28 01 00 00 7f 00 ff 03    ........(?..?..?
60: ff 00 ff 00 ff 00 ff ff 3f 00 ff 00 ff 00 ff 00    ........?.......
70: ff 00 ff 00 ff 00 ff 00 64 5f 55 50 64 5f 55 50    ........d_UPd_UP
80: 64 5f 55 50 64 5f 55 50 64 5f 55 50 64 5f 55 50    d_UPd_UPd_UPd_UP
90: 06 97 06 97 06 97 06 97 06 97 06 97 06 97 06 97    ????????????????
a0: 06 97 06 97 06 97 06 97 00 00 00 00 00 00 ff ff    ????????........
b0: 00 00 30 1e 1e 1e 1e 1e 1e 1e 1e 89 89 89 89 89    ..0?????????????
c0: 89 89 89 06 06 7f ff 00 00 ff ff ff ff ff ff ff    ??????..........
d0: f0 40 40 40 40 10 c0 ff f2 c0 f2 40 80 01 80 01    ?@@@@??.???@????
e0: bb c0 82 ff 80 06 11 ff ff ff aa 4a ff ff ff ff    ???.???...?J....
f0: 00 00 00 00 00 00 60 80 1b 00 ff 00 00 10 00 00    ......`??....?..







root@octal:~$ i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c/0.
I will probe address range 0x03-0x77.
Continue? [Y/n] 
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- 2d -- 2f 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- UU UU -- UU -- -- -- UU 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: 60 61 62 -- -- -- -- -- -- 69 -- -- -- -- -- 6f 
70: -- -- -- -- 74 75 -- --    







root@octal:~$ grep . /sys/bus/i2c/devices/*/name
/sys/bus/i2c/devices/0-0048/name:pcf8591
/sys/bus/i2c/devices/0-0049/name:pcf8591
/sys/bus/i2c/devices/0-004b/name:pcf8591
/sys/bus/i2c/devices/0-004f/name:pcf8591
Comment 3 Jean Delvare 2008-08-07 23:51:17 UTC
OK, apparently you have the pcf8591 driver loaded and it picked the W83793's subclient addresses, so the w83793 driver can't access them.

The workaround is to load the w83793 driver first:
rmmod pcf8591
modprobe w83793
modprobe pcf8591

Please give it a try and confirm that it solves your problem.

Still, loading the drivers in the wrong order shouldn't cause the error messages you got. I'll try to reproduce the problem.
Comment 4 Jean Delvare 2008-08-07 23:56:47 UTC
Actually you have to unload the w83793 driver as well, so that would be:
rmmod pcf8591 w83793
modprobe w83793
modprobe pcf8591

Alternatively, you can prevent the pcf8591 driver from picking the wrong address by using the following option:

modprobe pcf8591 ignore=0,0x4b,0,0x4f

If you do that, then the drivers can be loaded in any order.
Comment 5 Jean Delvare 2008-08-08 01:42:44 UTC
Created attachment 17141 [details]
i2c: Check for address business before creating clients
Comment 6 Jean Delvare 2008-08-12 01:53:36 UTC
Patch committed, fix will be in 2.6.27-rc3:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c1159f9e8927f5732c19816a605926bc76c498b2
Comment 7 Ed Martin 2008-09-19 20:27:15 UTC
Just verified this in 2.6.27-rc6, i don't see any problems anymore, its fixed