diff mbox series

[1/4] power: supply: core: use device mutex wrappers

Message ID 20241005-power-supply-cleanups-v1-1-45303b2d0a4d@weissschuh.net
State Accepted
Commit bd3ee57b9d4c58edbf6f7bba071f6e508c7ff1c6
Headers show
Series power: supply: core: random cleanups and optimizations | expand

Commit Message

Thomas Weißschuh Oct. 5, 2024, 10:06 a.m. UTC
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>
---
 drivers/power/supply/power_supply_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 49534458a9f7d3f6d7c01bd91fa1bb6ed23bc7ad..c4608c60f7de2618941aae6e345a413ee249c0ae 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -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