Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934446AbbHKJrV (ORCPT ); Tue, 11 Aug 2015 05:47:21 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:60724 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965091AbbHKJkM (ORCPT ); Tue, 11 Aug 2015 05:40:12 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-bd-55c9c2ec288a 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 , Antonio Ospite , Jacek Anaszewski Subject: [PATCH/RFC v5 33/57] leds: regulator: Remove work queue Date: Tue, 11 Aug 2015 11:37:46 +0200 Message-id: <1439285890-27329-34-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+NgFlrKLMWRmVeSWpSXmKPExsVy+t9jQd03h06GGjz9oGtx/u4hZoujOycy WfRefc5ocXnXHDaLrW/WMVr87t7NYrF711NWi86+aSwOHB47Z91l99i54zOTx575P1g9+ras YvQ4dGEdi0fTqXZWj8+b5ALYo7hsUlJzMstSi/TtErgyPt+9wV6wUa7i17NprA2MLZJdjJwc EgImEj+v72aCsMUkLtxbz9bFyMUhJDCLUWLRj4lMEM5PRokdV6exgVSxCRhK/HzxGijBwSEi ICex80wlSA2zwH1GiRkN59lBaoQFHCTenb7JAmKzCKhKfH27kRXE5hXwlPj88RoLSK+EgILE nEk2IGFOoPD154sYQWwhAQ+J47Ob2CYw8i5gZFjFKJFakFxQnJSea5iXWq5XnJhbXJqXrpec n7uJERx4z6R2MB7c5X6IUYCDUYkHaMHJUCHWxLLiytxDjBIczEoivIVTgUK8KYmVValF+fFF pTmpxYcYpTlYlMR5ZTdsDhUSSE8sSc1OTS1ILYLJMnFwSjUwTokyOHQnZJIcw5+JThe8XO+5 M7RXn0ielD27VPh4XeSHR6p1UXKmR5b+3f5+t7D/ls7IFfIn088+tP3Ys8lLb8mkTSxBrdd0 nRoWLnqsHBOi4a07I/X32mrRtmuaHDbMjvsir1em+4o8myc+K+HGiQ0ffa4ofvU4s0pH9Ziq 4zmxmKPfGQL8lFiKMxINtZiLihMBPmc4lzgCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3998 Lines: 141 From: Andrew Lunn Now the core implements the work queue, remove it from the drivers. Signed-off-by: Andrew Lunn Cc: Antonio Ospite Signed-off-by: Jacek Anaszewski --- drivers/leds/leds-regulator.c | 43 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c index ffc2139..73af223 100644 --- a/drivers/leds/leds-regulator.c +++ b/drivers/leds/leds-regulator.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -25,10 +24,8 @@ struct regulator_led { struct led_classdev cdev; - enum led_brightness value; int enabled; struct mutex mutex; - struct work_struct work; struct regulator *vcc; }; @@ -94,22 +91,24 @@ static void regulator_led_disable(struct regulator_led *led) led->enabled = 0; } -static void regulator_led_set_value(struct regulator_led *led) +static void regulator_led_brightness_set(struct led_classdev *led_cdev, + enum led_brightness value) { + struct regulator_led *led = to_regulator_led(led_cdev); int voltage; int ret; mutex_lock(&led->mutex); - if (led->value == LED_OFF) { + if (value == LED_OFF) { regulator_led_disable(led); goto out; } if (led->cdev.max_brightness > 1) { - voltage = led_regulator_get_voltage(led->vcc, led->value); + voltage = led_regulator_get_voltage(led->vcc, value); dev_dbg(led->cdev.dev, "brightness: %d voltage: %d\n", - led->value, voltage); + value, voltage); ret = regulator_set_voltage(led->vcc, voltage, voltage); if (ret != 0) @@ -123,23 +122,6 @@ out: mutex_unlock(&led->mutex); } -static void led_work(struct work_struct *work) -{ - struct regulator_led *led; - - led = container_of(work, struct regulator_led, work); - regulator_led_set_value(led); -} - -static void regulator_led_brightness_set(struct led_classdev *led_cdev, - enum led_brightness value) -{ - struct regulator_led *led = to_regulator_led(led_cdev); - - led->value = value; - schedule_work(&led->work); -} - static int regulator_led_probe(struct platform_device *pdev) { struct led_regulator_platform_data *pdata = @@ -169,11 +151,10 @@ static int regulator_led_probe(struct platform_device *pdev) pdata->brightness); return -EINVAL; } - led->value = pdata->brightness; led->cdev.brightness_set = regulator_led_brightness_set; led->cdev.name = pdata->name; - led->cdev.flags |= LED_CORE_SUSPENDRESUME; + led->cdev.flags |= LED_CORE_SUSPENDRESUME | LED_BRIGHTNESS_BLOCKING; led->vcc = vcc; /* to handle correctly an already enabled regulator */ @@ -181,21 +162,18 @@ static int regulator_led_probe(struct platform_device *pdev) led->enabled = 1; mutex_init(&led->mutex); - INIT_WORK(&led->work, led_work); platform_set_drvdata(pdev, led); ret = led_classdev_register(&pdev->dev, &led->cdev); - if (ret < 0) { - cancel_work_sync(&led->work); + if (ret < 0) return ret; - } /* to expose the default value to userspace */ - led->cdev.brightness = led->value; + led->cdev.brightness = pdata->brightness; /* Set the default led status */ - regulator_led_set_value(led); + regulator_led_brightness_set(&led->cdev, led->cdev.brightness); return 0; } @@ -205,7 +183,6 @@ static int regulator_led_remove(struct platform_device *pdev) struct regulator_led *led = platform_get_drvdata(pdev); led_classdev_unregister(&led->cdev); - cancel_work_sync(&led->work); regulator_led_disable(led); 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/