summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-gpio.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-11-22 16:25:20 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2024-11-22 16:25:20 -0800
commit93251bdf7a771c4eeb0f95fa38ded92e95154ef7 (patch)
treea88c203830489df41b85b986f8e9ed6b8d0dd2c4 /drivers/leds/leds-gpio.c
parent80739fd00c7ea1315d362ce889bef499452913ef (diff)
parente8501858035b1f95468da525e7357c8c33811b88 (diff)
Merge tag 'leds-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
PULL LED updates from Lee Jones: - Remove unused local header files from various drivers - Revert platform driver removal to the original method for consistency - Introduce ordered workqueues for LED events, replacing the less efficient system_wq - Switch to a safer iteration macro in several drivers to prevent potential memory leaks - Fix a refcounting bug in the mt6360 flash LED driver - Fix an uninitialized variable in the mt6370_mc_pattern_clear() function - Resolve Smatch warnings in the leds-bcm6328 driver - Address a potential NULL pointer dereference in the brightness_show() function - Fix an incorrect format specifier in the ss4200 driver - Prevent a resource leak in the max5970 driver's probe function - Add support for specifying the number of serial shift bits in the device tree for the BCM63138 family - Implement multicolor brightness control in the lp5562 driver - Add a device tree property to override the default LED pin polarity - Add a property to specify the default brightness value when the LED is initially on - Set missing timing properties for the ktd2692 driver - Document the "rc-feedback" trigger for controlling LEDs based on remote control activity - Convert text bindings to YAML for the pca955x driver to enable device tree validation - Remove redundant checks for invalid channel numbers in the lp55xx driver - Update the MAINTAINERS file with current contact information * tag 'leds-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (46 commits) leds: ss4200: Fix the wrong format specifier for 'blinking' leds: pwm: Add optional DT property default-brightness dt-bindings: leds: pwm: Add default-brightness property leds: class: Protect brightness_show() with led_cdev->led_access mutex leds: ktd2692: Set missing timing properties leds: max5970: Fix unreleased fwnode_handle in probe function leds: Introduce ordered workqueue for LEDs events instead of system_wq MAINTAINERS: Replace Siemens IPC related bouncing maintainers leds: bcm6328: Replace divide condition with comparison for shift value leds: lp55xx: Remove redundant test for invalid channel number dt-bindings: leds: pca955x: Convert text bindings to YAML leds: rgb: leds-mt6370-rgb: Fix uninitialized variable 'ret' in mt6370_mc_pattern_clear leds: lp5562: Add multicolor brightness control dt-bindings: leds: Add 'active-high' property leds: Switch back to struct platform_driver::remove() leds: bcm63138: Add some register defines leds: bcm63138: Handle shift register config leds: bcm63138: Use scopes and guards dt-bindings: leds: bcm63138: Add shift register bits leds: leds-gpio-register: Reorganize kerneldoc parameter names ...
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r--drivers/leds/leds-gpio.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index cf5038cde5b8..a3428b22de3a 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -21,8 +21,6 @@
#include <linux/slab.h>
#include <linux/types.h>
-#include "leds.h"
-
struct gpio_led_data {
struct led_classdev cdev;
struct gpio_desc *gpiod;
@@ -148,7 +146,6 @@ struct gpio_leds_priv {
static struct gpio_leds_priv *gpio_leds_create(struct device *dev)
{
- struct fwnode_handle *child;
struct gpio_leds_priv *priv;
int count, used, ret;
@@ -162,7 +159,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct device *dev)
priv->num_leds = count;
used = 0;
- device_for_each_child_node(dev, child) {
+ device_for_each_child_node_scoped(dev, child) {
struct gpio_led_data *led_dat = &priv->leds[used];
struct gpio_led led = {};
@@ -176,7 +173,6 @@ static struct gpio_leds_priv *gpio_leds_create(struct device *dev)
if (IS_ERR(led.gpiod)) {
dev_err_probe(dev, PTR_ERR(led.gpiod), "Failed to get GPIO '%pfw'\n",
child);
- fwnode_handle_put(child);
return ERR_CAST(led.gpiod);
}
@@ -192,10 +188,9 @@ static struct gpio_leds_priv *gpio_leds_create(struct device *dev)
led.panic_indicator = 1;
ret = create_gpio_led(&led, led_dat, dev, child, NULL);
- if (ret < 0) {
- fwnode_handle_put(child);
+ if (ret < 0)
return ERR_PTR(ret);
- }
+
/* Set gpiod label to match the corresponding LED name. */
gpiod_set_consumer_name(led_dat->gpiod,
led_dat->cdev.dev->kobj.name);