Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965065AbbHKJjt (ORCPT ); Tue, 11 Aug 2015 05:39:49 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:52667 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965027AbbHKJjq (ORCPT ); Tue, 11 Aug 2015 05:39:46 -0400 X-AuditID: cbfee61b-f79706d000001b96-6f-55c9c2de2512 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 Subject: [PATCH/RFC v5 28/57] leds: da9052: Remove work queue Date: Tue, 11 Aug 2015 11:37:41 +0200 Message-id: <1439285890-27329-29-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+NgFprFLMWRmVeSWpSXmKPExsVy+t9jQd17h06GGny7qm5x/u4hZoujOycy WfRefc5ocXnXHDaLrW/WMVrs3vWU1aKzbxqLA7vHzll3gcSOz0wee+b/YPXo27KK0aPpVDur x+dNcgFsUVw2Kak5mWWpRfp2CVwZG7fOYS5ok61YfnAeawPjI/EuRk4OCQETiemzl7BD2GIS F+6tZ+ti5OIQEpjFKNE9rY8ZwvnJKHFz6npmkCo2AUOJny9eM3UxcnCICMhJ7DxTCVLDLLCJ UeLy0S5WkBphAVuJFXOvMILUsAioSmx+lAoS5hXwlFj6/REbSFhCQEFiziQbkDAnUPj680WM ILaQgIfE8dlNbBMYeRcwMqxilEgtSC4oTkrPNcpLLdcrTswtLs1L10vOz93ECA6xZ9I7GA/v cj/EKMDBqMQDtOBkqBBrYllxZe4hRgkOZiUR3sKpQCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8 +iabQoUE0hNLUrNTUwtSi2CyTBycUg2M+5drb3brMuO7eCPFP5zlU1IMQxaz4PJVX/ccTcm2 cfgeqh7Eo1m89/nnsPeh37j2BS1d/J3RNPmpWfirtEluLhbe7dpx2e1fHOZoyPjI72o16u+f LNA66bKXsk+WRiaH0349xpqrsvuclzMVrTgXMjsmJ+T++/8mks+KrnLHr6id93+PiKMSS3FG oqEWc1FxIgCpj13YLQIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3839 Lines: 129 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 --- drivers/leds/leds-da9052.c | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/drivers/leds/leds-da9052.c b/drivers/leds/leds-da9052.c index 28291b6..8e5229e 100644 --- a/drivers/leds/leds-da9052.c +++ b/drivers/leds/leds-da9052.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -32,11 +31,9 @@ struct da9052_led { struct led_classdev cdev; - struct work_struct work; struct da9052 *da9052; unsigned char led_index; unsigned char id; - int brightness; }; static unsigned char led_reg[] = { @@ -44,12 +41,13 @@ static unsigned char led_reg[] = { DA9052_LED_CONT_5_REG, }; -static int da9052_set_led_brightness(struct da9052_led *led) +static int da9052_set_led_brightness(struct da9052_led *led, + enum led_brightness brightness) { u8 val; int error; - val = (led->brightness & 0x7f) | DA9052_LED_CONT_DIM; + val = (brightness & 0x7f) | DA9052_LED_CONT_DIM; error = da9052_reg_write(led->da9052, led_reg[led->led_index], val); if (error < 0) @@ -58,21 +56,13 @@ static int da9052_set_led_brightness(struct da9052_led *led) return error; } -static void da9052_led_work(struct work_struct *work) -{ - struct da9052_led *led = container_of(work, struct da9052_led, work); - - da9052_set_led_brightness(led); -} - static void da9052_led_set(struct led_classdev *led_cdev, enum led_brightness value) { - struct da9052_led *led; + struct da9052_led *led = + container_of(led_cdev, struct da9052_led, cdev); - led = container_of(led_cdev, struct da9052_led, cdev); - led->brightness = value; - schedule_work(&led->work); + da9052_set_led_brightness(led, value); } static int da9052_configure_leds(struct da9052 *da9052) @@ -136,10 +126,9 @@ static int da9052_led_probe(struct platform_device *pdev) led[i].cdev.brightness_set = da9052_led_set; led[i].cdev.brightness = LED_OFF; led[i].cdev.max_brightness = DA9052_MAX_BRIGHTNESS; - led[i].brightness = LED_OFF; + led[i].cdev.flags |= LED_BRIGHTNESS_BLOCKING; led[i].led_index = pled->leds[i].flags; led[i].da9052 = dev_get_drvdata(pdev->dev.parent); - INIT_WORK(&led[i].work, da9052_led_work); error = led_classdev_register(pdev->dev.parent, &led[i].cdev); if (error) { @@ -148,7 +137,8 @@ static int da9052_led_probe(struct platform_device *pdev) goto err_register; } - error = da9052_set_led_brightness(&led[i]); + error = da9052_set_led_brightness(&led[i], + led[i].cdev.brightness); if (error) { dev_err(&pdev->dev, "Unable to init led %d\n", led[i].led_index); @@ -166,10 +156,8 @@ static int da9052_led_probe(struct platform_device *pdev) return 0; err_register: - for (i = i - 1; i >= 0; i--) { + for (i = i - 1; i >= 0; i--) led_classdev_unregister(&led[i].cdev); - cancel_work_sync(&led[i].work); - } err: return error; } @@ -187,10 +175,8 @@ static int da9052_led_remove(struct platform_device *pdev) pled = pdata->pled; for (i = 0; i < pled->num_leds; i++) { - led[i].brightness = 0; - da9052_set_led_brightness(&led[i]); + da9052_set_led_brightness(&led[i], LED_OFF); led_classdev_unregister(&led[i].cdev); - cancel_work_sync(&led[i].work); } return 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/