Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964933AbbHKJjK (ORCPT ); Tue, 11 Aug 2015 05:39:10 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:41711 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933927AbbHKJjF (ORCPT ); Tue, 11 Aug 2015 05:39:05 -0400 X-AuditID: cbfee61b-f79706d000001b96-2c-55c9c2b87028 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 , Kim Kyuwon , Jacek Anaszewski Subject: [PATCH/RFC v5 15/57] leds: bd2802: Remove work queue Date: Tue, 11 Aug 2015 11:37:28 +0200 Message-id: <1439285890-27329-16-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+NgFprPLMWRmVeSWpSXmKPExsVy+t9jQd0dh06GGvw4KGpx/u4hZoujOycy WfRefc5ocXnXHDaLrW/WMVpsfDSLyWL3rqesFp1901gcODx2zrrL7rFzx2cmjz3zf7B69G1Z xejRdKqd1ePzJrkAtigum5TUnMyy1CJ9uwSujF13P7IVLNGo6Jl2hbmB8ZxiFyMnh4SAicSG w8cZIWwxiQv31rN1MXJxCAnMYpT4fPY+O4Tzk1Hi2fp1bCBVbAKGEj9fvGbqYuTgEBGQk9h5 phKkhlngMqPEtaY9bCBxYQFbifmfokDKWQRUJd6e+s8KYvMKeErcbH0AViIhoCAxZ5INSJgT KHz9+SKwG4QEPCSOz25im8DIu4CRYRWjRGpBckFxUnquUV5quV5xYm5xaV66XnJ+7iZGcLA9 k97BeHiX+yFGAQ5GJR6gBSdDhVgTy4orcw8xSnAwK4nwFk4FCvGmJFZWpRblxxeV5qQWH2KU 5mBREufVN9kUKiSQnliSmp2aWpBaBJNl4uCUamDMzXwtIWirp7Wif3vZhp9um1srRKUVLBj+ rJzEuN20X3SdSFB13IapvhlR3v9LZNuqRNa//Wg1tddra+XHBS1MU5mTT36fVJxzPTGxfzdb YHb+rvgcDYumybIafqrHlxiLVQStCJwiV2QnczLyhPgCiynnaqTKPBdX3ZKIsDwTX+9fNW/l LiWW4oxEQy3mouJEAHWmDvwyAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5268 Lines: 138 From: Andrew Lunn Now the core implements the work queue, remove it from the driver. Signed-off-by: Andrew Lunn Cc: Kim Kyuwon Signed-off-by: Jacek Anaszewski --- drivers/leds/leds-bd2802.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/leds/leds-bd2802.c b/drivers/leds/leds-bd2802.c index 6078c15d..9d1535a 100644 --- a/drivers/leds/leds-bd2802.c +++ b/drivers/leds/leds-bd2802.c @@ -72,7 +72,6 @@ struct bd2802_led { struct bd2802_led_platform_data *pdata; struct i2c_client *client; struct rw_semaphore rwsem; - struct work_struct work; struct led_state led[2]; @@ -518,16 +517,6 @@ static struct device_attribute *bd2802_attributes[] = { &bd2802_rgb_current_attr, }; -static void bd2802_led_work(struct work_struct *work) -{ - struct bd2802_led *led = container_of(work, struct bd2802_led, work); - - if (led->state) - bd2802_turn_on(led, led->led_id, led->color, led->state); - else - bd2802_turn_off(led, led->led_id, led->color); -} - #define BD2802_CONTROL_RGBS(name, id, clr) \ static void bd2802_set_##name##_brightness(struct led_classdev *led_cdev,\ enum led_brightness value) \ @@ -536,11 +525,13 @@ static void bd2802_set_##name##_brightness(struct led_classdev *led_cdev,\ container_of(led_cdev, struct bd2802_led, cdev_##name); \ led->led_id = id; \ led->color = clr; \ - if (value == LED_OFF) \ + if (value == LED_OFF) { \ led->state = BD2802_OFF; \ - else \ + bd2802_turn_off(led, led->led_id, led->color); \ + } else { \ led->state = BD2802_ON; \ - schedule_work(&led->work); \ + bd2802_turn_on(led, led->led_id, led->color, BD2802_ON);\ + } \ } \ static int bd2802_set_##name##_blink(struct led_classdev *led_cdev, \ unsigned long *delay_on, unsigned long *delay_off) \ @@ -552,7 +543,7 @@ static int bd2802_set_##name##_blink(struct led_classdev *led_cdev, \ led->led_id = id; \ led->color = clr; \ led->state = BD2802_BLINK; \ - schedule_work(&led->work); \ + bd2802_turn_on(led, led->led_id, led->color, BD2802_BLINK); \ return 0; \ } @@ -567,12 +558,11 @@ static int bd2802_register_led_classdev(struct bd2802_led *led) { int ret; - INIT_WORK(&led->work, bd2802_led_work); - led->cdev_led1r.name = "led1_R"; led->cdev_led1r.brightness = LED_OFF; led->cdev_led1r.brightness_set = bd2802_set_led1r_brightness; led->cdev_led1r.blink_set = bd2802_set_led1r_blink; + led->cdev_led1r.flags |= LED_BRIGHTNESS_BLOCKING; ret = led_classdev_register(&led->client->dev, &led->cdev_led1r); if (ret < 0) { @@ -585,6 +575,7 @@ static int bd2802_register_led_classdev(struct bd2802_led *led) led->cdev_led1g.brightness = LED_OFF; led->cdev_led1g.brightness_set = bd2802_set_led1g_brightness; led->cdev_led1g.blink_set = bd2802_set_led1g_blink; + led->cdev_led1g.flags |= LED_BRIGHTNESS_BLOCKING; ret = led_classdev_register(&led->client->dev, &led->cdev_led1g); if (ret < 0) { @@ -597,6 +588,7 @@ static int bd2802_register_led_classdev(struct bd2802_led *led) led->cdev_led1b.brightness = LED_OFF; led->cdev_led1b.brightness_set = bd2802_set_led1b_brightness; led->cdev_led1b.blink_set = bd2802_set_led1b_blink; + led->cdev_led1b.flags |= LED_BRIGHTNESS_BLOCKING; ret = led_classdev_register(&led->client->dev, &led->cdev_led1b); if (ret < 0) { @@ -609,6 +601,7 @@ static int bd2802_register_led_classdev(struct bd2802_led *led) led->cdev_led2r.brightness = LED_OFF; led->cdev_led2r.brightness_set = bd2802_set_led2r_brightness; led->cdev_led2r.blink_set = bd2802_set_led2r_blink; + led->cdev_led2r.flags |= LED_BRIGHTNESS_BLOCKING; ret = led_classdev_register(&led->client->dev, &led->cdev_led2r); if (ret < 0) { @@ -621,6 +614,7 @@ static int bd2802_register_led_classdev(struct bd2802_led *led) led->cdev_led2g.brightness = LED_OFF; led->cdev_led2g.brightness_set = bd2802_set_led2g_brightness; led->cdev_led2g.blink_set = bd2802_set_led2g_blink; + led->cdev_led2g.flags |= LED_BRIGHTNESS_BLOCKING; ret = led_classdev_register(&led->client->dev, &led->cdev_led2g); if (ret < 0) { @@ -633,7 +627,8 @@ static int bd2802_register_led_classdev(struct bd2802_led *led) led->cdev_led2b.brightness = LED_OFF; led->cdev_led2b.brightness_set = bd2802_set_led2b_brightness; led->cdev_led2b.blink_set = bd2802_set_led2b_blink; - led->cdev_led2b.flags |= LED_CORE_SUSPENDRESUME; + led->cdev_led2b.flags |= LED_CORE_SUSPENDRESUME | + LED_BRIGHTNESS_BLOCKING; ret = led_classdev_register(&led->client->dev, &led->cdev_led2b); if (ret < 0) { @@ -661,7 +656,6 @@ failed_unregister_led1_R: static void bd2802_unregister_led_classdev(struct bd2802_led *led) { - cancel_work_sync(&led->work); led_classdev_unregister(&led->cdev_led2b); led_classdev_unregister(&led->cdev_led2g); led_classdev_unregister(&led->cdev_led2r); -- 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/