diff options
author | Andrew Lunn <andrew@lunn.ch> | 2015-08-20 05:50:34 -0400 |
---|---|---|
committer | Jacek Anaszewski <j.anaszewski@samsung.com> | 2016-01-04 03:57:32 -0500 |
commit | 8824fefb59a3882963241e2e39d704af33708820 (patch) | |
tree | 14c7bd5a6eed9d61e7bc3d8076040d613f22ccb1 /drivers/leds/leds-88pm860x.c | |
parent | d890389f89bcdd5c45023721a48f8da2da563ea3 (diff) |
leds: 88pm860x: Remove work queue
Now the core implements the work queue, remove it from the driver,
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-88pm860x.c')
-rw-r--r-- | drivers/leds/leds-88pm860x.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c index 7870840e7cc9..1ad4d03a0a3c 100644 --- a/drivers/leds/leds-88pm860x.c +++ b/drivers/leds/leds-88pm860x.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
17 | #include <linux/leds.h> | 17 | #include <linux/leds.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/workqueue.h> | ||
20 | #include <linux/mfd/88pm860x.h> | 19 | #include <linux/mfd/88pm860x.h> |
21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
22 | 21 | ||
@@ -33,7 +32,6 @@ | |||
33 | struct pm860x_led { | 32 | struct pm860x_led { |
34 | struct led_classdev cdev; | 33 | struct led_classdev cdev; |
35 | struct i2c_client *i2c; | 34 | struct i2c_client *i2c; |
36 | struct work_struct work; | ||
37 | struct pm860x_chip *chip; | 35 | struct pm860x_chip *chip; |
38 | struct mutex lock; | 36 | struct mutex lock; |
39 | char name[MFD_NAME_SIZE]; | 37 | char name[MFD_NAME_SIZE]; |
@@ -69,17 +67,18 @@ static int led_power_set(struct pm860x_chip *chip, int port, int on) | |||
69 | return ret; | 67 | return ret; |
70 | } | 68 | } |
71 | 69 | ||
72 | static void pm860x_led_work(struct work_struct *work) | 70 | static int pm860x_led_set(struct led_classdev *cdev, |
71 | enum led_brightness value) | ||
73 | { | 72 | { |
74 | 73 | struct pm860x_led *led = container_of(cdev, struct pm860x_led, cdev); | |
75 | struct pm860x_led *led; | ||
76 | struct pm860x_chip *chip; | 74 | struct pm860x_chip *chip; |
77 | unsigned char buf[3]; | 75 | unsigned char buf[3]; |
78 | int ret; | 76 | int ret; |
79 | 77 | ||
80 | led = container_of(work, struct pm860x_led, work); | ||
81 | chip = led->chip; | 78 | chip = led->chip; |
82 | mutex_lock(&led->lock); | 79 | mutex_lock(&led->lock); |
80 | led->brightness = value >> 3; | ||
81 | |||
83 | if ((led->current_brightness == 0) && led->brightness) { | 82 | if ((led->current_brightness == 0) && led->brightness) { |
84 | led_power_set(chip, led->port, 1); | 83 | led_power_set(chip, led->port, 1); |
85 | if (led->iset) { | 84 | if (led->iset) { |
@@ -112,15 +111,8 @@ static void pm860x_led_work(struct work_struct *work) | |||
112 | dev_dbg(chip->dev, "Update LED. (reg:%d, brightness:%d)\n", | 111 | dev_dbg(chip->dev, "Update LED. (reg:%d, brightness:%d)\n", |
113 | led->reg_control, led->brightness); | 112 | led->reg_control, led->brightness); |
114 | mutex_unlock(&led->lock); | 113 | mutex_unlock(&led->lock); |
115 | } | ||
116 | 114 | ||
117 | static void pm860x_led_set(struct led_classdev *cdev, | 115 | return 0; |
118 | enum led_brightness value) | ||
119 | { | ||
120 | struct pm860x_led *data = container_of(cdev, struct pm860x_led, cdev); | ||
121 | |||
122 | data->brightness = value >> 3; | ||
123 | schedule_work(&data->work); | ||
124 | } | 116 | } |
125 | 117 | ||
126 | #ifdef CONFIG_OF | 118 | #ifdef CONFIG_OF |
@@ -213,9 +205,8 @@ static int pm860x_led_probe(struct platform_device *pdev) | |||
213 | 205 | ||
214 | data->current_brightness = 0; | 206 | data->current_brightness = 0; |
215 | data->cdev.name = data->name; | 207 | data->cdev.name = data->name; |
216 | data->cdev.brightness_set = pm860x_led_set; | 208 | data->cdev.brightness_set_blocking = pm860x_led_set; |
217 | mutex_init(&data->lock); | 209 | mutex_init(&data->lock); |
218 | INIT_WORK(&data->work, pm860x_led_work); | ||
219 | 210 | ||
220 | ret = led_classdev_register(chip->dev, &data->cdev); | 211 | ret = led_classdev_register(chip->dev, &data->cdev); |
221 | if (ret < 0) { | 212 | if (ret < 0) { |