]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
power: supply: core: use device mutex wrappers
authorThomas Weißschuh <linux@weissschuh.net>
Sat, 5 Oct 2024 10:06:15 +0000 (12:06 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 16 Oct 2024 21:13:38 +0000 (23:13 +0200)
The mutex is an implementation detail of struct device.
Use the dedicated wrappers to access the field.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241005-power-supply-cleanups-v1-1-45303b2d0a4d@weissschuh.net
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/power_supply_core.c

index 84b77fb499497a00d2fecbb76b4fca0ff6084d01..e0c87a08bc26dbf7cfed2c1ff82cf9302ddd6823 100644 (file)
@@ -152,7 +152,7 @@ static void power_supply_deferred_register_work(struct work_struct *work)
                                                deferred_register_work.work);
 
        if (psy->dev.parent) {
-               while (!mutex_trylock(&psy->dev.parent->mutex)) {
+               while (!device_trylock(psy->dev.parent)) {
                        if (psy->removing)
                                return;
                        msleep(10);
@@ -162,7 +162,7 @@ static void power_supply_deferred_register_work(struct work_struct *work)
        power_supply_changed(psy);
 
        if (psy->dev.parent)
-               mutex_unlock(&psy->dev.parent->mutex);
+               device_unlock(psy->dev.parent);
 }
 
 #ifdef CONFIG_OF