Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <andrew@lunn.ch>
Cc: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>

authored by

Andrew Lunn and committed by
Jacek Anaszewski
a0011f1b 8ec108c0

+10 -23
+10 -23
drivers/leds/leds-lt3593.c
··· 19 19 #include <linux/kernel.h> 20 20 #include <linux/platform_device.h> 21 21 #include <linux/leds.h> 22 - #include <linux/workqueue.h> 23 22 #include <linux/delay.h> 24 23 #include <linux/gpio.h> 25 24 #include <linux/slab.h> ··· 27 28 struct lt3593_led_data { 28 29 struct led_classdev cdev; 29 30 unsigned gpio; 30 - struct work_struct work; 31 - u8 new_level; 32 31 }; 33 32 34 - static void lt3593_led_work(struct work_struct *work) 33 + static int lt3593_led_set(struct led_classdev *led_cdev, 34 + enum led_brightness value) 35 35 { 36 - int pulses; 37 36 struct lt3593_led_data *led_dat = 38 - container_of(work, struct lt3593_led_data, work); 37 + container_of(led_cdev, struct lt3593_led_data, cdev); 38 + int pulses; 39 39 40 40 /* 41 41 * The LT3593 resets its internal current level register to the maximum ··· 45 47 * applied is to the output driver. 46 48 */ 47 49 48 - if (led_dat->new_level == 0) { 50 + if (value == 0) { 49 51 gpio_set_value_cansleep(led_dat->gpio, 0); 50 - return; 52 + return 0; 51 53 } 52 54 53 - pulses = 32 - (led_dat->new_level * 32) / 255; 55 + pulses = 32 - (value * 32) / 255; 54 56 55 57 if (pulses == 0) { 56 58 gpio_set_value_cansleep(led_dat->gpio, 0); 57 59 mdelay(1); 58 60 gpio_set_value_cansleep(led_dat->gpio, 1); 59 - return; 61 + return 0; 60 62 } 61 63 62 64 gpio_set_value_cansleep(led_dat->gpio, 1); ··· 67 69 gpio_set_value_cansleep(led_dat->gpio, 1); 68 70 udelay(1); 69 71 } 70 - } 71 72 72 - static void lt3593_led_set(struct led_classdev *led_cdev, 73 - enum led_brightness value) 74 - { 75 - struct lt3593_led_data *led_dat = 76 - container_of(led_cdev, struct lt3593_led_data, cdev); 77 - 78 - led_dat->new_level = value; 79 - schedule_work(&led_dat->work); 73 + return 0; 80 74 } 81 75 82 76 static int create_lt3593_led(const struct gpio_led *template, ··· 87 97 led_dat->cdev.default_trigger = template->default_trigger; 88 98 led_dat->gpio = template->gpio; 89 99 90 - led_dat->cdev.brightness_set = lt3593_led_set; 100 + led_dat->cdev.brightness_set_blocking = lt3593_led_set; 91 101 92 102 state = (template->default_state == LEDS_GPIO_DEFSTATE_ON); 93 103 led_dat->cdev.brightness = state ? LED_FULL : LED_OFF; ··· 100 110 template->name); 101 111 if (ret < 0) 102 112 return ret; 103 - 104 - INIT_WORK(&led_dat->work, lt3593_led_work); 105 113 106 114 ret = led_classdev_register(parent, &led_dat->cdev); 107 115 if (ret < 0) ··· 117 129 return; 118 130 119 131 led_classdev_unregister(&led->cdev); 120 - cancel_work_sync(&led->work); 121 132 } 122 133 123 134 static int lt3593_led_probe(struct platform_device *pdev)