Commit 00a88a19 authored by Andrew Lunn's avatar Andrew Lunn Committed by Jacek Anaszewski

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: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
parent bb58cc81
...@@ -158,7 +158,7 @@ static void pca9532_setled(struct pca9532_led *led) ...@@ -158,7 +158,7 @@ static void pca9532_setled(struct pca9532_led *led)
mutex_unlock(&data->update_lock); 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) enum led_brightness value)
{ {
int err = 0; int err = 0;
...@@ -172,9 +172,12 @@ static void pca9532_set_brightness(struct led_classdev *led_cdev, ...@@ -172,9 +172,12 @@ static void pca9532_set_brightness(struct led_classdev *led_cdev,
led->state = PCA9532_PWM0; /* Thecus: hardcode one pwm */ led->state = PCA9532_PWM0; /* Thecus: hardcode one pwm */
err = pca9532_calcpwm(led->client, 0, 0, value); err = pca9532_calcpwm(led->client, 0, 0, value);
if (err) 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, static int pca9532_set_blink(struct led_classdev *led_cdev,
...@@ -198,7 +201,10 @@ 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); err = pca9532_calcpwm(client, 0, psc, led_cdev->brightness);
if (err) if (err)
return err; return err;
schedule_work(&led->work); if (led->state == PCA9532_PWM0)
pca9532_setpwm(led->client, 0);
pca9532_setled(led);
return 0; return 0;
} }
...@@ -233,15 +239,6 @@ static void pca9532_input_work(struct work_struct *work) ...@@ -233,15 +239,6 @@ static void pca9532_input_work(struct work_struct *work)
mutex_unlock(&data->update_lock); 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 #ifdef CONFIG_LEDS_PCA9532_GPIO
static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset) 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) ...@@ -307,7 +304,6 @@ static int pca9532_destroy_devices(struct pca9532_data *data, int n_devs)
break; break;
case PCA9532_TYPE_LED: case PCA9532_TYPE_LED:
led_classdev_unregister(&data->leds[i].ldev); led_classdev_unregister(&data->leds[i].ldev);
cancel_work_sync(&data->leds[i].work);
break; break;
case PCA9532_TYPE_N2100_BEEP: case PCA9532_TYPE_N2100_BEEP:
if (data->idev != NULL) { if (data->idev != NULL) {
...@@ -359,9 +355,9 @@ static int pca9532_configure(struct i2c_client *client, ...@@ -359,9 +355,9 @@ static int pca9532_configure(struct i2c_client *client,
led->name = pled->name; led->name = pled->name;
led->ldev.name = led->name; led->ldev.name = led->name;
led->ldev.brightness = LED_OFF; 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; led->ldev.blink_set = pca9532_set_blink;
INIT_WORK(&led->work, pca9532_led_work);
err = led_classdev_register(&client->dev, &led->ldev); err = led_classdev_register(&client->dev, &led->ldev);
if (err < 0) { if (err < 0) {
dev_err(&client->dev, dev_err(&client->dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment