Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965048AbbHKJjn (ORCPT ); Tue, 11 Aug 2015 05:39:43 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:54411 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965027AbbHKJjk (ORCPT ); Tue, 11 Aug 2015 05:39:40 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-9d-55c9c2d99c3e 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 , Mark Brown , Jacek Anaszewski Subject: [PATCH/RFC v5 26/57] leds: wm831x: Remove work queue Date: Tue, 11 Aug 2015 11:37:39 +0200 Message-id: <1439285890-27329-27-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+NgFlrILMWRmVeSWpSXmKPExsVy+t9jQd2bh06GGpyfLGhx/u4hZoupD5+w WRzdOZHJovfqc0aLy7vmsFlsfbOO0WL3rqesFp1901gcODx2zrrL7rFpVSebx84dn5k89sz/ werRt2UVo0fTqXZWj8+b5ALYo7hsUlJzMstSi/TtErgy3vcLFfyVqrh2p7SBcY9YFyMnh4SA icSk55dYIWwxiQv31rOB2EICsxglLs037GLkArJ/MkosazkClmATMJT4+eI1UxcjB4eIgJzE zjOVIDXMApcZJRrnHGICqREWsJVYO6+HHaSGRUBV4saCApAwr4CnxO/N88FaJQQUJOZMsgEJ cwKFrz9fxAix1kPi+OwmtgmMvAsYGVYxSqQWJBcUJ6XnGuallusVJ+YWl+al6yXn525iBAfc M6kdjAd3uR9iFOBgVOIBWnAyVIg1say4MvcQowQHs5IIb+FUoBBvSmJlVWpRfnxRaU5q8SFG aQ4WJXFe2Q2bQ4UE0hNLUrNTUwtSi2CyTBycUg2MRT1eezqjHnULTJHNP//3x/ygkt7Ul34T W4+c+/m70WIl9xdZxx/zXV3yJROTJHcu7Cjgfl5ZqLd6Ip/fvrkm8xMk9/CYvfZarbS7rtt/ zs2naxMe71F9Y+nifuTwQ5uuGzdbTjSsDVheErlZqnuOP9fLIqZN9+rmGJypvKaisU19SQTj DfsAJZbijERDLeai4kQAlhNmATQCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3593 Lines: 110 From: Andrew Lunn Now the core implements the work queue, remove it from the drivers. Signed-off-by: Andrew Lunn Cc: Mark Brown Signed-off-by: Jacek Anaszewski --- drivers/leds/leds-wm831x-status.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/leds/leds-wm831x-status.c b/drivers/leds/leds-wm831x-status.c index 56027ef..ed40dd7 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,9 +278,10 @@ 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; + drvdata->cdev.flags |= LED_BRIGHTNESS_BLOCKING; ret = led_classdev_register(wm831x->dev, &drvdata->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/