From a0011f1be78aec408803728359a7a181baa167bb Mon Sep 17 00:00:00 2001 From: Andrew Lunn Date: Thu, 20 Aug 2015 12:50:05 +0200 Subject: [PATCH] leds: lt3593: Remove work queue Now the core implements the work queue, remove it from the drivers, and switch to using brightness_set_blocking op. Signed-off-by: Andrew Lunn Cc: Daniel Mack Signed-off-by: Jacek Anaszewski --- drivers/leds/leds-lt3593.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c index 9f41124765cc..a7ff510cbdd0 100644 --- a/drivers/leds/leds-lt3593.c +++ b/drivers/leds/leds-lt3593.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -28,15 +27,14 @@ struct lt3593_led_data { struct led_classdev cdev; unsigned gpio; - struct work_struct work; - u8 new_level; }; -static void lt3593_led_work(struct work_struct *work) +static int lt3593_led_set(struct led_classdev *led_cdev, + enum led_brightness value) { - int pulses; struct lt3593_led_data *led_dat = - container_of(work, struct lt3593_led_data, work); + container_of(led_cdev, struct lt3593_led_data, cdev); + int pulses; /* * The LT3593 resets its internal current level register to the maximum @@ -47,18 +45,18 @@ static void lt3593_led_work(struct work_struct *work) * applied is to the output driver. */ - if (led_dat->new_level == 0) { + if (value == 0) { gpio_set_value_cansleep(led_dat->gpio, 0); - return; + return 0; } - pulses = 32 - (led_dat->new_level * 32) / 255; + pulses = 32 - (value * 32) / 255; if (pulses == 0) { gpio_set_value_cansleep(led_dat->gpio, 0); mdelay(1); gpio_set_value_cansleep(led_dat->gpio, 1); - return; + return 0; } gpio_set_value_cansleep(led_dat->gpio, 1); @@ -69,16 +67,8 @@ static void lt3593_led_work(struct work_struct *work) gpio_set_value_cansleep(led_dat->gpio, 1); udelay(1); } -} -static void lt3593_led_set(struct led_classdev *led_cdev, - enum led_brightness value) -{ - struct lt3593_led_data *led_dat = - container_of(led_cdev, struct lt3593_led_data, cdev); - - led_dat->new_level = value; - schedule_work(&led_dat->work); + return 0; } static int create_lt3593_led(const struct gpio_led *template, @@ -97,7 +87,7 @@ static int create_lt3593_led(const struct gpio_led *template, led_dat->cdev.default_trigger = template->default_trigger; led_dat->gpio = template->gpio; - led_dat->cdev.brightness_set = lt3593_led_set; + led_dat->cdev.brightness_set_blocking = lt3593_led_set; state = (template->default_state == LEDS_GPIO_DEFSTATE_ON); led_dat->cdev.brightness = state ? LED_FULL : LED_OFF; @@ -111,8 +101,6 @@ static int create_lt3593_led(const struct gpio_led *template, if (ret < 0) return ret; - INIT_WORK(&led_dat->work, lt3593_led_work); - ret = led_classdev_register(parent, &led_dat->cdev); if (ret < 0) return ret; @@ -129,7 +117,6 @@ static void delete_lt3593_led(struct lt3593_led_data *led) return; led_classdev_unregister(&led->cdev); - cancel_work_sync(&led->work); } static int lt3593_led_probe(struct platform_device *pdev) -- 2.20.1