Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934328AbbHKJus (ORCPT ); Tue, 11 Aug 2015 05:50:48 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:42544 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964908AbbHKJjP (ORCPT ); Tue, 11 Aug 2015 05:39:15 -0400 X-AuditID: cbfee61b-f79706d000001b96-3c-55c9c2c1fa41 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, Andrew Lunn , Daniel Jeong , "G.Shark Jeong" , Jacek Anaszewski Subject: [PATCH/RFC v5 18/57] leds: lm3642: Remove work queue Date: Tue, 11 Aug 2015 11:37:31 +0200 Message-id: <1439285890-27329-19-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1439285890-27329-1-git-send-email-j.anaszewski@samsung.com> References: <1439285890-27329-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJLMWRmVeSWpSXmKPExsVy+t9jQd2Dh06GGvx6oG5x/u4hZoujOycy WezZ9pTZYvLuLlaL3qvPGS0u75rDZrH1zTpGi927nrJadPZNY3Hg9Ng56y67x84dn5k89sz/ werRt2UVo8fxG9uZPJpOtbN6fN4kF8AexWWTkpqTWZZapG+XwJUxu30he8FtnYr+q9PYGhif q3YxcnJICJhITLtzkgXCFpO4cG89WxcjF4eQwCxGicPvXjBCOD8ZJR5P7WQHqWITMJT4+eI1 UxcjB4eIgJzEzjOVIDXMAk1MEk+P72EGiQsL2Eq8PCAEUs4ioCrxZWUHWCuvgKfE776TbCAl EgIKEnMm2YCEOYHC158vYgSxhQQ8JI7PbmKbwMi7gJFhFaNEakFyQXFSeq5RXmq5XnFibnFp Xrpecn7uJkZwAD6T3sF4eJf7IUYBDkYlHqAFJ0OFWBPLiitzDzFKcDArifAWTgUK8aYkVlal FuXHF5XmpBYfYpTmYFES59U32RQqJJCeWJKanZpakFoEk2Xi4JRqYDQ3SftlyPxaY+Gjc1Yq /IXLedOunxHQviWTZLz/xOOq5ts3L1/OtDkslHU3htv+yYJJZx+vfyXQ63ioZ9KD3ewtbXM/ z2E1kXtorj7tk4BR8Kv4xeeu/0lhzbqdN+meyI6mA4+2zl0vtrVhx42OB9YnjPkKshQ/TNqo bLd/76XMs7ZyvN4/Ws4rsRRnJBpqMRcVJwIAIH6TPzwCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5797 Lines: 176 From: Andrew Lunn Now the core implements the work queue, remove it from the driver. Signed-off-by: Andrew Lunn Cc: Daniel Jeong Cc: G.Shark Jeong Signed-off-by: Jacek Anaszewski --- drivers/leds/leds-lm3642.c | 57 ++++++++++---------------------------------- 1 file changed, 12 insertions(+), 45 deletions(-) diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c index 02ebe34..38cbebb 100644 --- a/drivers/leds/leds-lm3642.c +++ b/drivers/leds/leds-lm3642.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #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,12 +342,12 @@ 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; chip->cdev_flash.default_trigger = "flash"; chip->cdev_flash.groups = lm3642_flash_groups, + chip->cdev_flash.flags |= LED_BRIGHTNESS_BLOCKING; err = led_classdev_register((struct device *) &client->dev, &chip->cdev_flash); if (err < 0) { @@ -385,12 +356,12 @@ 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; chip->cdev_torch.default_trigger = "torch"; chip->cdev_torch.groups = lm3642_torch_groups, + chip->cdev_torch.flags |= LED_BRIGHTNESS_BLOCKING; err = led_classdev_register((struct device *) &client->dev, &chip->cdev_torch); if (err < 0) { @@ -399,11 +370,10 @@ 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; + chip->cdev_indicator.flags |= LED_BRIGHTNESS_BLOCKING; err = led_classdev_register((struct device *) &client->dev, &chip->cdev_indicator); if (err < 0) { @@ -427,11 +397,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/