summaryrefslogtreecommitdiffstats
path: root/drivers/leds/trigger/ledtrig-backlight.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2018-07-02 22:05:21 +0200
committerJacek Anaszewski <jacek.anaszewski@gmail.com>2018-07-05 23:21:10 +0200
commit2282e125a406e09331c5a785e3df29035c99a607 (patch)
treeb5936ee2bde7c85bf71aaff259026857b2bda6d9 /drivers/leds/trigger/ledtrig-backlight.c
parent033692eb3ec8305f6e9998b297aaec6899680637 (diff)
downloadlinux-2282e125a406e09331c5a785e3df29035c99a607.tar.gz
linux-2282e125a406e09331c5a785e3df29035c99a607.tar.bz2
linux-2282e125a406e09331c5a785e3df29035c99a607.zip
leds: triggers: let struct led_trigger::activate() return an error code
Given that activating a trigger can fail, let the callback return an indication. This prevents to have a trigger active according to the "trigger" sysfs attribute but not functional. All users are changed accordingly to return 0 for now. There is no intended change in behaviour. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Diffstat (limited to 'drivers/leds/trigger/ledtrig-backlight.c')
-rw-r--r--drivers/leds/trigger/ledtrig-backlight.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/leds/trigger/ledtrig-backlight.c b/drivers/leds/trigger/ledtrig-backlight.c
index 1ca1f1608f76..84512960d630 100644
--- a/drivers/leds/trigger/ledtrig-backlight.c
+++ b/drivers/leds/trigger/ledtrig-backlight.c
@@ -97,7 +97,7 @@ static ssize_t bl_trig_invert_store(struct device *dev,
}
static DEVICE_ATTR(inverted, 0644, bl_trig_invert_show, bl_trig_invert_store);
-static void bl_trig_activate(struct led_classdev *led)
+static int bl_trig_activate(struct led_classdev *led)
{
int ret;
@@ -107,7 +107,7 @@ static void bl_trig_activate(struct led_classdev *led)
led->trigger_data = n;
if (!n) {
dev_err(led->dev, "unable to allocate backlight trigger\n");
- return;
+ return 0;
}
ret = device_create_file(led->dev, &dev_attr_inverted);
@@ -124,11 +124,13 @@ static void bl_trig_activate(struct led_classdev *led)
dev_err(led->dev, "unable to register backlight trigger\n");
led->activated = true;
- return;
+ return 0;
err_invert:
led->trigger_data = NULL;
kfree(n);
+
+ return 0;
}
static void bl_trig_deactivate(struct led_classdev *led)