diff options
author | Andrew Lunn <andrew@lunn.ch> | 2015-08-20 12:08:10 +0200 |
---|---|---|
committer | Jacek Anaszewski <j.anaszewski@samsung.com> | 2016-01-04 09:57:33 +0100 |
commit | 00a88a19d1d9b80e11ffe1a4f11dcabb93a75e45 (patch) | |
tree | 7c6adc7d8f1c3d2329625168780de5980f2b8307 /drivers/leds/leds-pca9532.c | |
parent | leds: lm3642: Remove work queue (diff) | |
download | linux-00a88a19d1d9b80e11ffe1a4f11dcabb93a75e45.tar.xz linux-00a88a19d1d9b80e11ffe1a4f11dcabb93a75e45.zip |
leds: pca9532: Remove work queue for LEDs.
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 '')
-rw-r--r-- | drivers/leds/leds-pca9532.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c index 5a6363d161a2..17c63ec9fb9e 100644 --- a/drivers/leds/leds-pca9532.c +++ b/drivers/leds/leds-pca9532.c @@ -158,7 +158,7 @@ static void pca9532_setled(struct pca9532_led *led) mutex_unlock(&data->update_lock); } -static void pca9532_set_brightness(struct led_classdev *led_cdev, +static int pca9532_set_brightness(struct led_classdev *led_cdev, enum led_brightness value) { int err = 0; @@ -172,9 +172,12 @@ static void pca9532_set_brightness(struct led_classdev *led_cdev, led->state = PCA9532_PWM0; /* Thecus: hardcode one pwm */ err = pca9532_calcpwm(led->client, 0, 0, value); if (err) - return; /* XXX: led api doesn't allow error code? */ + return err; } - schedule_work(&led->work); + if (led->state == PCA9532_PWM0) + pca9532_setpwm(led->client, 0); + pca9532_setled(led); + return err; } static int pca9532_set_blink(struct led_classdev *led_cdev, @@ -198,7 +201,10 @@ static int pca9532_set_blink(struct led_classdev *led_cdev, err = pca9532_calcpwm(client, 0, psc, led_cdev->brightness); if (err) return err; - schedule_work(&led->work); + if (led->state == PCA9532_PWM0) + pca9532_setpwm(led->client, 0); + pca9532_setled(led); + return 0; } @@ -233,15 +239,6 @@ static void pca9532_input_work(struct work_struct *work) mutex_unlock(&data->update_lock); } -static void pca9532_led_work(struct work_struct *work) -{ - struct pca9532_led *led; - led = container_of(work, struct pca9532_led, work); - if (led->state == PCA9532_PWM0) - pca9532_setpwm(led->client, 0); - pca9532_setled(led); -} - #ifdef CONFIG_LEDS_PCA9532_GPIO static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset) { @@ -307,7 +304,6 @@ static int pca9532_destroy_devices(struct pca9532_data *data, int n_devs) break; case PCA9532_TYPE_LED: led_classdev_unregister(&data->leds[i].ldev); - cancel_work_sync(&data->leds[i].work); break; case PCA9532_TYPE_N2100_BEEP: if (data->idev != NULL) { @@ -359,9 +355,9 @@ static int pca9532_configure(struct i2c_client *client, led->name = pled->name; led->ldev.name = led->name; led->ldev.brightness = LED_OFF; - led->ldev.brightness_set = pca9532_set_brightness; + led->ldev.brightness_set_blocking = + pca9532_set_brightness; led->ldev.blink_set = pca9532_set_blink; - INIT_WORK(&led->work, pca9532_led_work); err = led_classdev_register(&client->dev, &led->ldev); if (err < 0) { dev_err(&client->dev, |