Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1186619

[PATCH/RFC 31/51] leds: lm355x: Remove work queue

From Jacek Anaszewski <j.anaszewski@samsung.com>
Newsgroups linux.kernel
Subject [PATCH/RFC 31/51] leds: lm355x: Remove work queue
Date 2015-07-17 11:10 +0200
Message-ID <pN9OA-X0-51@gated-at.bofh.it> (permalink)
References <pN9vb-kw-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Now the core implements the work queue, remove it from the drivers.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Daniel Jeong <daniel.jeong@ti.com>
Cc: G.Shark Jeong <gshark.jeong@gmail.com>
---
 drivers/leds/leds-lm355x.c |   58 +++++++-------------------------------------
 1 file changed, 9 insertions(+), 49 deletions(-)

diff --git a/drivers/leds/leds-lm355x.c b/drivers/leds/leds-lm355x.c
index f5112cb..3504806 100644
--- a/drivers/leds/leds-lm355x.c
+++ b/drivers/leds/leds-lm355x.c
@@ -16,7 +16,6 @@
 #include <linux/platform_device.h>
 #include <linux/fs.h>
 #include <linux/regmap.h>
-#include <linux/workqueue.h>
 #include <linux/platform_data/leds-lm355x.h>
 
 enum lm355x_type {
@@ -59,14 +58,6 @@ struct lm355x_chip_data {
 	struct led_classdev cdev_torch;
 	struct led_classdev cdev_indicator;
 
-	struct work_struct work_flash;
-	struct work_struct work_torch;
-	struct work_struct work_indicator;
-
-	u8 br_flash;
-	u8 br_torch;
-	u8 br_indicator;
-
 	struct lm355x_platform_data *pdata;
 	struct regmap *regmap;
 	struct mutex lock;
@@ -316,15 +307,6 @@ out:
 }
 
 /* torch */
-static void lm355x_deferred_torch_brightness_set(struct work_struct *work)
-{
-	struct lm355x_chip_data *chip =
-	    container_of(work, struct lm355x_chip_data, work_torch);
-
-	mutex_lock(&chip->lock);
-	lm355x_control(chip, chip->br_torch, MODE_TORCH);
-	mutex_unlock(&chip->lock);
-}
 
 static void lm355x_torch_brightness_set(struct led_classdev *cdev,
 					enum led_brightness brightness)
@@ -332,50 +314,35 @@ static void lm355x_torch_brightness_set(struct led_classdev *cdev,
 	struct lm355x_chip_data *chip =
 	    container_of(cdev, struct lm355x_chip_data, cdev_torch);
 
-	chip->br_torch = brightness;
-	schedule_work(&chip->work_torch);
-}
-
-/* flash */
-static void lm355x_deferred_strobe_brightness_set(struct work_struct *work)
-{
-	struct lm355x_chip_data *chip =
-	    container_of(work, struct lm355x_chip_data, work_flash);
-
 	mutex_lock(&chip->lock);
-	lm355x_control(chip, chip->br_flash, MODE_FLASH);
+	lm355x_control(chip, brightness, MODE_TORCH);
 	mutex_unlock(&chip->lock);
 }
 
+/* flash */
+
 static void lm355x_strobe_brightness_set(struct led_classdev *cdev,
 					 enum led_brightness brightness)
 {
 	struct lm355x_chip_data *chip =
 	    container_of(cdev, struct lm355x_chip_data, cdev_flash);
 
-	chip->br_flash = brightness;
-	schedule_work(&chip->work_flash);
-}
-
-/* indicator */
-static void lm355x_deferred_indicator_brightness_set(struct work_struct *work)
-{
-	struct lm355x_chip_data *chip =
-	    container_of(work, struct lm355x_chip_data, work_indicator);
-
 	mutex_lock(&chip->lock);
-	lm355x_control(chip, chip->br_indicator, MODE_INDIC);
+	lm355x_control(chip, brightness, MODE_FLASH);
 	mutex_unlock(&chip->lock);
 }
 
+/* indicator */
+
 static void lm355x_indicator_brightness_set(struct led_classdev *cdev,
 					    enum led_brightness brightness)
 {
 	struct lm355x_chip_data *chip =
 	    container_of(cdev, struct lm355x_chip_data, cdev_indicator);
 
-	chip->br_indicator = brightness;
-	schedule_work(&chip->work_indicator);
+	mutex_lock(&chip->lock);
+	lm355x_control(chip, brightness, MODE_INDIC);
+	mutex_unlock(&chip->lock);
 }
 
 /* indicator pattern only for lm3556*/
@@ -479,7 +446,6 @@ static int lm355x_probe(struct i2c_client *client,
 		goto err_out;
 
 	/* flash */
-	INIT_WORK(&chip->work_flash, lm355x_deferred_strobe_brightness_set);
 	chip->cdev_flash.name = "flash";
 	chip->cdev_flash.max_brightness = 16;
 	chip->cdev_flash.brightness_set = lm355x_strobe_brightness_set;
@@ -489,7 +455,6 @@ static int lm355x_probe(struct i2c_client *client,
 	if (err < 0)
 		goto err_out;
 	/* torch */
-	INIT_WORK(&chip->work_torch, lm355x_deferred_torch_brightness_set);
 	chip->cdev_torch.name = "torch";
 	chip->cdev_torch.max_brightness = 8;
 	chip->cdev_torch.brightness_set = lm355x_torch_brightness_set;
@@ -499,8 +464,6 @@ static int lm355x_probe(struct i2c_client *client,
 	if (err < 0)
 		goto err_create_torch_file;
 	/* indicator */
-	INIT_WORK(&chip->work_indicator,
-		  lm355x_deferred_indicator_brightness_set);
 	chip->cdev_indicator.name = "indicator";
 	if (id->driver_data == CHIP_LM3554)
 		chip->cdev_indicator.max_brightness = 4;
@@ -534,11 +497,8 @@ static int lm355x_remove(struct i2c_client *client)
 
 	regmap_write(chip->regmap, preg[REG_OPMODE].regno, 0);
 	led_classdev_unregister(&chip->cdev_indicator);
-	flush_work(&chip->work_indicator);
 	led_classdev_unregister(&chip->cdev_torch);
-	flush_work(&chip->work_torch);
 	led_classdev_unregister(&chip->cdev_flash);
-	flush_work(&chip->work_flash);
 	dev_info(&client->dev, "%s is removed\n", lm355x_name[chip->type]);
 
 	return 0;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH/RFC v4 00/51] Remove work queues from LED class drivers Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 10:50 +0200
  [PATCH/RFC 32/51] leds: gpio: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 10:50 +0200
  [PATCH/RFC 10/51] leds: bd2802: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 10:50 +0200
  [PATCH/RFC 27/51] leds: mc13783: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 10:50 +0200
  [PATCH/RFC 39/51] leds: ss4200: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 10:50 +0200
  [PATCH/RFC 04/51] leds: Improve setting brightness in a non sleeping  way Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 10:50 +0200
  [PATCH/RFC 44/51] leds: cobalt-qube: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 47/51] leds: locomo: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 42/51] leds: net48xx: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 45/51] leds: fsg: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 48/51] leds: dell: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 37/51] leds: ot200: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 33/51] leds: cobalt-raq: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 49/51] leds: rb532: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 50/51] leds: sunfire: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 38/51] leds: s3c24xx: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 35/51] leds: bcm6358: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 46/51] leds: hp6xx: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 34/51] leds: bcm6328: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 41/51] leds: wrap: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 43/51] leds: asic3: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
  [PATCH/RFC 40/51] leds: versatile: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
    Re: [PATCH/RFC 40/51] leds: versatile: Mark the LED fast Linus Walleij <linus.walleij@linaro.org> - 2015-07-17 15:50 +0200
  [PATCH/RFC 51/51] leds: ipaq-micro: Mark the LED fast Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:00 +0200
    Re: [PATCH/RFC 51/51] leds: ipaq-micro: Mark the LED fast Linus Walleij <linus.walleij@linaro.org> - 2015-07-17 15:50 +0200
  [PATCH/RFC 23/51] leds: da9052: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
  [PATCH/RFC 20/51] leds: pca963x: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
  [PATCH/RFC 25/51] leds: lt3593: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
  [PATCH/RFC 26/51] leds: max8997: Remove unneeded workqueue include Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
  [PATCH/RFC 18/51] leds: lp8860: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
    Re: [PATCH/RFC 18/51] leds: lp8860: Remove work queue Dan Murphy <dmurphy@ti.com> - 2015-07-17 16:00 +0200
  [PATCH/RFC 19/51] leds: pca955x: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
  [PATCH/RFC 28/51] leds: regulator: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
  [PATCH/RFC 15/51] leds: lp3944: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
  [PATCH/RFC 21/51] leds: wm831x: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
    Re: [PATCH/RFC 21/51] leds: wm831x: Remove work queue Mark Brown <broonie@kernel.org> - 2015-07-17 12:10 +0200
  [PATCH/RFC 16/51] leds: lp55xx: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
  [PATCH/RFC 13/51] leds: lm3642: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
  [PATCH/RFC 17/51] leds: lp8788: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
  [PATCH/RFC 31/51] leds: lm355x: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
  [PATCH/RFC 29/51] leds: wm8350: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:10 +0200
    Re: [PATCH/RFC 29/51] leds: wm8350: Remove work queue Mark Brown <broonie@kernel.org> - 2015-07-17 12:10 +0200
  [PATCH/RFC 06/51] media: flash: use led_set_brightness_sync for torch  brightness Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:20 +0200
  [PATCH/RFC 03/51] leds: Add an internal led_set_brightness_nosleep  function Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:20 +0200
  [PATCH/RFC 07/51] leds: tlc591xx: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:20 +0200
  [PATCH/RFC 12/51] leds: lm3533: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:20 +0200
    Re: [PATCH/RFC 12/51] leds: lm3533: Remove work queue Johan Hovold <johan@kernel.org> - 2015-07-17 11:30 +0200
  [PATCH/RFC 01/51] leds: Add led_set_brightness_sync to the public LED  subsystem API Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:20 +0200
    Re: [PATCH/RFC 01/51] leds: Add led_set_brightness_sync to the  public LED subsystem API Pavel Machek <pavel@ucw.cz> - 2015-07-22 09:30 +0200
  [PATCH/RFC 11/51] leds: blinkm: Remove work queue Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:20 +0200
  [PATCH/RFC 05/51] leds: Drivers shouldn't enforce SYNC/ASYNC  brightness setting Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-07-17 11:20 +0200

csiph-web