diff options
author | Andrew Lunn <andrew@lunn.ch> | 2015-08-20 12:50:34 +0300 |
---|---|---|
committer | Jacek Anaszewski <j.anaszewski@samsung.com> | 2016-01-04 11:57:32 +0300 |
commit | 8824fefb59a3882963241e2e39d704af33708820 (patch) | |
tree | 14c7bd5a6eed9d61e7bc3d8076040d613f22ccb1 /drivers/leds/leds-88pm860x.c | |
parent | d890389f89bcdd5c45023721a48f8da2da563ea3 (diff) | |
download | linux-8824fefb59a3882963241e2e39d704af33708820.tar.xz |
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 @@ #include <linux/i2c.h> #include <linux/leds.h> #include <linux/slab.h> -#include <linux/workqueue.h> #include <linux/mfd/88pm860x.h> #include <linux/module.h> @@ -33,7 +32,6 @@ struct pm860x_led { struct led_classdev cdev; struct i2c_client *i2c; - struct work_struct work; struct pm860x_chip *chip; struct mutex lock; char name[MFD_NAME_SIZE]; @@ -69,17 +67,18 @@ static int led_power_set(struct pm860x_chip *chip, int port, int on) return ret; } -static void pm860x_led_work(struct work_struct *work) +static int pm860x_led_set(struct led_classdev *cdev, + enum led_brightness value) { - - struct pm860x_led *led; + struct pm860x_led *led = container_of(cdev, struct pm860x_led, cdev); struct pm860x_chip *chip; unsigned char buf[3]; int ret; - led = container_of(work, struct pm860x_led, work); chip = led->chip; mutex_lock(&led->lock); + led->brightness = value >> 3; + if ((led->current_brightness == 0) && led->brightness) { led_power_set(chip, led->port, 1); if (led->iset) { @@ -112,15 +111,8 @@ static void pm860x_led_work(struct work_struct *work) dev_dbg(chip->dev, "Update LED. (reg:%d, brightness:%d)\n", led->reg_control, led->brightness); mutex_unlock(&led->lock); -} -static void pm860x_led_set(struct led_classdev *cdev, - enum led_brightness value) -{ - struct pm860x_led *data = container_of(cdev, struct pm860x_led, cdev); - - data->brightness = value >> 3; - schedule_work(&data->work); + return 0; } #ifdef CONFIG_OF @@ -213,9 +205,8 @@ static int pm860x_led_probe(struct platform_device *pdev) data->current_brightness = 0; data->cdev.name = data->name; - data->cdev.brightness_set = pm860x_led_set; + data->cdev.brightness_set_blocking = pm860x_led_set; mutex_init(&data->lock); - INIT_WORK(&data->work, pm860x_led_work); ret = led_classdev_register(chip->dev, &data->cdev); if (ret < 0) { |