Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753507AbbHTOqW (ORCPT ); Thu, 20 Aug 2015 10:46:22 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:41757 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752307AbbHTOqS (ORCPT ); Thu, 20 Aug 2015 10:46:18 -0400 X-AuditID: cbfee61b-f79706d000001b96-11-55d5e838fb3e From: Jacek Anaszewski To: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrew Lunn , Michael Hennerich , Jacek Anaszewski Subject: [PATCH/RFC v6 13/36] leds: adp5520: Remove work queue Date: Thu, 20 Aug 2015 16:43:43 +0200 Message-id: <1440081846-11697-14-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+NgFmpjluLIzCtJLcpLzFFi42I5/e+xgK7Fi6uhBgc2WVicv3uI2aL36nNG i8u75rBZbH2zjtFiwuHN7A6sHq+uOnrs3PGZyaNvyypGj8+b5AJYorhsUlJzMstSi/TtErgy WvdtYC1YKl5x8PoFtgbGacJdjJwcEgImErf3z2OBsMUkLtxbz9bFyMUhJLCUUWLr4j3sEM5P RonNmyaDVbEJGEr8fPGaCcQWEbCR6J0xiQmkiFmgmVHixLa1YEXCAnYSc+feYO1i5OBgEVCV eDzVFSTMK+Ap8fvZOmaQsISAgsScSTYgYU6g8Lz5X9lBbCEBD4kX77cwT2DkXcDIsIpRIrUg uaA4KT3XKC+1XK84Mbe4NC9dLzk/dxMjOHSeSe9gPLzL/RCjAAejEg/vBeGroUKsiWXFlbmH GCU4mJVEeG89AwrxpiRWVqUW5ccXleakFh9ilOZgURLn1TfZFCokkJ5YkpqdmlqQWgSTZeLg lGpgVJi/dW73vF2Tb7LEbzl27HnWbLmTYsdTTobyP/q8YlnsDfu5e2fudfu3uXaFhcryKucf hQod58wW/nZWalJl3nImWkp4M19zuGhBVada5RwtiXlHRXQPZRf7TGpaIBKtkCAdXS58Ma9p eaKe1heb0/9rPy+/178utiO+uuLl/XXJGvHrFdbeU2Ipzkg01GIuKk4EAJUZdIIZAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3130 Lines: 101 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 Cc: Michael Hennerich Signed-off-by: Jacek Anaszewski --- drivers/leds/leds-adp5520.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/leds/leds-adp5520.c b/drivers/leds/leds-adp5520.c index 07e66ca..853b2d3 100644 --- a/drivers/leds/leds-adp5520.c +++ b/drivers/leds/leds-adp5520.c @@ -17,34 +17,24 @@ #include #include #include -#include #include #include struct adp5520_led { struct led_classdev cdev; - struct work_struct work; struct device *master; - enum led_brightness new_brightness; int id; int flags; }; -static void adp5520_led_work(struct work_struct *work) -{ - struct adp5520_led *led = container_of(work, struct adp5520_led, work); - adp5520_write(led->master, ADP5520_LED1_CURRENT + led->id - 1, - led->new_brightness >> 2); -} - -static void adp5520_led_set(struct led_classdev *led_cdev, +static int adp5520_led_set(struct led_classdev *led_cdev, enum led_brightness value) { struct adp5520_led *led; led = container_of(led_cdev, struct adp5520_led, cdev); - led->new_brightness = value; - schedule_work(&led->work); + return adp5520_write(led->master, ADP5520_LED1_CURRENT + led->id - 1, + value >> 2); } static int adp5520_led_setup(struct adp5520_led *led) @@ -135,7 +125,7 @@ static int adp5520_led_probe(struct platform_device *pdev) led_dat->cdev.name = cur_led->name; led_dat->cdev.default_trigger = cur_led->default_trigger; - led_dat->cdev.brightness_set = adp5520_led_set; + led_dat->cdev.brightness_set_blocking = adp5520_led_set; led_dat->cdev.brightness = LED_OFF; if (cur_led->flags & ADP5520_FLAG_LED_MASK) @@ -146,9 +136,6 @@ static int adp5520_led_probe(struct platform_device *pdev) led_dat->id = led_dat->flags & ADP5520_FLAG_LED_MASK; led_dat->master = pdev->dev.parent; - led_dat->new_brightness = LED_OFF; - - INIT_WORK(&led_dat->work, adp5520_led_work); ret = led_classdev_register(led_dat->master, &led_dat->cdev); if (ret) { @@ -170,10 +157,8 @@ static int adp5520_led_probe(struct platform_device *pdev) err: if (i > 0) { - 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); - } } return ret; @@ -192,7 +177,6 @@ static int adp5520_led_remove(struct platform_device *pdev) for (i = 0; i < pdata->num_leds; i++) { 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/