From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: linux-leds@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, cooloney@gmail.com,
rpurdie@rpsys.net, stsp@users.sourceforge.net, pavel@ucw.cz,
sakari.ailus@linux.intel.com, andreas.werner@men.de,
andrew@lunn.ch, ospite@studenti.unina.it, anemo@mba.ocn.ne.jp,
ben@simtec.co.uk, bootc@bootc.net, dmurphy@ti.com,
daniel.jeong@ti.com, daniel@zonque.org, davem@davemloft.net,
fabio.baltieri@gmail.com, balbi@ti.com, florian@openwrt.org,
gshark.jeong@gmail.com, g.liakhovetski@gmx.de,
ingi2.kim@samsung.com, dl9pf@gmx.de, johan@kernel.org,
lenz@cs.wisc.edu, jogo@openwrt.org, q1.kim@samsung.com,
kris@krisk.org, kristoffer.ericson@gmail.com,
linus.walleij@linaro.org, broonie@kernel.org,
michael.hennerich@analog.com, milo.kim@ti.com, nm127@freemail.hu,
ncase@xes-inc.com, neilb@suse.de, nick.forbes@incepta.com,
lost.distance@yahoo.com, p.meerwald@bct-electronic.com,
n0-1@freewrt.org, philippe.retornaz@epfl.ch, raph@
Subject: [PATCH/RFC v2 2/5] leds: pwm: remove work queue
Date: Tue, 30 Jun 2015 15:59:27 +0200 [thread overview]
Message-ID: <1435672770-4261-2-git-send-email-j.anaszewski@samsung.com> (raw)
In-Reply-To: <1435672770-4261-1-git-send-email-j.anaszewski@samsung.com>
Commit 483a3122 ("leds: Use set_brightness_work for brightness_set
ops that can sleep") removed from LED subsystem drivers the
responsibility of using work queues internally.
Modify the driver to benefit from this modification.
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
---
drivers/leds/leds-pwm.c | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 1d07e3e..0068297 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -22,12 +22,10 @@
#include <linux/pwm.h>
#include <linux/leds_pwm.h>
#include <linux/slab.h>
-#include <linux/workqueue.h>
struct led_pwm_data {
struct led_classdev cdev;
struct pwm_device *pwm;
- struct work_struct work;
unsigned int active_low;
unsigned int period;
int duty;
@@ -51,14 +49,6 @@ static void __led_pwm_set(struct led_pwm_data *led_dat)
pwm_enable(led_dat->pwm);
}
-static void led_pwm_work(struct work_struct *work)
-{
- struct led_pwm_data *led_dat =
- container_of(work, struct led_pwm_data, work);
-
- __led_pwm_set(led_dat);
-}
-
static void led_pwm_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
@@ -75,10 +65,7 @@ static void led_pwm_set(struct led_classdev *led_cdev,
led_dat->duty = duty;
- if (led_dat->can_sleep)
- schedule_work(&led_dat->work);
- else
- __led_pwm_set(led_dat);
+ __led_pwm_set(led_dat);
}
static inline size_t sizeof_pwm_leds_priv(int num_leds)
@@ -89,11 +76,8 @@ static inline size_t sizeof_pwm_leds_priv(int num_leds)
static void led_pwm_cleanup(struct led_pwm_priv *priv)
{
- while (priv->num_leds--) {
+ while (priv->num_leds--)
led_classdev_unregister(&priv->leds[priv->num_leds].cdev);
- if (priv->leds[priv->num_leds].can_sleep)
- cancel_work_sync(&priv->leds[priv->num_leds].work);
- }
}
static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
@@ -122,8 +106,8 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
}
led_data->can_sleep = pwm_can_sleep(led_data->pwm);
- if (led_data->can_sleep)
- INIT_WORK(&led_data->work, led_pwm_work);
+ if (!led_data->can_sleep)
+ led_data->cdev.flags |= LED_BRIGHTNESS_FAST;
led_data->period = pwm_get_period(led_data->pwm);
if (!led_data->period && (led->pwm_period_ns > 0))
--
1.7.9.5
next prev parent reply other threads:[~2015-06-30 14:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 13:59 [PATCH/RFC v2 1/5] leds: Use set_brightness_work for brightness_set ops that can sleep Jacek Anaszewski
2015-06-30 13:59 ` Jacek Anaszewski [this message]
2015-06-30 13:59 ` [PATCH/RFC v2 3/5] led: flash: remove check for brightness_set_sync op Jacek Anaszewski
2015-06-30 13:59 ` [PATCH/RFC v2 4/5] leds: max77693: remove work queue Jacek Anaszewski
2015-06-30 13:59 ` [PATCH/RFC v2 5/5] leds: aat1290: " Jacek Anaszewski
2015-06-30 18:30 ` [PATCH/RFC v2 1/5] leds: Use set_brightness_work for brightness_set ops that can sleep Pavel Machek
2015-06-30 22:24 ` Sakari Ailus
2015-07-01 9:42 ` Mark Brown
2015-07-01 9:52 ` Jacek Anaszewski
2015-07-01 12:01 ` Jacek Anaszewski
2015-07-01 21:44 ` Sakari Ailus
2015-07-03 13:16 ` Jacek Anaszewski
2015-07-01 21:36 ` Sakari Ailus
2015-07-01 22:56 ` Andrew Lunn
2015-07-03 13:16 ` Jacek Anaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1435672770-4261-2-git-send-email-j.anaszewski@samsung.com \
--to=j.anaszewski@samsung.com \
--cc=andreas.werner@men.de \
--cc=andrew@lunn.ch \
--cc=anemo@mba.ocn.ne.jp \
--cc=balbi@ti.com \
--cc=ben@simtec.co.uk \
--cc=bootc@bootc.net \
--cc=broonie@kernel.org \
--cc=cooloney@gmail.com \
--cc=daniel.jeong@ti.com \
--cc=daniel@zonque.org \
--cc=davem@davemloft.net \
--cc=dl9pf@gmx.de \
--cc=dmurphy@ti.com \
--cc=fabio.baltieri@gmail.com \
--cc=florian@openwrt.org \
--cc=g.liakhovetski@gmx.de \
--cc=gshark.jeong@gmail.com \
--cc=ingi2.kim@samsung.com \
--cc=jogo@openwrt.org \
--cc=johan@kernel.org \
--cc=kris@krisk.org \
--cc=kristoffer.ericson@gmail.com \
--cc=lenz@cs.wisc.edu \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=lost.distance@yahoo.com \
--cc=michael.hennerich@analog.com \
--cc=milo.kim@ti.com \
--cc=n0-1@freewrt.org \
--cc=ncase@xes-inc.com \
--cc=neilb@suse.de \
--cc=nick.forbes@incepta.com \
--cc=nm127@freemail.hu \
--cc=ospite@studenti.unina.it \
--cc=p.meerwald@bct-electronic.com \
--cc=pavel@ucw.cz \
--cc=philippe.retornaz@epfl.ch \
--cc=q1.kim@samsung.com \
--cc=rpurdie@rpsys.net \
--cc=sakari.ailus@linux.intel.com \
--cc=stsp@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).