Commit 3ec6002
power: supply: sbs-charger: Support multiple devices
If we have 2 instances of sbs-charger in the DTS, the driver probe for the second instance will fail:
[ 8.012874] sbs-battery 18-000b: sbs-battery: battery gas gauge device registered
[ 8.039094] sbs-charger 18-0009: ltc4100: smart charger device registered
[ 8.112911] sbs-battery 20-000b: sbs-battery: battery gas gauge device registered
[ 8.134533] sysfs: cannot create duplicate filename '/class/power_supply/sbs-charger'
[ 8.143871] CPU: 3 PID: 295 Comm: systemd-udevd Tainted: G O 5.10.147 #22
[ 8.151974] Hardware name: ALE AMB (DT)
[ 8.155828] Call trace:
[ 8.158292] dump_backtrace+0x0/0x1d4
[ 8.161960] show_stack+0x18/0x6c
[ 8.165280] dump_stack+0xcc/0x128
[ 8.168687] sysfs_warn_dup+0x60/0x7c
[ 8.172353] sysfs_do_create_link_sd+0xf0/0x100
[ 8.176886] sysfs_create_link+0x20/0x40
[ 8.180816] device_add+0x270/0x7a4
[ 8.184311] __power_supply_register+0x304/0x560
[ 8.188930] devm_power_supply_register+0x54/0xa0
[ 8.193644] sbs_probe+0xc0/0x214 [sbs_charger]
[ 8.198183] i2c_device_probe+0x2dc/0x2f4
[ 8.202196] really_probe+0xf0/0x510
[ 8.205774] driver_probe_device+0xfc/0x160
[ 8.209960] device_driver_attach+0xc0/0xcc
[ 8.214146] __driver_attach+0xc0/0x170
[ 8.218002] bus_for_each_dev+0x74/0xd4
[ 8.221862] driver_attach+0x24/0x30
[ 8.225444] bus_add_driver+0x148/0x250
[ 8.229283] driver_register+0x78/0x130
[ 8.233140] i2c_register_driver+0x4c/0xe0
[ 8.237250] sbs_driver_init+0x20/0x1000 [sbs_charger]
[ 8.242424] do_one_initcall+0x50/0x1b0
[ 8.242434] do_init_module+0x44/0x230
[ 8.242438] load_module+0x2200/0x27c0
[ 8.242442] __do_sys_finit_module+0xa8/0x11c
[ 8.242447] __arm64_sys_finit_module+0x20/0x30
[ 8.242457] el0_svc_common.constprop.0+0x64/0x154
[ 8.242464] do_el0_svc+0x24/0x8c
[ 8.242474] el0_svc+0x10/0x20
[ 8.242481] el0_sync_handler+0x108/0x114
[ 8.242485] el0_sync+0x180/0x1c0
[ 8.243847] sbs-charger 20-0009: Failed to register power supply
[ 8.287934] sbs-charger: probe of 20-0009 failed with error -17
This is mainly because the "name" field of power_supply_desc is a constant.
This patch fixes the issue by reusing the same approach as sbs-battery.
With this patch, the result is:
[ 7.819532] sbs-charger 18-0009: ltc4100: smart charger device registered
[ 7.825305] sbs-battery 18-000b: sbs-battery: battery gas gauge device registered
[ 7.887423] sbs-battery 20-000b: sbs-battery: battery gas gauge device registered
[ 7.893501] sbs-charger 20-0009: ltc4100: smart charger device registered
Signed-off-by: Fabien Proriol <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>1 parent def5612 commit 3ec6002
1 file changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
158 | | - | |
| 157 | + | |
159 | 158 | | |
160 | 159 | | |
161 | 160 | | |
| |||
165 | 164 | | |
166 | 165 | | |
167 | 166 | | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
171 | 181 | | |
172 | 182 | | |
173 | 183 | | |
| |||
191 | 201 | | |
192 | 202 | | |
193 | 203 | | |
194 | | - | |
| 204 | + | |
195 | 205 | | |
196 | 206 | | |
197 | 207 | | |
| |||
0 commit comments