diff options
author | Andrew Lunn <andrew@lunn.ch> | 2015-08-20 06:52:08 -0400 |
---|---|---|
committer | Jacek Anaszewski <j.anaszewski@samsung.com> | 2016-01-04 03:57:35 -0500 |
commit | 4330f2f26ee464f593dbd1a826016c369c69b74a (patch) | |
tree | 0eb07c43f30f471870e35a6e3f3ee5dd5aa6bb09 /drivers/leds/leds-mc13783.c | |
parent | d1c5c5c2e30a20946ef6f6f757b21263b0b6c7e3 (diff) |
leds: mc13783: 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>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Diffstat (limited to 'drivers/leds/leds-mc13783.c')
-rw-r--r-- | drivers/leds/leds-mc13783.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c index e2b847fe22a1..a2e4c1792e17 100644 --- a/drivers/leds/leds-mc13783.c +++ b/drivers/leds/leds-mc13783.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/leds.h> | 21 | #include <linux/leds.h> |
22 | #include <linux/of.h> | 22 | #include <linux/of.h> |
23 | #include <linux/workqueue.h> | ||
24 | #include <linux/mfd/mc13xxx.h> | 23 | #include <linux/mfd/mc13xxx.h> |
25 | 24 | ||
26 | struct mc13xxx_led_devtype { | 25 | struct mc13xxx_led_devtype { |
@@ -32,8 +31,6 @@ struct mc13xxx_led_devtype { | |||
32 | 31 | ||
33 | struct mc13xxx_led { | 32 | struct mc13xxx_led { |
34 | struct led_classdev cdev; | 33 | struct led_classdev cdev; |
35 | struct work_struct work; | ||
36 | enum led_brightness new_brightness; | ||
37 | int id; | 34 | int id; |
38 | struct mc13xxx_leds *leds; | 35 | struct mc13xxx_leds *leds; |
39 | }; | 36 | }; |
@@ -55,9 +52,11 @@ static unsigned int mc13xxx_max_brightness(int id) | |||
55 | return 0x3f; | 52 | return 0x3f; |
56 | } | 53 | } |
57 | 54 | ||
58 | static void mc13xxx_led_work(struct work_struct *work) | 55 | static int mc13xxx_led_set(struct led_classdev *led_cdev, |
56 | enum led_brightness value) | ||
59 | { | 57 | { |
60 | struct mc13xxx_led *led = container_of(work, struct mc13xxx_led, work); | 58 | struct mc13xxx_led *led = |
59 | container_of(led_cdev, struct mc13xxx_led, cdev); | ||
61 | struct mc13xxx_leds *leds = led->leds; | 60 | struct mc13xxx_leds *leds = led->leds; |
62 | unsigned int reg, bank, off, shift; | 61 | unsigned int reg, bank, off, shift; |
63 | 62 | ||
@@ -105,19 +104,9 @@ static void mc13xxx_led_work(struct work_struct *work) | |||
105 | BUG(); | 104 | BUG(); |
106 | } | 105 | } |
107 | 106 | ||
108 | mc13xxx_reg_rmw(leds->master, leds->devtype->ledctrl_base + reg, | 107 | return mc13xxx_reg_rmw(leds->master, leds->devtype->ledctrl_base + reg, |
109 | mc13xxx_max_brightness(led->id) << shift, | 108 | mc13xxx_max_brightness(led->id) << shift, |
110 | led->new_brightness << shift); | 109 | value << shift); |
111 | } | ||
112 | |||
113 | static void mc13xxx_led_set(struct led_classdev *led_cdev, | ||
114 | enum led_brightness value) | ||
115 | { | ||
116 | struct mc13xxx_led *led = | ||
117 | container_of(led_cdev, struct mc13xxx_led, cdev); | ||
118 | |||
119 | led->new_brightness = value; | ||
120 | schedule_work(&led->work); | ||
121 | } | 110 | } |
122 | 111 | ||
123 | #ifdef CONFIG_OF | 112 | #ifdef CONFIG_OF |
@@ -257,11 +246,9 @@ static int __init mc13xxx_led_probe(struct platform_device *pdev) | |||
257 | leds->led[i].cdev.name = name; | 246 | leds->led[i].cdev.name = name; |
258 | leds->led[i].cdev.default_trigger = trig; | 247 | leds->led[i].cdev.default_trigger = trig; |
259 | leds->led[i].cdev.flags = LED_CORE_SUSPENDRESUME; | 248 | leds->led[i].cdev.flags = LED_CORE_SUSPENDRESUME; |
260 | leds->led[i].cdev.brightness_set = mc13xxx_led_set; | 249 | leds->led[i].cdev.brightness_set_blocking = mc13xxx_led_set; |
261 | leds->led[i].cdev.max_brightness = mc13xxx_max_brightness(id); | 250 | leds->led[i].cdev.max_brightness = mc13xxx_max_brightness(id); |
262 | 251 | ||
263 | INIT_WORK(&leds->led[i].work, mc13xxx_led_work); | ||
264 | |||
265 | ret = led_classdev_register(dev->parent, &leds->led[i].cdev); | 252 | ret = led_classdev_register(dev->parent, &leds->led[i].cdev); |
266 | if (ret) { | 253 | if (ret) { |
267 | dev_err(dev, "Failed to register LED %i\n", id); | 254 | dev_err(dev, "Failed to register LED %i\n", id); |
@@ -270,10 +257,8 @@ static int __init mc13xxx_led_probe(struct platform_device *pdev) | |||
270 | } | 257 | } |
271 | 258 | ||
272 | if (ret) | 259 | if (ret) |
273 | while (--i >= 0) { | 260 | while (--i >= 0) |
274 | led_classdev_unregister(&leds->led[i].cdev); | 261 | led_classdev_unregister(&leds->led[i].cdev); |
275 | cancel_work_sync(&leds->led[i].work); | ||
276 | } | ||
277 | 262 | ||
278 | return ret; | 263 | return ret; |
279 | } | 264 | } |
@@ -283,10 +268,8 @@ static int mc13xxx_led_remove(struct platform_device *pdev) | |||
283 | struct mc13xxx_leds *leds = platform_get_drvdata(pdev); | 268 | struct mc13xxx_leds *leds = platform_get_drvdata(pdev); |
284 | int i; | 269 | int i; |
285 | 270 | ||
286 | for (i = 0; i < leds->num_leds; i++) { | 271 | for (i = 0; i < leds->num_leds; i++) |
287 | led_classdev_unregister(&leds->led[i].cdev); | 272 | led_classdev_unregister(&leds->led[i].cdev); |
288 | cancel_work_sync(&leds->led[i].work); | ||
289 | } | ||
290 | 273 | ||
291 | return 0; | 274 | return 0; |
292 | } | 275 | } |