* [PATCH v2 0/2] modernize and fix mc13xxx-led driver
@ 2026-11-22 7:32 Alexander Kurz
2026-11-22 7:32 ` [PATCH v2 1/2] leds: leds-mc13783: use unified device property API Alexander Kurz
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Alexander Kurz @ 2026-11-22 7:32 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Griffin Kroah-Hartman
Cc: Ilpo Järvinen, Bjorn Helgaas, linux-leds, linux-kernel,
Alexander Kurz
Main goal of this series is a fix enabling deferred probing of the
mc13xxx-led driver. The previous implementation has been dependent
on the MFD instance being present first and which has been changed
by commit 78efa53e715e ("leds: Init leds class earlier"), breaking
functionality. While working on it, replace the OF-specific API
with the newerunified device property API.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
Changes in v2:
- removed unintended change of property "led-control" (Sashiko)
Alexander Kurz (2):
leds: leds-mc13783: use unified device property API
leds: leds-mc13783: enable driver for deferred probe
drivers/leds/leds-mc13783.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] leds: leds-mc13783: use unified device property API
2026-11-22 7:32 [PATCH v2 0/2] modernize and fix mc13xxx-led driver Alexander Kurz
@ 2026-11-22 7:32 ` Alexander Kurz
2026-11-22 7:42 ` sashiko-bot
2026-11-22 7:32 ` [PATCH v2 2/2] leds: leds-mc13783: enable driver for deferred probe Alexander Kurz
2026-11-22 7:42 ` [PATCH v2 0/2] modernize and fix mc13xxx-led driver sashiko-bot
2 siblings, 1 reply; 5+ messages in thread
From: Alexander Kurz @ 2026-11-22 7:32 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Griffin Kroah-Hartman
Cc: Ilpo Järvinen, Bjorn Helgaas, linux-leds, linux-kernel,
Alexander Kurz
Replace OF-specific API calls with the unified device property variants.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
drivers/leds/leds-mc13783.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c
index 19c1b51475db..82b2062b2280 100644
--- a/drivers/leds/leds-mc13783.c
+++ b/drivers/leds/leds-mc13783.c
@@ -16,8 +16,8 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/leds.h>
-#include <linux/of.h>
#include <linux/mfd/mc13xxx.h>
struct mc13xxx_led_devtype {
@@ -114,7 +114,7 @@ static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
{
struct mc13xxx_leds *leds = platform_get_drvdata(pdev);
struct mc13xxx_leds_platform_data *pdata;
- struct device_node *child;
+ struct fwnode_handle *child;
struct device *dev = &pdev->dev;
int i = 0, ret = -ENODATA;
@@ -122,34 +122,34 @@ static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
if (!pdata)
return ERR_PTR(-ENOMEM);
- struct device_node *parent __free(device_node) =
- of_get_child_by_name(dev_of_node(dev->parent), "leds");
+ struct fwnode_handle *parent __free(fwnode_handle) =
+ device_get_named_child_node(dev->parent, "leds");
if (!parent)
return ERR_PTR(-ENODATA);
- ret = of_property_read_u32_array(parent, "led-control",
+ ret = fwnode_property_read_u32_array(parent, "led-control",
pdata->led_control,
leds->devtype->num_regs);
if (ret)
return ERR_PTR(ret);
- pdata->num_leds = of_get_available_child_count(parent);
+ pdata->num_leds = fwnode_get_child_node_count(parent);
pdata->led = devm_kzalloc_objs(dev, *pdata->led, pdata->num_leds);
if (!pdata->led)
return ERR_PTR(-ENOMEM);
- for_each_available_child_of_node(parent, child) {
+ fwnode_for_each_child_node(parent, child) {
const char *str;
u32 tmp;
- if (of_property_read_u32(child, "reg", &tmp))
+ if (fwnode_property_read_u32(child, "reg", &tmp))
continue;
pdata->led[i].id = leds->devtype->led_min + tmp;
- if (!of_property_read_string(child, "label", &str))
+ if (!fwnode_property_read_string(child, "label", &str))
pdata->led[i].name = str;
- if (!of_property_read_string(child, "linux,default-trigger",
+ if (!fwnode_property_read_string(child, "linux,default-trigger",
&str))
pdata->led[i].default_trigger = str;
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] leds: leds-mc13783: enable driver for deferred probe
2026-11-22 7:32 [PATCH v2 0/2] modernize and fix mc13xxx-led driver Alexander Kurz
2026-11-22 7:32 ` [PATCH v2 1/2] leds: leds-mc13783: use unified device property API Alexander Kurz
@ 2026-11-22 7:32 ` Alexander Kurz
2026-11-22 7:42 ` [PATCH v2 0/2] modernize and fix mc13xxx-led driver sashiko-bot
2 siblings, 0 replies; 5+ messages in thread
From: Alexander Kurz @ 2026-11-22 7:32 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Griffin Kroah-Hartman
Cc: Ilpo Järvinen, Bjorn Helgaas, linux-leds, linux-kernel,
Alexander Kurz
The probe order between mfd and leds has been changed with commit
78efa53e715e ("leds: Init leds class earlier") so that mc13xxx-led
driver was not registered any more due to the missing mfd instance.
Use module_platform_driver() to replace module_platform_driver_probe().
The former utilizes platform_driver_register(), which allows the driver
to defer probing when it doesn't acquire the necessary resources from
the mfd device due to probe order.
Fixes: 78efa53e715e ("leds: Init leds class earlier")
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
drivers/leds/leds-mc13783.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c
index 82b2062b2280..866097be3eb9 100644
--- a/drivers/leds/leds-mc13783.c
+++ b/drivers/leds/leds-mc13783.c
@@ -109,7 +109,7 @@ static int mc13xxx_led_set(struct led_classdev *led_cdev,
}
#ifdef CONFIG_OF
-static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
+static struct mc13xxx_leds_platform_data *mc13xxx_led_probe_dt(
struct platform_device *pdev)
{
struct mc13xxx_leds *leds = platform_get_drvdata(pdev);
@@ -163,14 +163,14 @@ static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
return pdata;
}
#else
-static inline struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
+static inline struct mc13xxx_leds_platform_data *mc13xxx_led_probe_dt(
struct platform_device *pdev)
{
return ERR_PTR(-ENOSYS);
}
#endif
-static int __init mc13xxx_led_probe(struct platform_device *pdev)
+static int mc13xxx_led_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct mc13xxx_leds_platform_data *pdata = dev_get_platdata(dev);
@@ -296,13 +296,14 @@ static const struct platform_device_id mc13xxx_led_id_table[] = {
MODULE_DEVICE_TABLE(platform, mc13xxx_led_id_table);
static struct platform_driver mc13xxx_led_driver = {
+ .probe = mc13xxx_led_probe,
.driver = {
.name = "mc13xxx-led",
},
.remove = mc13xxx_led_remove,
.id_table = mc13xxx_led_id_table,
};
-module_platform_driver_probe(mc13xxx_led_driver, mc13xxx_led_probe);
+module_platform_driver(mc13xxx_led_driver);
MODULE_DESCRIPTION("LEDs driver for Freescale MC13XXX PMIC");
MODULE_AUTHOR("Philippe Retornaz <philippe.retornaz@epfl.ch>");
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] leds: leds-mc13783: use unified device property API
2026-11-22 7:32 ` [PATCH v2 1/2] leds: leds-mc13783: use unified device property API Alexander Kurz
@ 2026-11-22 7:42 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-11-22 7:42 UTC (permalink / raw)
To: Alexander Kurz; +Cc: linux-leds, lee
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] leds: mc13783: incomplete conversion to unified device
property API
- [Low] leds: mc13783: commit subject does not follow LED subsystem
format
--
commit 93c8124da2ab3f4f36f3615c125e08a2dcba2624
Author: Alexander Kurz <akurz@blala.de>
leds: leds-mc13783: use unified device property API
This commit replaces OF-specific API calls in mc13xxx_led_probe_dt() with
unified device property helpers from linux/property.h.
> leds: leds-mc13783: use unified device property API
[Severity: Low]
This isn't a bug, but the LED subsystem convention for commit subjects is
"leds: <driver>: <Capitalized description>", so this should be
"leds: mc13783: Use unified device property API".
> diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c
> index 19c1b51475db6..82b2062b2280d 100644
> --- a/drivers/leds/leds-mc13783.c
> +++ b/drivers/leds/leds-mc13783.c
> @@ -16,8 +16,8 @@
> #include <linux/module.h>
> #include <linux/kernel.h>
> #include <linux/platform_device.h>
> +#include <linux/property.h>
> #include <linux/leds.h>
> -#include <linux/of.h>
> #include <linux/mfd/mc13xxx.h>
>
> struct mc13xxx_led_devtype {
> @@ -114,7 +114,7 @@ static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
> {
> struct mc13xxx_leds *leds = platform_get_drvdata(pdev);
> struct mc13xxx_leds_platform_data *pdata;
> - struct device_node *child;
> + struct fwnode_handle *child;
> struct device *dev = &pdev->dev;
> int i = 0, ret = -ENODATA;
>
> @@ -122,34 +122,34 @@ static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
> if (!pdata)
> return ERR_PTR(-ENOMEM);
>
> - struct device_node *parent __free(device_node) =
> - of_get_child_by_name(dev_of_node(dev->parent), "leds");
> + struct fwnode_handle *parent __free(fwnode_handle) =
> + device_get_named_child_node(dev->parent, "leds");
> if (!parent)
> return ERR_PTR(-ENODATA);
[Severity: Medium]
Should the CONFIG_OF guard around mc13xxx_led_probe_dt() be dropped and
mc13xxx_led_probe() check dev_fwnode(dev->parent) instead of
dev_of_node(dev->parent)?
drivers/leds/leds-mc13783.c:mc13xxx_led_probe() {
...
if (dev_of_node(dev->parent)) {
pdata = mc13xxx_led_probe_dt(pdev);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
} else if (!pdata)
return -ENODATA;
...
}
Leaving mc13xxx_led_probe_dt() behind #ifdef CONFIG_OF and gating it on
dev_of_node(dev->parent) keeps a dependency on an OF helper after
linux/of.h was removed and causes mc13xxx_led_probe() to fail with
-ENODATA for non-OF fwnodes or when CONFIG_OF is disabled.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261122073235.26707-1-akurz@blala.de?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/2] modernize and fix mc13xxx-led driver
2026-11-22 7:32 [PATCH v2 0/2] modernize and fix mc13xxx-led driver Alexander Kurz
2026-11-22 7:32 ` [PATCH v2 1/2] leds: leds-mc13783: use unified device property API Alexander Kurz
2026-11-22 7:32 ` [PATCH v2 2/2] leds: leds-mc13783: enable driver for deferred probe Alexander Kurz
@ 2026-11-22 7:42 ` sashiko-bot
2 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-11-22 7:42 UTC (permalink / raw)
To: Alexander Kurz; +Cc: linux-leds, lee
Sashiko has finished reviewing this 2-patch series:
- Patch 2: no issues found.
- Patch 1 ("leds: leds-mc13783: use unified device property API"): 2
potential issues (1 Medium, 1 Low)
A detailed review has been sent as a separate reply to patch 1.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261122073235.26707-1-akurz@blala.de
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-22 7:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 7:32 [PATCH v2 0/2] modernize and fix mc13xxx-led driver Alexander Kurz
2026-11-22 7:32 ` [PATCH v2 1/2] leds: leds-mc13783: use unified device property API Alexander Kurz
2026-11-22 7:42 ` sashiko-bot
2026-11-22 7:32 ` [PATCH v2 2/2] leds: leds-mc13783: enable driver for deferred probe Alexander Kurz
2026-11-22 7:42 ` [PATCH v2 0/2] modernize and fix mc13xxx-led driver sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox