Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753575AbbHTOqo (ORCPT ); Thu, 20 Aug 2015 10:46:44 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:53227 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752307AbbHTOql (ORCPT ); Thu, 20 Aug 2015 10:46:41 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-c6-55d5e85067bd From: Jacek Anaszewski To: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrew Lunn , Jacek Anaszewski , Johan Hovold Subject: [PATCH/RFC v6 16/36] leds: lm3533: Remove work queue Date: Thu, 20 Aug 2015 16:43:46 +0200 Message-id: <1440081846-11697-17-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1440081846-11697-1-git-send-email-j.anaszewski@samsung.com> References: <1440081846-11697-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplluLIzCtJLcpLzFFi42I5/e+xgG7Ai6uhBo/OClmcv3uI2aL36nNG i6YbPawWl3fNYbPY+mYdowOrx6ZVnWweO3d8ZvLo27KK0ePzJrkAligum5TUnMyy1CJ9uwSu jE87v7EVfJGsePb9NFMD4xnRLkZODgkBE4mb+/4zQdhiEhfurWfrYuTiEBJYyijxaetzRpCE kMBPRomNd9RBbDYBQ4mfL16DNYgI2Ej0zpgEZHNwMAsUSEza4AESFhawlTj69CYLiM0ioCox a982dhCbV8BTou3gPXaQcgkBBYk5k2xAwpxA4Xnzv7JDbPKQePF+C/MERt4FjAyrGCVSC5IL ipPScw3zUsv1ihNzi0vz0vWS83M3MYID55nUDsaDu9wPMQpwMCrx8F4QvhoqxJpYVlyZe4hR goNZSYT31jOgEG9KYmVValF+fFFpTmrxIUZpDhYlcV7ZDZtDhQTSE0tSs1NTC1KLYLJMHJxS DYxZ1karvmlkVvSnq4g4iWrVvmX5YO7+JK3eaJIUD+/bHwVHNgecueXsuK84VCUrWLFz34cP rwRq30765Hvs2DnBKYc1BNd6CazK1i+oOhCzla/85LTlLyVuWEnz7mCde4JtisvG10HdO597 xZ9sqP+wx7d5mbW77Gf+l+wBbKVLX/0Ovck3/7sSS3FGoqEWc1FxIgC9yPWeGAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3450 Lines: 116 From: Andrew Lunn Now the core implements the work queue, remove it from the driver, and switch to using brightness_set_blocking op. Signed-off-by: Andrew Lunn Signed-off-by: Jacek Anaszewski Cc: Johan Hovold --- drivers/leds/leds-lm3533.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/leds/leds-lm3533.c b/drivers/leds/leds-lm3533.c index 6e2e020..196dcb5 100644 --- a/drivers/leds/leds-lm3533.c +++ b/drivers/leds/leds-lm3533.c @@ -17,7 +17,6 @@ #include #include #include -#include #include @@ -53,9 +52,6 @@ struct lm3533_led { struct mutex mutex; unsigned long flags; - - struct work_struct work; - u8 new_brightness; }; @@ -123,27 +119,17 @@ out: return ret; } -static void lm3533_led_work(struct work_struct *work) -{ - struct lm3533_led *led = container_of(work, struct lm3533_led, work); - - dev_dbg(led->cdev.dev, "%s - %u\n", __func__, led->new_brightness); - - if (led->new_brightness == 0) - lm3533_led_pattern_enable(led, 0); /* disable blink */ - - lm3533_ctrlbank_set_brightness(&led->cb, led->new_brightness); -} - -static void lm3533_led_set(struct led_classdev *cdev, +static int lm3533_led_set(struct led_classdev *cdev, enum led_brightness value) { struct lm3533_led *led = to_lm3533_led(cdev); dev_dbg(led->cdev.dev, "%s - %d\n", __func__, value); - led->new_brightness = value; - schedule_work(&led->work); + if (value == 0) + lm3533_led_pattern_enable(led, 0); /* disable blink */ + + return lm3533_ctrlbank_set_brightness(&led->cb, value); } static enum led_brightness lm3533_led_get(struct led_classdev *cdev) @@ -693,7 +679,7 @@ static int lm3533_led_probe(struct platform_device *pdev) led->lm3533 = lm3533; led->cdev.name = pdata->name; led->cdev.default_trigger = pdata->default_trigger; - led->cdev.brightness_set = lm3533_led_set; + led->cdev.brightness_set_blocking = lm3533_led_set; led->cdev.brightness_get = lm3533_led_get; led->cdev.blink_set = lm3533_led_blink_set; led->cdev.brightness = LED_OFF; @@ -701,7 +687,6 @@ static int lm3533_led_probe(struct platform_device *pdev) led->id = pdev->id; mutex_init(&led->mutex); - INIT_WORK(&led->work, lm3533_led_work); /* The class framework makes a callback to get brightness during * registration so use parent device (for error reporting) until @@ -733,7 +718,6 @@ static int lm3533_led_probe(struct platform_device *pdev) err_unregister: led_classdev_unregister(&led->cdev); - flush_work(&led->work); return ret; } @@ -746,7 +730,6 @@ static int lm3533_led_remove(struct platform_device *pdev) lm3533_ctrlbank_disable(&led->cb); led_classdev_unregister(&led->cdev); - flush_work(&led->work); return 0; } @@ -760,7 +743,6 @@ static void lm3533_led_shutdown(struct platform_device *pdev) lm3533_ctrlbank_disable(&led->cb); lm3533_led_set(&led->cdev, LED_OFF); /* disable blink */ - flush_work(&led->work); } static struct platform_driver lm3533_led_driver = { -- 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/