Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753669AbbF3OCU (ORCPT ); Tue, 30 Jun 2015 10:02:20 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:44811 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752858AbbF3OCN (ORCPT ); Tue, 30 Jun 2015 10:02:13 -0400 X-AuditID: cbfee61b-f79416d0000014c0-14-5592a1639c62 From: Jacek Anaszewski 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@8d.com, rpurdie@openedhand.com, rod@whitby.id.au, dave@sr71.net, giometti@linux.it, bigeasy@linutronix.de, shuahkhan@gmail.com, sguinot@lacie.com, Jacek Anaszewski Subject: [PATCH/RFC v2 2/5] leds: pwm: remove work queue Date: Tue, 30 Jun 2015 15:59:27 +0200 Message-id: <1435672770-4261-2-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1435672770-4261-1-git-send-email-j.anaszewski@samsung.com> References: <1435672770-4261-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSW2yLcRjG/b9Tv5XGp3P4M0TqECRzXOK9WBwSsv8FiQsTRFjVp5Ot2/Tr xEioOWTtaqZ1CjUjqBZ12NBthnVpZqess9RhUzbMZHZgTqvNRifunvd5fm+em4enlXZ2Ar89 xSDqU9TJKk7OVA+8GxWtuWCNn3dw/1TILs1loC7opeGybQ2UvdkHjuqvDJyst9Jw3bcCTrS8 58BXdIyCB/daacj83c7AfucjCux1Bxk43mdnIbu6kIUDvdvgR3cNA9238yi43zhAg63EzILn 5TcOjgTaEDS5qzjIfGFhIVSQJYO8Sgy+8mIWjvc7KGgotnNwt8ONoDfnHge55QUycPxyM9DV 1cdA69EyGZSeNzLws3aQhg5PNQt92SUM5HjHQ7DKx0FDrY+B22/PUNBa04ig4kklBaHSZhpK iltZ6Cn8QcHN93L4HloKppyTzNKFZLDgIiLtgWXk6usgRb46rzAk8MtFk0LnS4pcOXSNJpey emXke0+7jBSdCcrI5y+bSN7lxzS54zJxxPbMwhJnQzNFXj17wK2esUEeu1VM3r5T1M9dnCBP zLnYx6ZZIned7tQYUf9IM4rgsRCDn144h/7psdj/+iZnRnJeKZxCOLMigP4dIYRNnkEuTHHC fBz6+IkyI54fLUzGRTUZYYYW6nnsN/fTYSZSAJz1PHuIZ4Tp+M2NwFCDQojD9bcKUPgXC1Ow 3RobtiMEggNn3VRYK/8iZRWfUS5S5KNhLjRGTNOkSVu0ugVzJLVOSk/RztGk6u6goc18iPIg lxG8SOCRaoTCH2eNV7LqnVKGzoswT6tGKyyZfy3FVnXGblGfulmfnixKXhTFM6pxisrUlfFK Qas2iEmimCbq/6cUHzHBiGyHB8a2JNnH7bYaFig6UhM87xJPzZw1cZ3bvL6xJ65/1PBJQtQj TdCZb8JnT+/1rxJ/L8/ARveOaZvSpZ69DoNLHmnpzIrN3dGs94yv/Riz2RS9xNX9bV2S3eZr a9JpVQ9TNuYXrS3xL5JLU/dMbjLkF7c4jujWtM3QxvQGT3SpGClRPX82rZfUfwANLXGRLwMA AA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2608 Lines: 86 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 --- 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 #include #include -#include 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 -- 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/