leds: 88pm860x: Simplify with scoped for each OF child loop
Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240816-cleanup-h-of-node-put-var-v1-5-1d0292802470@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
05c2f554d1
commit
6c17a9a899
@ -115,7 +115,7 @@ static int pm860x_led_set(struct led_classdev *cdev,
|
|||||||
static int pm860x_led_dt_init(struct platform_device *pdev,
|
static int pm860x_led_dt_init(struct platform_device *pdev,
|
||||||
struct pm860x_led *data)
|
struct pm860x_led *data)
|
||||||
{
|
{
|
||||||
struct device_node *nproot, *np;
|
struct device_node *nproot;
|
||||||
int iset = 0;
|
int iset = 0;
|
||||||
|
|
||||||
if (!dev_of_node(pdev->dev.parent))
|
if (!dev_of_node(pdev->dev.parent))
|
||||||
@ -125,12 +125,11 @@ static int pm860x_led_dt_init(struct platform_device *pdev,
|
|||||||
dev_err(&pdev->dev, "failed to find leds node\n");
|
dev_err(&pdev->dev, "failed to find leds node\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
for_each_available_child_of_node(nproot, np) {
|
for_each_available_child_of_node_scoped(nproot, np) {
|
||||||
if (of_node_name_eq(np, data->name)) {
|
if (of_node_name_eq(np, data->name)) {
|
||||||
of_property_read_u32(np, "marvell,88pm860x-iset",
|
of_property_read_u32(np, "marvell,88pm860x-iset",
|
||||||
&iset);
|
&iset);
|
||||||
data->iset = PM8606_LED_CURRENT(iset);
|
data->iset = PM8606_LED_CURRENT(iset);
|
||||||
of_node_put(np);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user