Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964851AbbHKJiv (ORCPT ); Tue, 11 Aug 2015 05:38:51 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:37957 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964787AbbHKJis (ORCPT ); Tue, 11 Aug 2015 05:38:48 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-2d-55c9c2a73ce6 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, Jacek Anaszewski , Sakari Ailus Subject: [PATCH/RFC v5 09/57] leds: aat1290: Remove work queue Date: Tue, 11 Aug 2015 11:37:22 +0200 Message-id: <1439285890-27329-10-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+NgFprBLMWRmVeSWpSXmKPExsVy+t9jQd3lh06GGvxdJWRxdOdEJoveq88Z LS7vmsNmsfXNOkaL3bueslp82vKNyaKzbxqLA7vHzll32T3mnQz02DP/B6tH35ZVjB5Np9pZ PT5vkgtgi+KySUnNySxLLdK3S+DKuLd+L1vBDumKZ996mBoYV4h3MXJySAiYSEx7up4FwhaT uHBvPVsXIxeHkMAsRomWJXMYQRJCAj8ZJdYtNgax2QQMJX6+eM3UxcjBISIgJ7HzTCVIPbPA QUaJ9ZePsILEhQXsJJrO5YOUswioSpxsuskMYvMKeEqsmv+QHaREQkBBYs4kG5AwJ1D4+vNF UJs8JI7PbmKbwMi7gJFhFaNEakFyQXFSeq5hXmq5XnFibnFpXrpecn7uJkZweD2T2sF4cJf7 IUYBDkYlHqAFJ0OFWBPLiitzDzFKcDArifAWTgUK8aYkVlalFuXHF5XmpBYfYpTmYFES55Xd sDlUSCA9sSQ1OzW1ILUIJsvEwSnVwMgwfVWEfPXUml0KIZMemNaevP2dwz05rr3b+Bcf03Rv 1XaFwvNlGYKKocvuZldWXroY9uNZj9mR45FfAlTClBae0HJbfsiGm+PvsQ+VbT6b//UHn9Ni El+o9UIohHVyoVdKtJryPOXen3whPpPe7FOW27nukTCP2tvMWR72DA+m+jqbNU1fosRSnJFo qMVcVJwIAFH3tBwrAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3650 Lines: 112 Now the core implements the work queue, remove it from the drivers. Signed-off-by: Jacek Anaszewski Cc: Sakari Ailus Cc: Bryan Wu --- drivers/leds/leds-aat1290.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c index 0ecaf76..18af569 100644 --- a/drivers/leds/leds-aat1290.c +++ b/drivers/leds/leds-aat1290.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #define AAT1290_MOVIE_MODE_CURRENT_ADDR 17 @@ -82,8 +81,6 @@ struct aat1290_led { /* brightness cache */ unsigned int torch_brightness; - /* assures led-triggers compatibility */ - struct work_struct work_brightness_set; }; static struct aat1290_led *fled_cdev_to_led( @@ -92,6 +89,12 @@ static struct aat1290_led *fled_cdev_to_led( return container_of(fled_cdev, struct aat1290_led, fled_cdev); } +static struct led_classdev_flash *led_cdev_to_fled_cdev( + struct led_classdev *led_cdev) +{ + return container_of(led_cdev, struct led_classdev_flash, led_cdev); +} + static void aat1290_as2cwire_write(struct aat1290_led *led, int addr, int value) { int i; @@ -134,9 +137,14 @@ static void aat1290_set_flash_safety_timer(struct aat1290_led *led, flash_tm_reg); } -static void aat1290_brightness_set(struct aat1290_led *led, +/* LED subsystem callbacks */ + +static void aat1290_led_brightness_set(struct led_classdev *led_cdev, enum led_brightness brightness) { + struct led_classdev_flash *fled_cdev = led_cdev_to_fled_cdev(led_cdev); + struct aat1290_led *led = fled_cdev_to_led(fled_cdev); + mutex_lock(&led->lock); if (brightness == 0) { @@ -160,26 +168,6 @@ static void aat1290_brightness_set(struct aat1290_led *led, mutex_unlock(&led->lock); } -/* LED subsystem callbacks */ - -static void aat1290_brightness_set_work(struct work_struct *work) -{ - struct aat1290_led *led = - container_of(work, struct aat1290_led, work_brightness_set); - - aat1290_brightness_set(led, led->torch_brightness); -} - -static void aat1290_led_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); - struct aat1290_led *led = fled_cdev_to_led(fled_cdev); - - led->torch_brightness = brightness; - schedule_work(&led->work_brightness_set); -} - static int aat1290_led_flash_strobe_set(struct led_classdev_flash *fled_cdev, bool state) @@ -500,8 +488,7 @@ static int aat1290_led_probe(struct platform_device *pdev) /* Initialize LED Flash class device */ led_cdev->brightness_set = aat1290_led_brightness_set; led_cdev->max_brightness = led_cfg.max_brightness; - led_cdev->flags |= LED_DEV_CAP_FLASH; - INIT_WORK(&led->work_brightness_set, aat1290_brightness_set_work); + led_cdev->flags |= LED_DEV_CAP_FLASH | LED_BRIGHTNESS_BLOCKING; aat1290_init_flash_timeout(led, &led_cfg); @@ -536,7 +523,6 @@ static int aat1290_led_remove(struct platform_device *pdev) v4l2_flash_release(led->v4l2_flash); led_classdev_flash_unregister(&led->fled_cdev); - cancel_work_sync(&led->work_brightness_set); mutex_destroy(&led->lock); -- 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/