leds: lp8860: Remove work queue
authorAndrew Lunn <andrew@lunn.ch>
Thu, 20 Aug 2015 10:28:26 +0000 (12:28 +0200)
committerJacek Anaszewski <j.anaszewski@samsung.com>
Mon, 4 Jan 2016 08:57:33 +0000 (09:57 +0100)
Now the core implements the work queue, remove it from the drivers,
and switch to using brightness_set_blocking op.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
drivers/leds/leds-lp8860.c

index 79f084354e679930f1efa36f30745e867ed72b27..3e70775a2d54eaab717f5e61a4f3580bd28a492d 100644 (file)
 /**
  * struct lp8860_led -
  * @lock - Lock for reading/writing the device
- * @work - Work item used to off load the brightness register writes
  * @client - Pointer to the I2C client
  * @led_dev - led class device pointer
  * @regmap - Devices register map
  * @eeprom_regmap - EEPROM register map
  * @enable_gpio - VDDIO/EN gpio to enable communication interface
  * @regulator - LED supply regulator pointer
- * @brightness - Current brightness value requested
  * @label - LED label
 **/
 struct lp8860_led {
        struct mutex lock;
-       struct work_struct work;
        struct i2c_client *client;
        struct led_classdev led_dev;
        struct regmap *regmap;
        struct regmap *eeprom_regmap;
        struct gpio_desc *enable_gpio;
        struct regulator *regulator;
-       enum led_brightness brightness;
        const char *label;
 };
 
@@ -212,11 +208,13 @@ out:
        return ret;
 }
 
-static void lp8860_led_brightness_work(struct work_struct *work)
+static int lp8860_brightness_set(struct led_classdev *led_cdev,
+                               enum led_brightness brt_val)
 {
-       struct lp8860_led *led = container_of(work, struct lp8860_led, work);
+       struct lp8860_led *led =
+                       container_of(led_cdev, struct lp8860_led, led_dev);
+       int disp_brightness = brt_val * 255;
        int ret;
-       int disp_brightness = led->brightness * 255;
 
        mutex_lock(&led->lock);
 
@@ -241,16 +239,7 @@ static void lp8860_led_brightness_work(struct work_struct *work)
        }
 out:
        mutex_unlock(&led->lock);
-}
-
-static void lp8860_brightness_set(struct led_classdev *led_cdev,
-                               enum led_brightness brt_val)
-{
-       struct lp8860_led *led =
-                       container_of(led_cdev, struct lp8860_led, led_dev);
-
-       led->brightness = brt_val;
-       schedule_work(&led->work);
+       return ret;
 }
 
 static int lp8860_init(struct lp8860_led *led)
@@ -406,10 +395,9 @@ static int lp8860_probe(struct i2c_client *client,
        led->client = client;
        led->led_dev.name = led->label;
        led->led_dev.max_brightness = LED_FULL;
-       led->led_dev.brightness_set = lp8860_brightness_set;
+       led->led_dev.brightness_set_blocking = lp8860_brightness_set;
 
        mutex_init(&led->lock);
-       INIT_WORK(&led->work, lp8860_led_brightness_work);
 
        i2c_set_clientdata(client, led);
 
@@ -448,7 +436,6 @@ static int lp8860_remove(struct i2c_client *client)
        int ret;
 
        led_classdev_unregister(&led->led_dev);
-       cancel_work_sync(&led->work);
 
        if (led->enable_gpio)
                gpiod_direction_output(led->enable_gpio, 0);