Commit 7e6fb67
power: supply: bq25890: Fix usb-notifier probe and remove races
There are 2 races surrounding the usb-notifier:
1. The notifier, and thus usb_work, may run before the bq->charger
power_supply class device is registered. But usb_work may call
power_supply_changed() which relies on the psy device being registered.
2. usb_work may be pending/running at remove() time, so it needs to be
cancelled on remove after unregistering the usb-notifier.
Fix 1. by moving usb-notifier registration to after the power_supply
registration.
Fix 2. by adding a cancel_work_sync() call directly after the usb-notifier
unregistration.
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>1 parent a7aaa80 commit 7e6fb67
1 file changed
Lines changed: 12 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1391 | 1391 | | |
1392 | 1392 | | |
1393 | 1393 | | |
1394 | | - | |
1395 | | - | |
1396 | | - | |
1397 | | - | |
1398 | | - | |
1399 | | - | |
1400 | 1394 | | |
1401 | | - | |
1402 | | - | |
1403 | | - | |
1404 | | - | |
| 1395 | + | |
| 1396 | + | |
1405 | 1397 | | |
1406 | 1398 | | |
1407 | 1399 | | |
1408 | 1400 | | |
1409 | 1401 | | |
1410 | 1402 | | |
1411 | | - | |
1412 | | - | |
1413 | | - | |
| 1403 | + | |
1414 | 1404 | | |
1415 | | - | |
1416 | | - | |
1417 | | - | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
1418 | 1410 | | |
1419 | | - | |
| 1411 | + | |
1420 | 1412 | | |
1421 | 1413 | | |
1422 | 1414 | | |
1423 | 1415 | | |
1424 | 1416 | | |
1425 | 1417 | | |
1426 | | - | |
| 1418 | + | |
1427 | 1419 | | |
| 1420 | + | |
| 1421 | + | |
1428 | 1422 | | |
1429 | 1423 | | |
1430 | 1424 | | |
| |||
0 commit comments