summaryrefslogtreecommitdiff
path: root/drivers/leds/trigger/ledtrig-timer.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2018-07-02 23:05:21 +0300
committerJacek Anaszewski <jacek.anaszewski@gmail.com>2018-07-06 00:21:10 +0300
commit2282e125a406e09331c5a785e3df29035c99a607 (patch)
treeb5936ee2bde7c85bf71aaff259026857b2bda6d9 /drivers/leds/trigger/ledtrig-timer.c
parent033692eb3ec8305f6e9998b297aaec6899680637 (diff)
downloadlinux-2282e125a406e09331c5a785e3df29035c99a607.tar.xz
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-timer.c')
-rw-r--r--drivers/leds/trigger/ledtrig-timer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/leds/trigger/ledtrig-timer.c b/drivers/leds/trigger/ledtrig-timer.c
index 10fc0966b0e3..527055d815ad 100644
--- a/drivers/leds/trigger/ledtrig-timer.c
+++ b/drivers/leds/trigger/ledtrig-timer.c
@@ -70,7 +70,7 @@ static ssize_t led_delay_off_store(struct device *dev,
static DEVICE_ATTR(delay_on, 0644, led_delay_on_show, led_delay_on_store);
static DEVICE_ATTR(delay_off, 0644, led_delay_off_show, led_delay_off_store);
-static void timer_trig_activate(struct led_classdev *led_cdev)
+static int timer_trig_activate(struct led_classdev *led_cdev)
{
int rc;
@@ -78,7 +78,7 @@ static void timer_trig_activate(struct led_classdev *led_cdev)
rc = device_create_file(led_cdev->dev, &dev_attr_delay_on);
if (rc)
- return;
+ return 0;
rc = device_create_file(led_cdev->dev, &dev_attr_delay_off);
if (rc)
goto err_out_delayon;
@@ -87,10 +87,12 @@ static void timer_trig_activate(struct led_classdev *led_cdev)
&led_cdev->blink_delay_off);
led_cdev->activated = true;
- return;
+ return 0;
err_out_delayon:
device_remove_file(led_cdev->dev, &dev_attr_delay_on);
+
+ return 0;
}
static void timer_trig_deactivate(struct led_classdev *led_cdev)