Skip to contentSkip to conversation

leds: syscon: Use resource managed variant of device register

PATCH Applied Alexander Dahl 2 participants 2 messages Aug 27, 2019 LED

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 leds: syscon: Use resource managed variant of device register

We have a MFD driver compiled as module instantiating this driver. When unloading that module, those LED devices are not removed, which produces conflicts, when that module is inserted again.

---
 drivers/leds/leds-syscon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-syscon.c +1 -1
index e35dff0050f0..b58f3cafe16f 100644
@@ -115,7 +115,7 @@ static int syscon_led_probe(struct platform_device *pdev)
 	}
 	sled->cdev.brightness_set = syscon_led_set;
 
-	ret = led_classdev_register(dev, &sled->cdev);
+	ret = devm_led_classdev_register(dev, &sled->cdev);
 	if (ret < 0)
 		return ret;
 
Signature · 1 line
2.20.1
#1 lore raw

Hi Alexander,

Thank you for the patch.

Quoted 14 lines · Alexander Dahl

We have a MFD driver compiled as module instantiating this driver. When unloading that module, those LED devices are not removed, which produces conflicts, when that module is inserted again.

---
 drivers/leds/leds-syscon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-syscon.c +0 -0
index e35dff0050f0..b58f3cafe16f 100644

drivers/leds/leds-syscon.c static int syscon_led_probe(struct platform_device *pdev) · line 120

Quoted 7 lines
drivers/leds/leds-syscon.c +1 -1
@@ -115,7 +115,7 @@ static int syscon_led_probe(struct platform_device *pdev)
 	}
 	sled->cdev.brightness_set = syscon_led_set;
 
-	ret = led_classdev_register(dev, &sled->cdev);
+	ret = devm_led_classdev_register(dev, &sled->cdev);
 	if (ret < 0)
 		return ret;

Applied.

Signature · 2 lines
Best regards,
Jacek Anaszewski