Commit a478851c authored by Andrew Lunn's avatar Andrew Lunn Committed by Jacek Anaszewski

leds: lm3533: 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: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
Cc: Johan Hovold <johan@kernel.org>
parent 7e1761b0
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/mfd/lm3533.h> #include <linux/mfd/lm3533.h>
...@@ -53,9 +52,6 @@ struct lm3533_led { ...@@ -53,9 +52,6 @@ struct lm3533_led {
struct mutex mutex; struct mutex mutex;
unsigned long flags; unsigned long flags;
struct work_struct work;
u8 new_brightness;
}; };
...@@ -123,27 +119,17 @@ static int lm3533_led_pattern_enable(struct lm3533_led *led, int enable) ...@@ -123,27 +119,17 @@ static int lm3533_led_pattern_enable(struct lm3533_led *led, int enable)
return ret; return ret;
} }
static void lm3533_led_work(struct work_struct *work) static int lm3533_led_set(struct led_classdev *cdev,
{
struct lm3533_led *led = container_of(work, struct lm3533_led, work);
dev_dbg(led->cdev.dev, "%s - %u\n", __func__, led->new_brightness);
if (led->new_brightness == 0)
lm3533_led_pattern_enable(led, 0); /* disable blink */
lm3533_ctrlbank_set_brightness(&led->cb, led->new_brightness);
}
static void lm3533_led_set(struct led_classdev *cdev,
enum led_brightness value) enum led_brightness value)
{ {
struct lm3533_led *led = to_lm3533_led(cdev); struct lm3533_led *led = to_lm3533_led(cdev);
dev_dbg(led->cdev.dev, "%s - %d\n", __func__, value); dev_dbg(led->cdev.dev, "%s - %d\n", __func__, value);
led->new_brightness = value; if (value == 0)
schedule_work(&led->work); lm3533_led_pattern_enable(led, 0); /* disable blink */
return lm3533_ctrlbank_set_brightness(&led->cb, value);
} }
static enum led_brightness lm3533_led_get(struct led_classdev *cdev) static enum led_brightness lm3533_led_get(struct led_classdev *cdev)
...@@ -693,7 +679,7 @@ static int lm3533_led_probe(struct platform_device *pdev) ...@@ -693,7 +679,7 @@ static int lm3533_led_probe(struct platform_device *pdev)
led->lm3533 = lm3533; led->lm3533 = lm3533;
led->cdev.name = pdata->name; led->cdev.name = pdata->name;
led->cdev.default_trigger = pdata->default_trigger; led->cdev.default_trigger = pdata->default_trigger;
led->cdev.brightness_set = lm3533_led_set; led->cdev.brightness_set_blocking = lm3533_led_set;
led->cdev.brightness_get = lm3533_led_get; led->cdev.brightness_get = lm3533_led_get;
led->cdev.blink_set = lm3533_led_blink_set; led->cdev.blink_set = lm3533_led_blink_set;
led->cdev.brightness = LED_OFF; led->cdev.brightness = LED_OFF;
...@@ -701,7 +687,6 @@ static int lm3533_led_probe(struct platform_device *pdev) ...@@ -701,7 +687,6 @@ static int lm3533_led_probe(struct platform_device *pdev)
led->id = pdev->id; led->id = pdev->id;
mutex_init(&led->mutex); mutex_init(&led->mutex);
INIT_WORK(&led->work, lm3533_led_work);
/* The class framework makes a callback to get brightness during /* The class framework makes a callback to get brightness during
* registration so use parent device (for error reporting) until * registration so use parent device (for error reporting) until
...@@ -733,7 +718,6 @@ static int lm3533_led_probe(struct platform_device *pdev) ...@@ -733,7 +718,6 @@ static int lm3533_led_probe(struct platform_device *pdev)
err_unregister: err_unregister:
led_classdev_unregister(&led->cdev); led_classdev_unregister(&led->cdev);
flush_work(&led->work);
return ret; return ret;
} }
...@@ -746,7 +730,6 @@ static int lm3533_led_remove(struct platform_device *pdev) ...@@ -746,7 +730,6 @@ static int lm3533_led_remove(struct platform_device *pdev)
lm3533_ctrlbank_disable(&led->cb); lm3533_ctrlbank_disable(&led->cb);
led_classdev_unregister(&led->cdev); led_classdev_unregister(&led->cdev);
flush_work(&led->work);
return 0; return 0;
} }
...@@ -760,7 +743,6 @@ static void lm3533_led_shutdown(struct platform_device *pdev) ...@@ -760,7 +743,6 @@ static void lm3533_led_shutdown(struct platform_device *pdev)
lm3533_ctrlbank_disable(&led->cb); lm3533_ctrlbank_disable(&led->cb);
lm3533_led_set(&led->cdev, LED_OFF); /* disable blink */ lm3533_led_set(&led->cdev, LED_OFF); /* disable blink */
flush_work(&led->work);
} }
static struct platform_driver lm3533_led_driver = { static struct platform_driver lm3533_led_driver = {
......
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