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


Groups > linux.kernel > #1186573 > unrolled thread

[PATCH/RFC v4 00/51] Remove work queues from LED class drivers

Started byJacek Anaszewski <j.anaszewski@samsung.com>
First post2015-07-17 10:50 +0200
Last post2015-07-17 11:20 +0200
Articles 20 on this page of 51 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [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

Page 2 of 3 — ← Prev page 1 [2] 3  Next page →


#1186596 — [PATCH/RFC 43/51] leds: asic3: Mark the LED fast

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:00 +0200
Subject[PATCH/RFC 43/51] leds: asic3: Mark the LED fast
Message-ID<pN9ET-w9-35@gated-at.bofh.it>
In reply to#1186573
The driver neither sleeps nor uses delays in its brightness_set
op. Mark it fast then.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Paul Parsons <lost.distance@yahoo.com>
---
 drivers/leds/leds-asic3.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/leds/leds-asic3.c b/drivers/leds/leds-asic3.c
index 1b71eac..1cf542c 100644
--- a/drivers/leds/leds-asic3.c
+++ b/drivers/leds/leds-asic3.c
@@ -112,6 +112,7 @@ static int asic3_led_probe(struct platform_device *pdev)
 	led->cdev->brightness_set = brightness_set;
 	led->cdev->blink_set = blink_set;
 	led->cdev->default_trigger = led->default_trigger;
+	led->cdev->flags |= LED_BRIGHTNESS_FAST;
 
 	ret = led_classdev_register(&pdev->dev, led->cdev);
 	if (ret < 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/

[toc] | [prev] | [next] | [standalone]


#1186597 — [PATCH/RFC 40/51] leds: versatile: Mark the LED fast

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:00 +0200
Subject[PATCH/RFC 40/51] leds: versatile: Mark the LED fast
Message-ID<pN9ET-w9-41@gated-at.bofh.it>
In reply to#1186573
The driver neither sleeps nor uses delays in its brightness_set
op. Mark it fast then.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/leds/leds-versatile.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/leds/leds-versatile.c b/drivers/leds/leds-versatile.c
index 8055302..46ba28f 100644
--- a/drivers/leds/leds-versatile.c
+++ b/drivers/leds/leds-versatile.c
@@ -85,6 +85,7 @@ static int versatile_leds_probe(struct platform_device *dev)
 		led->cdev.brightness_set = versatile_led_set;
 		led->cdev.brightness_get = versatile_led_get;
 		led->cdev.default_trigger = versatile_leds[i].trigger;
+		led->cdev.flags |= LED_BRIGHTNESS_FAST;
 		led->mask = BIT(i);
 
 		if (led_classdev_register(NULL, &led->cdev) < 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/

[toc] | [prev] | [next] | [standalone]


#1186834 — Re: [PATCH/RFC 40/51] leds: versatile: Mark the LED fast

FromLinus Walleij <linus.walleij@linaro.org>
Date2015-07-17 15:50 +0200
SubjectRe: [PATCH/RFC 40/51] leds: versatile: Mark the LED fast
Message-ID<pNebw-73F-3@gated-at.bofh.it>
In reply to#1186597
On Fri, Jul 17, 2015 at 10:47 AM, Jacek Anaszewski
<j.anaszewski@samsung.com> wrote:

> The driver neither sleeps nor uses delays in its brightness_set
> op. Mark it fast then.
>
> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
--
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/

[toc] | [prev] | [next] | [standalone]


#1186598 — [PATCH/RFC 51/51] leds: ipaq-micro: Mark the LED fast

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:00 +0200
Subject[PATCH/RFC 51/51] leds: ipaq-micro: Mark the LED fast
Message-ID<pN9ET-w9-43@gated-at.bofh.it>
In reply to#1186573
The driver neither sleeps nor uses delays in its brightness_set
op. Mark it fast then.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/leds/leds-ipaq-micro.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-ipaq-micro.c b/drivers/leds/leds-ipaq-micro.c
index 3776f51..3ac9fa6 100644
--- a/drivers/leds/leds-ipaq-micro.c
+++ b/drivers/leds/leds-ipaq-micro.c
@@ -104,7 +104,7 @@ static struct led_classdev micro_led = {
 	.name			= "led-ipaq-micro",
 	.brightness_set		= micro_leds_brightness_set,
 	.blink_set		= micro_leds_blink_set,
-	.flags			= LED_CORE_SUSPENDRESUME,
+	.flags			= LED_CORE_SUSPENDRESUME | LED_BRIGHTNESS_FAST,
 };
 
 static int micro_leds_probe(struct platform_device *pdev)
-- 
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/

[toc] | [prev] | [next] | [standalone]


#1186843 — Re: [PATCH/RFC 51/51] leds: ipaq-micro: Mark the LED fast

FromLinus Walleij <linus.walleij@linaro.org>
Date2015-07-17 15:50 +0200
SubjectRe: [PATCH/RFC 51/51] leds: ipaq-micro: Mark the LED fast
Message-ID<pNebw-73F-27@gated-at.bofh.it>
In reply to#1186598
On Fri, Jul 17, 2015 at 10:47 AM, Jacek Anaszewski
<j.anaszewski@samsung.com> wrote:

> The driver neither sleeps nor uses delays in its brightness_set
> op. Mark it fast then.
>
> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>

NACK. The functions called in drivers/mfd/ipaq-micro.c are
not fast, this need to be dropped.

Yours,
Linus Walleij
--
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/

[toc] | [prev] | [next] | [standalone]


#1186599 — [PATCH/RFC 23/51] leds: da9052: Remove work queue

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 23/51] leds: da9052: Remove work queue
Message-ID<pN9Ox-X0-1@gated-at.bofh.it>
In reply to#1186573
From: Andrew Lunn <andrew@lunn.ch>

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

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/leds/leds-da9052.c |   35 ++++++++++-------------------------
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/drivers/leds/leds-da9052.c b/drivers/leds/leds-da9052.c
index 28291b6..e4dc010 100644
--- a/drivers/leds/leds-da9052.c
+++ b/drivers/leds/leds-da9052.c
@@ -16,7 +16,6 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/leds.h>
-#include <linux/workqueue.h>
 #include <linux/slab.h>
 
 #include <linux/mfd/da9052/reg.h>
@@ -32,11 +31,9 @@
 
 struct da9052_led {
 	struct led_classdev cdev;
-	struct work_struct work;
 	struct da9052 *da9052;
 	unsigned char led_index;
 	unsigned char id;
-	int brightness;
 };
 
 static unsigned char led_reg[] = {
@@ -44,12 +41,13 @@ static unsigned char led_reg[] = {
 	DA9052_LED_CONT_5_REG,
 };
 
-static int da9052_set_led_brightness(struct da9052_led *led)
+static int da9052_set_led_brightness(struct da9052_led *led,
+				     enum led_brightness brightness)
 {
 	u8 val;
 	int error;
 
-	val = (led->brightness & 0x7f) | DA9052_LED_CONT_DIM;
+	val = (brightness & 0x7f) | DA9052_LED_CONT_DIM;
 
 	error = da9052_reg_write(led->da9052, led_reg[led->led_index], val);
 	if (error < 0)
@@ -58,21 +56,13 @@ static int da9052_set_led_brightness(struct da9052_led *led)
 	return error;
 }
 
-static void da9052_led_work(struct work_struct *work)
-{
-	struct da9052_led *led = container_of(work, struct da9052_led, work);
-
-	da9052_set_led_brightness(led);
-}
-
 static void da9052_led_set(struct led_classdev *led_cdev,
 			   enum led_brightness value)
 {
-	struct da9052_led *led;
+	struct da9052_led *led =
+			container_of(led_cdev, struct da9052_led, cdev);
 
-	led = container_of(led_cdev, struct da9052_led, cdev);
-	led->brightness = value;
-	schedule_work(&led->work);
+	da9052_set_led_brightness(led, value);
 }
 
 static int da9052_configure_leds(struct da9052 *da9052)
@@ -136,10 +126,8 @@ static int da9052_led_probe(struct platform_device *pdev)
 		led[i].cdev.brightness_set = da9052_led_set;
 		led[i].cdev.brightness = LED_OFF;
 		led[i].cdev.max_brightness = DA9052_MAX_BRIGHTNESS;
-		led[i].brightness = LED_OFF;
 		led[i].led_index = pled->leds[i].flags;
 		led[i].da9052 = dev_get_drvdata(pdev->dev.parent);
-		INIT_WORK(&led[i].work, da9052_led_work);
 
 		error = led_classdev_register(pdev->dev.parent, &led[i].cdev);
 		if (error) {
@@ -148,7 +136,8 @@ static int da9052_led_probe(struct platform_device *pdev)
 			goto err_register;
 		}
 
-		error = da9052_set_led_brightness(&led[i]);
+		error = da9052_set_led_brightness(&led[i],
+						  led[i].cdev.brightness);
 		if (error) {
 			dev_err(&pdev->dev, "Unable to init led %d\n",
 				led[i].led_index);
@@ -166,10 +155,8 @@ static int da9052_led_probe(struct platform_device *pdev)
 	return 0;
 
 err_register:
-	for (i = i - 1; i >= 0; i--) {
+	for (i = i - 1; i >= 0; i--)
 		led_classdev_unregister(&led[i].cdev);
-		cancel_work_sync(&led[i].work);
-	}
 err:
 	return error;
 }
@@ -187,10 +174,8 @@ static int da9052_led_remove(struct platform_device *pdev)
 	pled = pdata->pled;
 
 	for (i = 0; i < pled->num_leds; i++) {
-		led[i].brightness = 0;
-		da9052_set_led_brightness(&led[i]);
+		da9052_set_led_brightness(&led[i], LED_OFF);
 		led_classdev_unregister(&led[i].cdev);
-		cancel_work_sync(&led[i].work);
 	}
 
 	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/

[toc] | [prev] | [next] | [standalone]


#1186600 — [PATCH/RFC 20/51] leds: pca963x: Remove work queue

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 20/51] leds: pca963x: Remove work queue
Message-ID<pN9Ox-X0-3@gated-at.bofh.it>
In reply to#1186573
From: Andrew Lunn <andrew@lunn.ch>

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

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Peter Meerwald <p.meerwald@bct-electronic.com>
Cc: Ricardo Ribalda <ricardo.ribalda@gmail.com>
---
 drivers/leds/leds-pca963x.c |   56 +++++++------------------------------------
 1 file changed, 8 insertions(+), 48 deletions(-)

diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c
index bee3e1a..92819c5 100644
--- a/drivers/leds/leds-pca963x.c
+++ b/drivers/leds/leds-pca963x.c
@@ -32,7 +32,6 @@
 #include <linux/leds.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
-#include <linux/workqueue.h>
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/platform_data/leds-pca963x.h>
@@ -96,11 +95,6 @@ static const struct i2c_device_id pca963x_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, pca963x_id);
 
-enum pca963x_cmd {
-	BRIGHTNESS_SET,
-	BLINK_SET,
-};
-
 struct pca963x_led;
 
 struct pca963x {
@@ -112,17 +106,16 @@ struct pca963x {
 
 struct pca963x_led {
 	struct pca963x *chip;
-	struct work_struct work;
 	enum led_brightness brightness;
 	struct led_classdev led_cdev;
 	int led_num; /* 0 .. 15 potentially */
-	enum pca963x_cmd cmd;
 	char name[32];
 	u8 gdc;
 	u8 gfrq;
 };
 
-static void pca963x_brightness_work(struct pca963x_led *pca963x)
+static void pca963x_brightness(struct pca963x_led *pca963x,
+			       enum led_brightness brightness)
 {
 	u8 ledout_addr = pca963x->chip->chipdef->ledout_base
 		+ (pca963x->led_num / 4);
@@ -132,7 +125,7 @@ static void pca963x_brightness_work(struct pca963x_led *pca963x)
 
 	mutex_lock(&pca963x->chip->mutex);
 	ledout = i2c_smbus_read_byte_data(pca963x->chip->client, ledout_addr);
-	switch (pca963x->brightness) {
+	switch (brightness) {
 	case LED_FULL:
 		i2c_smbus_write_byte_data(pca963x->chip->client, ledout_addr,
 			(ledout & ~mask) | (PCA963X_LED_ON << shift));
@@ -152,7 +145,7 @@ static void pca963x_brightness_work(struct pca963x_led *pca963x)
 	mutex_unlock(&pca963x->chip->mutex);
 }
 
-static void pca963x_blink_work(struct pca963x_led *pca963x)
+static void pca963x_blink(struct pca963x_led *pca963x)
 {
 	u8 ledout_addr = pca963x->chip->chipdef->ledout_base +
 		(pca963x->led_num / 4);
@@ -180,21 +173,6 @@ static void pca963x_blink_work(struct pca963x_led *pca963x)
 	mutex_unlock(&pca963x->chip->mutex);
 }
 
-static void pca963x_work(struct work_struct *work)
-{
-	struct pca963x_led *pca963x = container_of(work,
-		struct pca963x_led, work);
-
-	switch (pca963x->cmd) {
-	case BRIGHTNESS_SET:
-		pca963x_brightness_work(pca963x);
-		break;
-	case BLINK_SET:
-		pca963x_blink_work(pca963x);
-		break;
-	}
-}
-
 static void pca963x_led_set(struct led_classdev *led_cdev,
 	enum led_brightness value)
 {
@@ -202,14 +180,7 @@ static void pca963x_led_set(struct led_classdev *led_cdev,
 
 	pca963x = container_of(led_cdev, struct pca963x_led, led_cdev);
 
-	pca963x->cmd = BRIGHTNESS_SET;
-	pca963x->brightness = value;
-
-	/*
-	 * Must use workqueue for the actual I/O since I2C operations
-	 * can sleep.
-	 */
-	schedule_work(&pca963x->work);
+	pca963x_brightness(pca963x, value);
 }
 
 static int pca963x_blink_set(struct led_classdev *led_cdev,
@@ -254,15 +225,10 @@ static int pca963x_blink_set(struct led_classdev *led_cdev,
 	 */
 	gfrq = (period * 24 / 1000) - 1;
 
-	pca963x->cmd = BLINK_SET;
 	pca963x->gdc = gdc;
 	pca963x->gfrq = gfrq;
 
-	/*
-	 * Must use workqueue for the actual I/O since I2C operations
-	 * can sleep.
-	 */
-	schedule_work(&pca963x->work);
+	pca963x_blink(pca963x);
 
 	*delay_on = time_on;
 	*delay_off = time_off;
@@ -413,8 +379,6 @@ static int pca963x_probe(struct i2c_client *client,
 		if (pdata && pdata->blink_type == PCA963X_HW_BLINK)
 			pca963x[i].led_cdev.blink_set = pca963x_blink_set;
 
-		INIT_WORK(&pca963x[i].work, pca963x_work);
-
 		err = led_classdev_register(&client->dev, &pca963x[i].led_cdev);
 		if (err < 0)
 			goto exit;
@@ -434,10 +398,8 @@ static int pca963x_probe(struct i2c_client *client,
 	return 0;
 
 exit:
-	while (i--) {
+	while (i--)
 		led_classdev_unregister(&pca963x[i].led_cdev);
-		cancel_work_sync(&pca963x[i].work);
-	}
 
 	return err;
 }
@@ -447,10 +409,8 @@ static int pca963x_remove(struct i2c_client *client)
 	struct pca963x *pca963x = i2c_get_clientdata(client);
 	int i;
 
-	for (i = 0; i < pca963x->chipdef->n_leds; i++) {
+	for (i = 0; i < pca963x->chipdef->n_leds; i++)
 		led_classdev_unregister(&pca963x->leds[i].led_cdev);
-		cancel_work_sync(&pca963x->leds[i].work);
-	}
 
 	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/

[toc] | [prev] | [next] | [standalone]


#1186601 — [PATCH/RFC 25/51] leds: lt3593: Remove work queue

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 25/51] leds: lt3593: Remove work queue
Message-ID<pN9Ox-X0-5@gated-at.bofh.it>
In reply to#1186573
From: Andrew Lunn <andrew@lunn.ch>

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

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Cc: Daniel Mack <daniel@caiaq.de>
---
 drivers/leds/leds-lt3593.c |   27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c
index 9f41124..5e456ee 100644
--- a/drivers/leds/leds-lt3593.c
+++ b/drivers/leds/leds-lt3593.c
@@ -19,7 +19,6 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/leds.h>
-#include <linux/workqueue.h>
 #include <linux/delay.h>
 #include <linux/gpio.h>
 #include <linux/slab.h>
@@ -28,15 +27,14 @@
 struct lt3593_led_data {
 	struct led_classdev cdev;
 	unsigned gpio;
-	struct work_struct work;
-	u8 new_level;
 };
 
-static void lt3593_led_work(struct work_struct *work)
+static void lt3593_led_set(struct led_classdev *led_cdev,
+			   enum led_brightness value)
 {
-	int pulses;
 	struct lt3593_led_data *led_dat =
-		container_of(work, struct lt3593_led_data, work);
+		container_of(led_cdev, struct lt3593_led_data, cdev);
+	int pulses;
 
 	/*
 	 * The LT3593 resets its internal current level register to the maximum
@@ -47,12 +45,12 @@ static void lt3593_led_work(struct work_struct *work)
 	 * applied is to the output driver.
 	 */
 
-	if (led_dat->new_level == 0) {
+	if (value == 0) {
 		gpio_set_value_cansleep(led_dat->gpio, 0);
 		return;
 	}
 
-	pulses = 32 - (led_dat->new_level * 32) / 255;
+	pulses = 32 - (value * 32) / 255;
 
 	if (pulses == 0) {
 		gpio_set_value_cansleep(led_dat->gpio, 0);
@@ -71,16 +69,6 @@ static void lt3593_led_work(struct work_struct *work)
 	}
 }
 
-static void lt3593_led_set(struct led_classdev *led_cdev,
-	enum led_brightness value)
-{
-	struct lt3593_led_data *led_dat =
-		container_of(led_cdev, struct lt3593_led_data, cdev);
-
-	led_dat->new_level = value;
-	schedule_work(&led_dat->work);
-}
-
 static int create_lt3593_led(const struct gpio_led *template,
 	struct lt3593_led_data *led_dat, struct device *parent)
 {
@@ -111,8 +99,6 @@ static int create_lt3593_led(const struct gpio_led *template,
 	if (ret < 0)
 		return ret;
 
-	INIT_WORK(&led_dat->work, lt3593_led_work);
-
 	ret = led_classdev_register(parent, &led_dat->cdev);
 	if (ret < 0)
 		return ret;
@@ -129,7 +115,6 @@ static void delete_lt3593_led(struct lt3593_led_data *led)
 		return;
 
 	led_classdev_unregister(&led->cdev);
-	cancel_work_sync(&led->work);
 }
 
 static int lt3593_led_probe(struct platform_device *pdev)
-- 
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/

[toc] | [prev] | [next] | [standalone]


#1186602 — [PATCH/RFC 26/51] leds: max8997: Remove unneeded workqueue include

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 26/51] leds: max8997: Remove unneeded workqueue include
Message-ID<pN9Ox-X0-7@gated-at.bofh.it>
In reply to#1186573
From: Andrew Lunn <andrew@lunn.ch>

Work queues are not used in this driver, so remove the include.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/leds/leds-max8997.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/leds/leds-max8997.c b/drivers/leds/leds-max8997.c
index c592aa5..01b45906 100644
--- a/drivers/leds/leds-max8997.c
+++ b/drivers/leds/leds-max8997.c
@@ -13,7 +13,6 @@
 #include <linux/module.h>
 #include <linux/err.h>
 #include <linux/slab.h>
-#include <linux/workqueue.h>
 #include <linux/leds.h>
 #include <linux/mfd/max8997.h>
 #include <linux/mfd/max8997-private.h>
-- 
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/

[toc] | [prev] | [next] | [standalone]


#1186604 — [PATCH/RFC 18/51] leds: lp8860: Remove work queue

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 18/51] leds: lp8860: Remove work queue
Message-ID<pN9Ox-X0-11@gated-at.bofh.it>
In reply to#1186573
From: Andrew Lunn <andrew@lunn.ch>

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

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Cc: Dan Murphy <dmurphy@ti.com>
---
 drivers/leds/leds-lp8860.c |   24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c
index 8c2b7fb..40e0ed8 100644
--- a/drivers/leds/leds-lp8860.c
+++ b/drivers/leds/leds-lp8860.c
@@ -91,26 +91,22 @@
 /**
  * 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 void 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);
 
@@ -243,16 +241,6 @@ 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);
-}
-
 static int lp8860_init(struct lp8860_led *led)
 {
 	unsigned int read_buf;
@@ -409,7 +397,6 @@ static int lp8860_probe(struct i2c_client *client,
 	led->led_dev.brightness_set = lp8860_brightness_set;
 
 	mutex_init(&led->lock);
-	INIT_WORK(&led->work, lp8860_led_brightness_work);
 
 	i2c_set_clientdata(client, led);
 
@@ -448,7 +435,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);
-- 
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/

[toc] | [prev] | [next] | [standalone]


#1186850 — Re: [PATCH/RFC 18/51] leds: lp8860: Remove work queue

FromDan Murphy <dmurphy@ti.com>
Date2015-07-17 16:00 +0200
SubjectRe: [PATCH/RFC 18/51] leds: lp8860: Remove work queue
Message-ID<pNelc-7eZ-19@gated-at.bofh.it>
In reply to#1186604
On 07/17/2015 03:47 AM, Jacek Anaszewski wrote:
> From: Andrew Lunn <andrew@lunn.ch>
>
> Now the core implements the work queue, remove it from the drivers.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> Cc: Dan Murphy <dmurphy@ti.com>
> ---
>  drivers/leds/leds-lp8860.c |   24 +++++-------------------
>  1 file changed, 5 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c
> index 8c2b7fb..40e0ed8 100644
> --- a/drivers/leds/leds-lp8860.c
> +++ b/drivers/leds/leds-lp8860.c
> @@ -91,26 +91,22 @@
>  /**
>   * 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 void 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);
>  
> @@ -243,16 +241,6 @@ 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);
> -}
> -
>  static int lp8860_init(struct lp8860_led *led)
>  {
>  	unsigned int read_buf;
> @@ -409,7 +397,6 @@ static int lp8860_probe(struct i2c_client *client,
>  	led->led_dev.brightness_set = lp8860_brightness_set;
>  
>  	mutex_init(&led->lock);
> -	INIT_WORK(&led->work, lp8860_led_brightness_work);
>  
>  	i2c_set_clientdata(client, led);
>  
> @@ -448,7 +435,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);

Thanks!

Acked-by: Dan Murphy <dmurphy@ti.com>


-- 
------------------
Dan Murphy

--
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/

[toc] | [prev] | [next] | [standalone]


#1186605 — [PATCH/RFC 19/51] leds: pca955x: Remove work queue

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 19/51] leds: pca955x: Remove work queue
Message-ID<pN9Oy-X0-13@gated-at.bofh.it>
In reply to#1186573
From: Andrew Lunn <andrew@lunn.ch>

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

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Cc: Nate Case <ncase@xes-inc.com>
---
 drivers/leds/leds-pca955x.c |   37 +++++++------------------------------
 1 file changed, 7 insertions(+), 30 deletions(-)

diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index c3a08b6..3150d59 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -47,7 +47,6 @@
 #include <linux/leds.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
-#include <linux/workqueue.h>
 #include <linux/slab.h>
 
 /* LED select registers determine the source that drives LED outputs */
@@ -110,8 +109,6 @@ struct pca955x {
 
 struct pca955x_led {
 	struct pca955x	*pca955x;
-	struct work_struct	work;
-	enum led_brightness	brightness;
 	struct led_classdev	led_cdev;
 	int			led_num;	/* 0 .. 15 potentially */
 	char			name[32];
@@ -193,7 +190,8 @@ static u8 pca955x_read_ls(struct i2c_client *client, int n)
 		pca95xx_num_input_regs(pca955x->chipdef->bits) + 4 + n);
 }
 
-static void pca955x_led_work(struct work_struct *work)
+static void pca955x_led_set(struct led_classdev *led_cdev,
+			    enum led_brightness value)
 {
 	struct pca955x_led *pca955x_led;
 	struct pca955x *pca955x;
@@ -201,7 +199,7 @@ static void pca955x_led_work(struct work_struct *work)
 	int chip_ls;	/* which LSx to use (0-3 potentially) */
 	int ls_led;	/* which set of bits within LSx to use (0-3) */
 
-	pca955x_led = container_of(work, struct pca955x_led, work);
+	pca955x_led = container_of(led_cdev, struct pca955x_led, led_cdev);
 	pca955x = pca955x_led->pca955x;
 
 	chip_ls = pca955x_led->led_num / 4;
@@ -211,7 +209,7 @@ static void pca955x_led_work(struct work_struct *work)
 
 	ls = pca955x_read_ls(pca955x->client, chip_ls);
 
-	switch (pca955x_led->brightness) {
+	switch (value) {
 	case LED_FULL:
 		ls = pca955x_ledsel(ls, ls_led, PCA955X_LS_LED_ON);
 		break;
@@ -230,7 +228,7 @@ static void pca955x_led_work(struct work_struct *work)
 		 * just turning off for all other values.
 		 */
 		pca955x_write_pwm(pca955x->client, 1,
-				255 - pca955x_led->brightness);
+				255 - value);
 		ls = pca955x_ledsel(ls, ls_led, PCA955X_LS_BLINK1);
 		break;
 	}
@@ -240,21 +238,6 @@ static void pca955x_led_work(struct work_struct *work)
 	mutex_unlock(&pca955x->lock);
 }
 
-static void pca955x_led_set(struct led_classdev *led_cdev, enum led_brightness value)
-{
-	struct pca955x_led *pca955x;
-
-	pca955x = container_of(led_cdev, struct pca955x_led, led_cdev);
-
-	pca955x->brightness = value;
-
-	/*
-	 * Must use workqueue for the actual I/O since I2C operations
-	 * can sleep.
-	 */
-	schedule_work(&pca955x->work);
-}
-
 static int pca955x_probe(struct i2c_client *client,
 					const struct i2c_device_id *id)
 {
@@ -330,8 +313,6 @@ static int pca955x_probe(struct i2c_client *client,
 		pca955x_led->led_cdev.name = pca955x_led->name;
 		pca955x_led->led_cdev.brightness_set = pca955x_led_set;
 
-		INIT_WORK(&pca955x_led->work, pca955x_led_work);
-
 		err = led_classdev_register(&client->dev,
 					&pca955x_led->led_cdev);
 		if (err < 0)
@@ -355,10 +336,8 @@ static int pca955x_probe(struct i2c_client *client,
 	return 0;
 
 exit:
-	while (i--) {
+	while (i--)
 		led_classdev_unregister(&pca955x->leds[i].led_cdev);
-		cancel_work_sync(&pca955x->leds[i].work);
-	}
 
 	return err;
 }
@@ -368,10 +347,8 @@ static int pca955x_remove(struct i2c_client *client)
 	struct pca955x *pca955x = i2c_get_clientdata(client);
 	int i;
 
-	for (i = 0; i < pca955x->chipdef->bits; i++) {
+	for (i = 0; i < pca955x->chipdef->bits; i++)
 		led_classdev_unregister(&pca955x->leds[i].led_cdev);
-		cancel_work_sync(&pca955x->leds[i].work);
-	}
 
 	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/

[toc] | [prev] | [next] | [standalone]


#1186609 — [PATCH/RFC 28/51] leds: regulator: Remove work queue

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 28/51] leds: regulator: Remove work queue
Message-ID<pN9Oz-X0-23@gated-at.bofh.it>
In reply to#1186573
Now the core implements the work queue, remove it from the drivers.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Cc: Antonio Ospite <ospite@studenti.unina.it>
---
 drivers/leds/leds-regulator.c |   34 +++++++++-------------------------
 1 file changed, 9 insertions(+), 25 deletions(-)

diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c
index ffc2139..87615e1 100644
--- a/drivers/leds/leds-regulator.c
+++ b/drivers/leds/leds-regulator.c
@@ -14,7 +14,6 @@
 #include <linux/module.h>
 #include <linux/err.h>
 #include <linux/slab.h>
-#include <linux/workqueue.h>
 #include <linux/leds.h>
 #include <linux/leds-regulator.h>
 #include <linux/platform_device.h>
@@ -25,10 +24,8 @@
 
 struct regulator_led {
 	struct led_classdev cdev;
-	enum led_brightness value;
 	int enabled;
 	struct mutex mutex;
-	struct work_struct work;
 
 	struct regulator *vcc;
 };
@@ -94,22 +91,23 @@ static void regulator_led_disable(struct regulator_led *led)
 	led->enabled = 0;
 }
 
-static void regulator_led_set_value(struct regulator_led *led)
+static void regulator_led_set_value(struct regulator_led *led,
+				    enum led_brightness value)
 {
 	int voltage;
 	int ret;
 
 	mutex_lock(&led->mutex);
 
-	if (led->value == LED_OFF) {
+	if (value == LED_OFF) {
 		regulator_led_disable(led);
 		goto out;
 	}
 
 	if (led->cdev.max_brightness > 1) {
-		voltage = led_regulator_get_voltage(led->vcc, led->value);
+		voltage = led_regulator_get_voltage(led->vcc, value);
 		dev_dbg(led->cdev.dev, "brightness: %d voltage: %d\n",
-				led->value, voltage);
+				value, voltage);
 
 		ret = regulator_set_voltage(led->vcc, voltage, voltage);
 		if (ret != 0)
@@ -123,21 +121,12 @@ out:
 	mutex_unlock(&led->mutex);
 }
 
-static void led_work(struct work_struct *work)
-{
-	struct regulator_led *led;
-
-	led = container_of(work, struct regulator_led, work);
-	regulator_led_set_value(led);
-}
-
 static void regulator_led_brightness_set(struct led_classdev *led_cdev,
 			   enum led_brightness value)
 {
 	struct regulator_led *led = to_regulator_led(led_cdev);
 
-	led->value = value;
-	schedule_work(&led->work);
+	regulator_led_set_value(led, value);
 }
 
 static int regulator_led_probe(struct platform_device *pdev)
@@ -169,7 +158,6 @@ static int regulator_led_probe(struct platform_device *pdev)
 				pdata->brightness);
 		return -EINVAL;
 	}
-	led->value = pdata->brightness;
 
 	led->cdev.brightness_set = regulator_led_brightness_set;
 	led->cdev.name = pdata->name;
@@ -181,21 +169,18 @@ static int regulator_led_probe(struct platform_device *pdev)
 		led->enabled = 1;
 
 	mutex_init(&led->mutex);
-	INIT_WORK(&led->work, led_work);
 
 	platform_set_drvdata(pdev, led);
 
 	ret = led_classdev_register(&pdev->dev, &led->cdev);
-	if (ret < 0) {
-		cancel_work_sync(&led->work);
+	if (ret < 0)
 		return ret;
-	}
 
 	/* to expose the default value to userspace */
-	led->cdev.brightness = led->value;
+	led->cdev.brightness = pdata->brightness;
 
 	/* Set the default led status */
-	regulator_led_set_value(led);
+	regulator_led_set_value(led, led->cdev.brightness);
 
 	return 0;
 }
@@ -205,7 +190,6 @@ static int regulator_led_remove(struct platform_device *pdev)
 	struct regulator_led *led = platform_get_drvdata(pdev);
 
 	led_classdev_unregister(&led->cdev);
-	cancel_work_sync(&led->work);
 	regulator_led_disable(led);
 	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/

[toc] | [prev] | [next] | [standalone]


#1186610 — [PATCH/RFC 15/51] leds: lp3944: Remove work queue

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 15/51] leds: lp3944: Remove work queue
Message-ID<pN9Oz-X0-25@gated-at.bofh.it>
In reply to#1186573
From: Andrew Lunn <andrew@lunn.ch>

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

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Cc: Antonio Ospite <ospite@studenti.unina.it>
---
 drivers/leds/leds-lp3944.c |   15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/leds/leds-lp3944.c b/drivers/leds/leds-lp3944.c
index 53144fb..c5cb4b9 100644
--- a/drivers/leds/leds-lp3944.c
+++ b/drivers/leds/leds-lp3944.c
@@ -31,7 +31,6 @@
 #include <linux/slab.h>
 #include <linux/leds.h>
 #include <linux/mutex.h>
-#include <linux/workqueue.h>
 #include <linux/leds-lp3944.h>
 
 /* Read Only Registers */
@@ -71,7 +70,6 @@ struct lp3944_led_data {
 	enum lp3944_status status;
 	struct led_classdev ldev;
 	struct i2c_client *client;
-	struct work_struct work;
 };
 
 struct lp3944_data {
@@ -276,7 +274,7 @@ static int lp3944_led_set_blink(struct led_classdev *led_cdev,
 		__func__);
 
 	led->status = LP3944_LED_STATUS_DIM0;
-	schedule_work(&led->work);
+	lp3944_led_set(led, led->status);
 
 	return 0;
 }
@@ -290,14 +288,6 @@ static void lp3944_led_set_brightness(struct led_classdev *led_cdev,
 		__func__, led_cdev->name, brightness);
 
 	led->status = !!brightness;
-	schedule_work(&led->work);
-}
-
-static void lp3944_led_work(struct work_struct *work)
-{
-	struct lp3944_led_data *led;
-
-	led = container_of(work, struct lp3944_led_data, work);
 	lp3944_led_set(led, led->status);
 }
 
@@ -325,7 +315,6 @@ static int lp3944_configure(struct i2c_client *client,
 			led->ldev.blink_set = lp3944_led_set_blink;
 			led->ldev.flags = LED_CORE_SUSPENDRESUME;
 
-			INIT_WORK(&led->work, lp3944_led_work);
 			err = led_classdev_register(&client->dev, &led->ldev);
 			if (err < 0) {
 				dev_err(&client->dev,
@@ -364,7 +353,6 @@ exit:
 			case LP3944_LED_TYPE_LED:
 			case LP3944_LED_TYPE_LED_INVERTED:
 				led_classdev_unregister(&data->leds[i].ldev);
-				cancel_work_sync(&data->leds[i].work);
 				break;
 
 			case LP3944_LED_TYPE_NONE:
@@ -424,7 +412,6 @@ static int lp3944_remove(struct i2c_client *client)
 		case LP3944_LED_TYPE_LED:
 		case LP3944_LED_TYPE_LED_INVERTED:
 			led_classdev_unregister(&data->leds[i].ldev);
-			cancel_work_sync(&data->leds[i].work);
 			break;
 
 		case LP3944_LED_TYPE_NONE:
-- 
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/

[toc] | [prev] | [next] | [standalone]


#1186611 — [PATCH/RFC 21/51] leds: wm831x: Remove work queue

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 21/51] leds: wm831x: Remove work queue
Message-ID<pN9Oz-X0-27@gated-at.bofh.it>
In reply to#1186573
From: Andrew Lunn <andrew@lunn.ch>

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

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Cc: Mark Brown <broonie@kernel.org>
---
 drivers/leds/leds-wm831x-status.c |   23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/leds/leds-wm831x-status.c b/drivers/leds/leds-wm831x-status.c
index 56027ef..01dad0e 100644
--- a/drivers/leds/leds-wm831x-status.c
+++ b/drivers/leds/leds-wm831x-status.c
@@ -23,7 +23,6 @@
 struct wm831x_status {
 	struct led_classdev cdev;
 	struct wm831x *wm831x;
-	struct work_struct work;
 	struct mutex mutex;
 
 	spinlock_t value_lock;
@@ -40,10 +39,8 @@ struct wm831x_status {
 #define to_wm831x_status(led_cdev) \
 	container_of(led_cdev, struct wm831x_status, cdev)
 
-static void wm831x_status_work(struct work_struct *work)
+static void wm831x_status_set(struct wm831x_status *led)
 {
-	struct wm831x_status *led = container_of(work, struct wm831x_status,
-						 work);
 	unsigned long flags;
 
 	mutex_lock(&led->mutex);
@@ -70,8 +67,8 @@ static void wm831x_status_work(struct work_struct *work)
 	mutex_unlock(&led->mutex);
 }
 
-static void wm831x_status_set(struct led_classdev *led_cdev,
-			   enum led_brightness value)
+static void wm831x_status_brightness_set(struct led_classdev *led_cdev,
+					 enum led_brightness value)
 {
 	struct wm831x_status *led = to_wm831x_status(led_cdev);
 	unsigned long flags;
@@ -80,8 +77,8 @@ static void wm831x_status_set(struct led_classdev *led_cdev,
 	led->brightness = value;
 	if (value == LED_OFF)
 		led->blink = 0;
-	schedule_work(&led->work);
 	spin_unlock_irqrestore(&led->value_lock, flags);
+	wm831x_status_set(led);
 }
 
 static int wm831x_status_blink_set(struct led_classdev *led_cdev,
@@ -147,11 +144,8 @@ static int wm831x_status_blink_set(struct led_classdev *led_cdev,
 	else
 		led->blink = 0;
 
-	/* Always update; if we fail turn off blinking since we expect
-	 * a software fallback. */
-	schedule_work(&led->work);
-
 	spin_unlock_irqrestore(&led->value_lock, flags);
+	wm831x_status_set(led);
 
 	return ret;
 }
@@ -206,11 +200,9 @@ static ssize_t wm831x_status_src_store(struct device *dev,
 	for (i = 0; i < ARRAY_SIZE(led_src_texts); i++) {
 		if (!strcmp(name, led_src_texts[i])) {
 			mutex_lock(&led->mutex);
-
 			led->src = i;
-			schedule_work(&led->work);
-
 			mutex_unlock(&led->mutex);
+			wm831x_status_set(led);
 		}
 	}
 
@@ -262,7 +254,6 @@ static int wm831x_status_probe(struct platform_device *pdev)
 		pdata.name = dev_name(&pdev->dev);
 
 	mutex_init(&drvdata->mutex);
-	INIT_WORK(&drvdata->work, wm831x_status_work);
 	spin_lock_init(&drvdata->value_lock);
 
 	/* We cache the configuration register and read startup values
@@ -287,7 +278,7 @@ static int wm831x_status_probe(struct platform_device *pdev)
 
 	drvdata->cdev.name = pdata.name;
 	drvdata->cdev.default_trigger = pdata.default_trigger;
-	drvdata->cdev.brightness_set = wm831x_status_set;
+	drvdata->cdev.brightness_set = wm831x_status_brightness_set;
 	drvdata->cdev.blink_set = wm831x_status_blink_set;
 	drvdata->cdev.groups = wm831x_status_groups;
 
-- 
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/

[toc] | [prev] | [next] | [standalone]


#1186659 — Re: [PATCH/RFC 21/51] leds: wm831x: Remove work queue

FromMark Brown <broonie@kernel.org>
Date2015-07-17 12:10 +0200
SubjectRe: [PATCH/RFC 21/51] leds: wm831x: Remove work queue
Message-ID<pNaKB-2i1-1@gated-at.bofh.it>
In reply to#1186611

[Multipart message — attachments visible in raw view] — view raw

On Fri, Jul 17, 2015 at 10:47:07AM +0200, Jacek Anaszewski wrote:
> From: Andrew Lunn <andrew@lunn.ch>
> 
> Now the core implements the work queue, remove it from the drivers.

Reviwed-by: Mark Brown <broonie@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1186612 — [PATCH/RFC 16/51] leds: lp55xx: Remove work queue

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 16/51] leds: lp55xx: Remove work queue
Message-ID<pN9Oz-X0-29@gated-at.bofh.it>
In reply to#1186573
From: Andrew Lunn <andrew@lunn.ch>

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

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Milo Kim <milo.kim@ti.com>
---
 drivers/leds/leds-lp5521.c        |    6 ++----
 drivers/leds/leds-lp5523.c        |    6 ++----
 drivers/leds/leds-lp5562.c        |    6 ++----
 drivers/leds/leds-lp55xx-common.c |    8 +++-----
 drivers/leds/leds-lp55xx-common.h |    6 ++----
 drivers/leds/leds-lp8501.c        |    6 ++----
 6 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index 8ca197a..9893f7b 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -362,10 +362,8 @@ static int lp5521_run_selftest(struct lp55xx_chip *chip, char *buf)
 	return 0;
 }
 
-static void lp5521_led_brightness_work(struct work_struct *work)
+static void lp5521_led_brightness(struct lp55xx_led *led)
 {
-	struct lp55xx_led *led = container_of(work, struct lp55xx_led,
-					      brightness_work);
 	struct lp55xx_chip *chip = led->chip;
 
 	mutex_lock(&chip->lock);
@@ -501,7 +499,7 @@ static struct lp55xx_device_config lp5521_cfg = {
 	},
 	.max_channel  = LP5521_MAX_LEDS,
 	.post_init_device   = lp5521_post_init_device,
-	.brightness_work_fn = lp5521_led_brightness_work,
+	.brightness_fn      = lp5521_led_brightness,
 	.set_led_current    = lp5521_set_led_current,
 	.firmware_cb        = lp5521_firmware_loaded,
 	.run_engine         = lp5521_run_engine,
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index 584dbbc..35d58ac 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -802,10 +802,8 @@ leave:
 	return ret;
 }
 
-static void lp5523_led_brightness_work(struct work_struct *work)
+static void lp5523_led_brightness(struct lp55xx_led *led)
 {
-	struct lp55xx_led *led = container_of(work, struct lp55xx_led,
-					      brightness_work);
 	struct lp55xx_chip *chip = led->chip;
 
 	mutex_lock(&chip->lock);
@@ -867,7 +865,7 @@ static struct lp55xx_device_config lp5523_cfg = {
 	},
 	.max_channel  = LP5523_MAX_LEDS,
 	.post_init_device   = lp5523_post_init_device,
-	.brightness_work_fn = lp5523_led_brightness_work,
+	.brightness_fn      = lp5523_led_brightness,
 	.set_led_current    = lp5523_set_led_current,
 	.firmware_cb        = lp5523_firmware_loaded,
 	.run_engine         = lp5523_run_engine,
diff --git a/drivers/leds/leds-lp5562.c b/drivers/leds/leds-lp5562.c
index ca85724..0c0487b 100644
--- a/drivers/leds/leds-lp5562.c
+++ b/drivers/leds/leds-lp5562.c
@@ -311,10 +311,8 @@ static int lp5562_post_init_device(struct lp55xx_chip *chip)
 	return 0;
 }
 
-static void lp5562_led_brightness_work(struct work_struct *work)
+static void lp5562_led_brightness(struct lp55xx_led *led)
 {
-	struct lp55xx_led *led = container_of(work, struct lp55xx_led,
-					      brightness_work);
 	struct lp55xx_chip *chip = led->chip;
 	u8 addr[] = {
 		LP5562_REG_R_PWM,
@@ -503,7 +501,7 @@ static struct lp55xx_device_config lp5562_cfg = {
 	},
 	.post_init_device   = lp5562_post_init_device,
 	.set_led_current    = lp5562_set_led_current,
-	.brightness_work_fn = lp5562_led_brightness_work,
+	.brightness_fn      = lp5562_led_brightness,
 	.run_engine         = lp5562_run_engine,
 	.firmware_cb        = lp5562_firmware_loaded,
 	.dev_attr_group     = &lp5562_group,
diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
index 96d51e9..b5c38d4 100644
--- a/drivers/leds/leds-lp55xx-common.c
+++ b/drivers/leds/leds-lp55xx-common.c
@@ -138,9 +138,10 @@ static void lp55xx_set_brightness(struct led_classdev *cdev,
 			     enum led_brightness brightness)
 {
 	struct lp55xx_led *led = cdev_to_lp55xx_led(cdev);
+	struct lp55xx_device_config *cfg = led->chip->cfg;
 
 	led->brightness = (u8)brightness;
-	schedule_work(&led->brightness_work);
+	cfg->brightness_fn(led);
 }
 
 static int lp55xx_init_led(struct lp55xx_led *led,
@@ -464,7 +465,7 @@ int lp55xx_register_leds(struct lp55xx_led *led, struct lp55xx_chip *chip)
 	int ret;
 	int i;
 
-	if (!cfg->brightness_work_fn) {
+	if (!cfg->brightness_fn) {
 		dev_err(&chip->cl->dev, "empty brightness configuration\n");
 		return -EINVAL;
 	}
@@ -481,8 +482,6 @@ int lp55xx_register_leds(struct lp55xx_led *led, struct lp55xx_chip *chip)
 		if (ret)
 			goto err_init_led;
 
-		INIT_WORK(&each->brightness_work, cfg->brightness_work_fn);
-
 		chip->num_leds++;
 		each->chip = chip;
 
@@ -507,7 +506,6 @@ void lp55xx_unregister_leds(struct lp55xx_led *led, struct lp55xx_chip *chip)
 	for (i = 0; i < chip->num_leds; i++) {
 		each = led + i;
 		led_classdev_unregister(&each->cdev);
-		flush_work(&each->brightness_work);
 	}
 }
 EXPORT_SYMBOL_GPL(lp55xx_unregister_leds);
diff --git a/drivers/leds/leds-lp55xx-common.h b/drivers/leds/leds-lp55xx-common.h
index cceab48..0a045d0 100644
--- a/drivers/leds/leds-lp55xx-common.h
+++ b/drivers/leds/leds-lp55xx-common.h
@@ -95,7 +95,7 @@ struct lp55xx_reg {
  * @enable             : Chip specific enable command
  * @max_channel        : Maximum number of channels
  * @post_init_device   : Chip specific initialization code
- * @brightness_work_fn : Brightness work function
+ * @brightness_fn      : Brightness function
  * @set_led_current    : LED current set function
  * @firmware_cb        : Call function when the firmware is loaded
  * @run_engine         : Run internal engine for pattern
@@ -110,7 +110,7 @@ struct lp55xx_device_config {
 	int (*post_init_device) (struct lp55xx_chip *chip);
 
 	/* access brightness register */
-	void (*brightness_work_fn)(struct work_struct *work);
+	void (*brightness_fn)(struct lp55xx_led *led);
 
 	/* current setting function */
 	void (*set_led_current) (struct lp55xx_led *led, u8 led_current);
@@ -164,7 +164,6 @@ struct lp55xx_chip {
  * @cdev            : LED class device
  * @led_current     : Current setting at each led channel
  * @max_current     : Maximun current at each led channel
- * @brightness_work : Workqueue for brightness control
  * @brightness      : Brightness value
  * @chip            : The lp55xx chip data
  */
@@ -173,7 +172,6 @@ struct lp55xx_led {
 	struct led_classdev cdev;
 	u8 led_current;
 	u8 max_current;
-	struct work_struct brightness_work;
 	u8 brightness;
 	struct lp55xx_chip *chip;
 };
diff --git a/drivers/leds/leds-lp8501.c b/drivers/leds/leds-lp8501.c
index d3098e3..753ce15 100644
--- a/drivers/leds/leds-lp8501.c
+++ b/drivers/leds/leds-lp8501.c
@@ -272,10 +272,8 @@ static void lp8501_firmware_loaded(struct lp55xx_chip *chip)
 	lp8501_update_program_memory(chip, fw->data, fw->size);
 }
 
-static void lp8501_led_brightness_work(struct work_struct *work)
+static void lp8501_led_brightness(struct lp55xx_led *led)
 {
-	struct lp55xx_led *led = container_of(work, struct lp55xx_led,
-					      brightness_work);
 	struct lp55xx_chip *chip = led->chip;
 
 	mutex_lock(&chip->lock);
@@ -296,7 +294,7 @@ static struct lp55xx_device_config lp8501_cfg = {
 	},
 	.max_channel  = LP8501_MAX_LEDS,
 	.post_init_device   = lp8501_post_init_device,
-	.brightness_work_fn = lp8501_led_brightness_work,
+	.brightness_fn      = lp8501_led_brightness,
 	.set_led_current    = lp8501_set_led_current,
 	.firmware_cb        = lp8501_firmware_loaded,
 	.run_engine         = lp8501_run_engine,
-- 
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/

[toc] | [prev] | [next] | [standalone]


#1186616 — [PATCH/RFC 13/51] leds: lm3642: Remove work queue

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 13/51] leds: lm3642: Remove work queue
Message-ID<pN9Oz-X0-45@gated-at.bofh.it>
In reply to#1186573
From: Andrew Lunn <andrew@lunn.ch>

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

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Cc: Daniel Jeong <daniel.jeong@ti.com>
Cc: G.Shark Jeong <gshark.jeong@gmail.com>
---
 drivers/leds/leds-lm3642.c |   54 ++++++++------------------------------------
 1 file changed, 9 insertions(+), 45 deletions(-)

diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c
index d3dec01..b54f98d 100644
--- a/drivers/leds/leds-lm3642.c
+++ b/drivers/leds/leds-lm3642.c
@@ -15,7 +15,6 @@
 #include <linux/platform_device.h>
 #include <linux/fs.h>
 #include <linux/regmap.h>
-#include <linux/workqueue.h>
 #include <linux/platform_data/leds-lm3642.h>
 
 #define	REG_FILT_TIME			(0x0)
@@ -73,10 +72,6 @@ struct lm3642_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;
@@ -209,24 +204,16 @@ out_strtoint:
 
 static DEVICE_ATTR(torch_pin, S_IWUSR, NULL, lm3642_torch_pin_store);
 
-static void lm3642_deferred_torch_brightness_set(struct work_struct *work)
-{
-	struct lm3642_chip_data *chip =
-	    container_of(work, struct lm3642_chip_data, work_torch);
-
-	mutex_lock(&chip->lock);
-	lm3642_control(chip, chip->br_torch, MODES_TORCH);
-	mutex_unlock(&chip->lock);
-}
-
 static void lm3642_torch_brightness_set(struct led_classdev *cdev,
 					enum led_brightness brightness)
 {
 	struct lm3642_chip_data *chip =
 	    container_of(cdev, struct lm3642_chip_data, cdev_torch);
 
+	mutex_lock(&chip->lock);
 	chip->br_torch = brightness;
-	schedule_work(&chip->work_torch);
+	lm3642_control(chip, chip->br_torch, MODES_TORCH);
+	mutex_unlock(&chip->lock);
 }
 
 /* flash */
@@ -266,45 +253,29 @@ out_strtoint:
 
 static DEVICE_ATTR(strobe_pin, S_IWUSR, NULL, lm3642_strobe_pin_store);
 
-static void lm3642_deferred_strobe_brightness_set(struct work_struct *work)
-{
-	struct lm3642_chip_data *chip =
-	    container_of(work, struct lm3642_chip_data, work_flash);
-
-	mutex_lock(&chip->lock);
-	lm3642_control(chip, chip->br_flash, MODES_FLASH);
-	mutex_unlock(&chip->lock);
-}
-
 static void lm3642_strobe_brightness_set(struct led_classdev *cdev,
 					 enum led_brightness brightness)
 {
 	struct lm3642_chip_data *chip =
 	    container_of(cdev, struct lm3642_chip_data, cdev_flash);
 
-	chip->br_flash = brightness;
-	schedule_work(&chip->work_flash);
-}
-
-/* indicator */
-static void lm3642_deferred_indicator_brightness_set(struct work_struct *work)
-{
-	struct lm3642_chip_data *chip =
-	    container_of(work, struct lm3642_chip_data, work_indicator);
-
 	mutex_lock(&chip->lock);
-	lm3642_control(chip, chip->br_indicator, MODES_INDIC);
+	chip->br_flash = brightness;
+	lm3642_control(chip, chip->br_flash, MODES_FLASH);
 	mutex_unlock(&chip->lock);
 }
 
+/* indicator */
 static void lm3642_indicator_brightness_set(struct led_classdev *cdev,
 					    enum led_brightness brightness)
 {
 	struct lm3642_chip_data *chip =
 	    container_of(cdev, struct lm3642_chip_data, cdev_indicator);
 
+	mutex_lock(&chip->lock);
 	chip->br_indicator = brightness;
-	schedule_work(&chip->work_indicator);
+	lm3642_control(chip, chip->br_indicator, MODES_INDIC);
+	mutex_unlock(&chip->lock);
 }
 
 static const struct regmap_config lm3642_regmap = {
@@ -371,7 +342,6 @@ static int lm3642_probe(struct i2c_client *client,
 		goto err_out;
 
 	/* flash */
-	INIT_WORK(&chip->work_flash, lm3642_deferred_strobe_brightness_set);
 	chip->cdev_flash.name = "flash";
 	chip->cdev_flash.max_brightness = 16;
 	chip->cdev_flash.brightness_set = lm3642_strobe_brightness_set;
@@ -385,7 +355,6 @@ static int lm3642_probe(struct i2c_client *client,
 	}
 
 	/* torch */
-	INIT_WORK(&chip->work_torch, lm3642_deferred_torch_brightness_set);
 	chip->cdev_torch.name = "torch";
 	chip->cdev_torch.max_brightness = 8;
 	chip->cdev_torch.brightness_set = lm3642_torch_brightness_set;
@@ -399,8 +368,6 @@ static int lm3642_probe(struct i2c_client *client,
 	}
 
 	/* indicator */
-	INIT_WORK(&chip->work_indicator,
-		  lm3642_deferred_indicator_brightness_set);
 	chip->cdev_indicator.name = "indicator";
 	chip->cdev_indicator.max_brightness = 8;
 	chip->cdev_indicator.brightness_set = lm3642_indicator_brightness_set;
@@ -427,11 +394,8 @@ static int lm3642_remove(struct i2c_client *client)
 	struct lm3642_chip_data *chip = i2c_get_clientdata(client);
 
 	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);
 	regmap_write(chip->regmap, REG_ENABLE, 0);
 	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/

[toc] | [prev] | [next] | [standalone]


#1186618 — [PATCH/RFC 17/51] leds: lp8788: Remove work queue

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 17/51] leds: lp8788: Remove work queue
Message-ID<pN9OA-X0-49@gated-at.bofh.it>
In reply to#1186573
From: Andrew Lunn <andrew@lunn.ch>

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

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Cc: Milo Kim <milo.kim@ti.com>
---
 drivers/leds/leds-lp8788.c |   22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/leds/leds-lp8788.c b/drivers/leds/leds-lp8788.c
index 3409f03..634c9ad 100644
--- a/drivers/leds/leds-lp8788.c
+++ b/drivers/leds/leds-lp8788.c
@@ -26,10 +26,8 @@
 struct lp8788_led {
 	struct lp8788 *lp;
 	struct mutex lock;
-	struct work_struct work;
 	struct led_classdev led_dev;
 	enum lp8788_isink_number isink_num;
-	enum led_brightness brightness;
 	int on;
 };
 
@@ -88,12 +86,14 @@ static void lp8788_led_enable(struct lp8788_led *led,
 	led->on = on;
 }
 
-static void lp8788_led_work(struct work_struct *work)
+static void lp8788_brightness_set(struct led_classdev *led_cdev,
+				enum led_brightness val)
 {
-	struct lp8788_led *led = container_of(work, struct lp8788_led, work);
+	struct lp8788_led *led =
+			container_of(led_cdev, struct lp8788_led, led_dev);
+
 	enum lp8788_isink_number num = led->isink_num;
 	int enable;
-	u8 val = led->brightness;
 
 	mutex_lock(&led->lock);
 
@@ -115,16 +115,6 @@ static void lp8788_led_work(struct work_struct *work)
 	mutex_unlock(&led->lock);
 }
 
-static void lp8788_brightness_set(struct led_classdev *led_cdev,
-				enum led_brightness brt_val)
-{
-	struct lp8788_led *led =
-			container_of(led_cdev, struct lp8788_led, led_dev);
-
-	led->brightness = brt_val;
-	schedule_work(&led->work);
-}
-
 static int lp8788_led_probe(struct platform_device *pdev)
 {
 	struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent);
@@ -149,7 +139,6 @@ static int lp8788_led_probe(struct platform_device *pdev)
 		led->led_dev.name = led_pdata->name;
 
 	mutex_init(&led->lock);
-	INIT_WORK(&led->work, lp8788_led_work);
 
 	platform_set_drvdata(pdev, led);
 
@@ -173,7 +162,6 @@ static int lp8788_led_remove(struct platform_device *pdev)
 	struct lp8788_led *led = platform_get_drvdata(pdev);
 
 	led_classdev_unregister(&led->led_dev);
-	flush_work(&led->work);
 
 	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/

[toc] | [prev] | [next] | [standalone]


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

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-07-17 11:10 +0200
Subject[PATCH/RFC 31/51] leds: lm355x: Remove work queue
Message-ID<pN9OA-X0-51@gated-at.bofh.it>
In reply to#1186573
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/

[toc] | [prev] | [next] | [standalone]


Page 2 of 3 — ← Prev page 1 [2] 3  Next page →

Back to top | Article view | linux.kernel


csiph-web