Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965157AbbHKJkT (ORCPT ); Tue, 11 Aug 2015 05:40:19 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:48641 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964817AbbHKJkH (ORCPT ); Tue, 11 Aug 2015 05:40:07 -0400 X-AuditID: cbfee61b-f79706d000001b96-86-55c9c2ef7743 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 , Jacek Anaszewski , Mark Brown Subject: [PATCH/RFC v5 34/57] leds: wm8350: Remove work queue Date: Tue, 11 Aug 2015 11:37:47 +0200 Message-id: <1439285890-27329-35-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+NgFlrKLMWRmVeSWpSXmKPExsVy+t9jQd33h06GGpxeYGBx/u4hZoupD5+w WRzdOZHJovfqc0aLy7vmsFlsfbOO0WL3rqesFp1901gcODx2zrrL7rFpVSebx84dn5k89sz/ werRt2UVo0fTqXZWj8+b5ALYo7hsUlJzMstSi/TtErgydh17xVhwU7qiZ843xgbGHvEuRk4O CQETiWUHVzJC2GISF+6tZ+ti5OIQEpjFKNHbtZ8dwvnJKPHh/0JmkCo2AUOJny9eM3UxcnCI CMhJ7DxTCVLDLHCZUeLVo2lgk4QFbCXWTJ3GCmKzCKhKXLk/mx3E5hXwlPix+xczSK+EgILE nEk2IGFOoPD154vAWoUEPCSOz25im8DIu4CRYRWjRGpBckFxUnquUV5quV5xYm5xaV66XnJ+ 7iZGcOA9k97BeHiX+yFGAQ5GJR6gBSdDhVgTy4orcw8xSnAwK4nwFk4FCvGmJFZWpRblxxeV 5qQWH2KU5mBREufVN9kUKiSQnliSmp2aWpBaBJNl4uCUamBczPVjHsf6nXHdu3XO/1pRfC7L aZvADm+Tb9oPlTqbGqN0dKQuPxb/zebH92VHaeTX69ryVQ+9FDIjZnlP2cPszBS8qd738IWq HdeiBHRLdrHvOfwtXfbYXoXUEyEGO1wYNOY1NV/5f//Wp729hrOyntU4JMT8mX108+mZNw5p XPL9Fa/AJjZHiaU4I9FQi7moOBEA0TE42zgCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3673 Lines: 122 From: Andrew Lunn Now the core implements the work queue, remove it from the drivers. Signed-off-by: Andrew Lunn Signed-off-by: Jacek Anaszewski Cc: Mark Brown --- drivers/leds/leds-wm8350.c | 33 +++++++-------------------------- include/linux/mfd/wm8350/pmic.h | 1 - 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/drivers/leds/leds-wm8350.c b/drivers/leds/leds-wm8350.c index 0d12183..c01b180 100644 --- a/drivers/leds/leds-wm8350.c +++ b/drivers/leds/leds-wm8350.c @@ -138,21 +138,22 @@ static void wm8350_led_disable(struct wm8350_led *led) led->enabled = 0; } -static void led_work(struct work_struct *work) +static void wm8350_led_set(struct led_classdev *led_cdev, + enum led_brightness value) { - struct wm8350_led *led = container_of(work, struct wm8350_led, work); + struct wm8350_led *led = to_wm8350_led(led_cdev); + unsigned long flags; int ret; int uA; - unsigned long flags; - mutex_lock(&led->mutex); + led->value = value; spin_lock_irqsave(&led->value_lock, flags); if (led->value == LED_OFF) { spin_unlock_irqrestore(&led->value_lock, flags); wm8350_led_disable(led); - goto out; + return; } /* This scales linearly into the index of valid current @@ -171,31 +172,14 @@ static void led_work(struct work_struct *work) isink_cur[uA], ret); wm8350_led_enable(led); - -out: - mutex_unlock(&led->mutex); -} - -static void wm8350_led_set(struct led_classdev *led_cdev, - enum led_brightness value) -{ - struct wm8350_led *led = to_wm8350_led(led_cdev); - unsigned long flags; - - spin_lock_irqsave(&led->value_lock, flags); - led->value = value; - schedule_work(&led->work); - spin_unlock_irqrestore(&led->value_lock, flags); } static void wm8350_led_shutdown(struct platform_device *pdev) { struct wm8350_led *led = platform_get_drvdata(pdev); - mutex_lock(&led->mutex); led->value = LED_OFF; wm8350_led_disable(led); - mutex_unlock(&led->mutex); } static int wm8350_led_probe(struct platform_device *pdev) @@ -235,7 +219,7 @@ static int wm8350_led_probe(struct platform_device *pdev) led->cdev.brightness_set = wm8350_led_set; led->cdev.default_trigger = pdata->default_trigger; led->cdev.name = pdata->name; - led->cdev.flags |= LED_CORE_SUSPENDRESUME; + led->cdev.flags |= LED_CORE_SUSPENDRESUME | LED_BRIGHTNESS_BLOCKING; led->enabled = regulator_is_enabled(isink); led->isink = isink; led->dcdc = dcdc; @@ -251,8 +235,6 @@ static int wm8350_led_probe(struct platform_device *pdev) pdata->max_uA); spin_lock_init(&led->value_lock); - mutex_init(&led->mutex); - INIT_WORK(&led->work, led_work); led->value = LED_OFF; platform_set_drvdata(pdev, led); @@ -264,7 +246,6 @@ static int wm8350_led_remove(struct platform_device *pdev) struct wm8350_led *led = platform_get_drvdata(pdev); led_classdev_unregister(&led->cdev); - flush_work(&led->work); wm8350_led_disable(led); return 0; } diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h index 579b50c..7a09e7f 100644 --- a/include/linux/mfd/wm8350/pmic.h +++ b/include/linux/mfd/wm8350/pmic.h @@ -715,7 +715,6 @@ struct wm8350_led_platform_data { struct wm8350_led { struct platform_device *pdev; - struct mutex mutex; struct work_struct work; spinlock_t value_lock; enum led_brightness value; -- 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/