Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946149AbbGQJCj (ORCPT ); Fri, 17 Jul 2015 05:02:39 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:42357 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1945936AbbGQItL (ORCPT ); Fri, 17 Jul 2015 04:49:11 -0400 X-AuditID: cbfee61a-f79516d000006302-15-55a8c1868863 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, Jacek Anaszewski , Andrew Lunn , Antonio Ospite Subject: [PATCH/RFC 28/51] leds: regulator: Remove work queue Date: Fri, 17 Jul 2015 10:47:14 +0200 Message-id: <1437122857-6765-29-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+NgFlrALMWRmVeSWpSXmKPExsVy+t9jAd22gytCDRZcFrU4f/cQs8XRnROZ LHqvPme0uLxrDpvF1jfrGC1+d+9msdi96ymrRWffNBYHDo+ds+6ye+zc8ZnJY8/8H6wefVtW MXocurCOxaPpVDurx+dNcgHsUVw2Kak5mWWpRfp2CVwZH6edZCxYLl3RunwfSwPjarEuRk4O CQETiatXL7FA2GISF+6tZ+ti5OIQEljEKPHg9mqwhJDAT0aJDzd1QGw2AUOJny9eM3UxcnCI CMhJ7DxTCVLPLHCXUaJv1ysmkBphAVuJjceOMYLUsAioSjw/rA0S5hXwkFgwdwIbSFhCQEFi ziQbkDAnUPj9g5VQm9wl2v5cZJvAyLuAkWEVo2hqQXJBcVJ6rqFecWJucWleul5yfu4mRnC4 PZPawbiyweIQowAHoxIPb4PrilAh1sSy4srcQ4wSHMxKIryVO4FCvCmJlVWpRfnxRaU5qcWH GKU5WJTEeU/m+4QKCaQnlqRmp6YWpBbBZJk4OKUaGMUUuP6fVCvJtpzJ7Xb8rqPUKaaNXssP Tot/YvR4xZcHRieWLijy/RW3vk+s/uCM6D96Kqcnv561nWlCwYPpBZs3HOC0n6Gwwvxy98EL 33Tj8u7fjvgjo6qfrrdfZH2Z+b2PYv8+q30+ayf2inel15oMz0c/1tdPtlj8QJl1TxXvkbNz ++rk3mxSYinOSDTUYi4qTgQAXmhLJjMCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3614 Lines: 131 Now the core implements the work queue, remove it from the drivers. Signed-off-by: Andrew Lunn Cc: Antonio Ospite --- drivers/leds/leds-regulator.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c index ffc2139..87615e1 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,23 @@ 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_set_value(struct regulator_led *led, + enum led_brightness value) { 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,21 +121,12 @@ 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); + regulator_led_set_value(led, value); } static int regulator_led_probe(struct platform_device *pdev) @@ -169,7 +158,6 @@ 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; @@ -181,21 +169,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_set_value(led, led->cdev.brightness); return 0; } @@ -205,7 +190,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/