Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946231AbbGQJEV (ORCPT ); Fri, 17 Jul 2015 05:04:21 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:43192 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932486AbbGQIs5 (ORCPT ); Fri, 17 Jul 2015 04:48:57 -0400 X-AuditID: cbfee61b-f79416d0000014c0-f1-55a8c17817b1 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 Subject: [PATCH/RFC 23/51] leds: da9052: Remove work queue Date: Fri, 17 Jul 2015 10:47:09 +0200 Message-id: <1437122857-6765-24-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1437122857-6765-1-git-send-email-j.anaszewski@samsung.com> References: <1437122857-6765-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjluLIzCtJLcpLzFFi42I5/e+xgG7FwRWhBh82iVucv3uI2eLozolM Fpd3zWGz2PpmHaPF7l1PWS06+6axOLB57Jx1l91j547PTB575v9g9Wg61c7q8XmTXABrFJdN SmpOZllqkb5dAlfG53lvGQumy1Qs33edrYHxn1gXIyeHhICJRNvFN0wQtpjEhXvr2boYuTiE BBYxStzY1ssK4fxklNh2rQ2sik3AUOLni9dANgeHiICcxM4zlSA1zALNjBJt/5pYQWqEBawk Vm++wghiswioSlzomwrWyyvgIfG+cw8jSK+EgILEnEk2IGFOkPCDlSwgtpCAu0Tbn4tsExh5 FzAyrGIUTS1ILihOSs810itOzC0uzUvXS87P3cQIDqVn0jsYVzVYHGIU4GBU4uFtcF0RKsSa WFZcmXuIUYKDWUmEt3InUIg3JbGyKrUoP76oNCe1+BCjNAeLkjjvyXyfUCGB9MSS1OzU1ILU IpgsEwenVANj5ZFl0te2Kbr/s0zsKK/4uZ7Tw7FCd0fcoSdB9ivq69yuhP2xYBCK5ri42qB9 38uzVjOU2q/zBkZcvrFk5a/ynI8dL+ZYysRzLu3+yD//p/7itD9pNuV7F/x/dfDZJj/JeOub GzZe+PVmr6fb1dWbCkR5Dt/UYIrLXTurkHvDv9XLFK55nT/8S4mlOCPRUIu5qDgRABFYcd0h AgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3730 Lines: 127 From: Andrew Lunn Now the core implements the work queue, remove it from the drivers. Signed-off-by: Andrew Lunn --- drivers/leds/leds-da9052.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/drivers/leds/leds-da9052.c b/drivers/leds/leds-da9052.c index 28291b6..e4dc010 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,8 @@ 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].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 +136,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 +155,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 +174,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/