Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753486AbbHTOqO (ORCPT ); Thu, 20 Aug 2015 10:46:14 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:55569 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753423AbbHTOqJ (ORCPT ); Thu, 20 Aug 2015 10:46:09 -0400 X-AuditID: cbfee61b-f79706d000001b96-00-55d5e82fb1b5 From: Jacek Anaszewski To: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrew Lunn , Jacek Anaszewski Subject: [PATCH/RFC v6 12/36] leds: 88pm860x: Remove work queue Date: Thu, 20 Aug 2015 16:43:42 +0200 Message-id: <1440081846-11697-13-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+NgFvrLJMWRmVeSWpSXmKPExsVy+t9jAV39F1dDDQ7d17E4f/cQs0Xv1eeM Fpd3zWGz2PpmHaMDi8fOHZ+ZPPq2rGL0+LxJLoA5issmJTUnsyy1SN8ugSvj3Js5TAW/hSvu LtnF2sB4QKCLkZNDQsBEov/wUhYIW0ziwr31bF2MXBxCAksZJe70HmSCcH4ySrxc94URpIpN wFDi54vXTCC2iICNRO+MSWA2s4CvxJX9K5hBbGEBe4mvV7rBprIIqEo0bfoP1ssr4CnRs/Md UA0H0DYFiTmTbEDCnEDhefO/soPYQgIeEi/eb2GewMi7gJFhFaNEakFyQXFSeq5RXmq5XnFi bnFpXrpecn7uJkZwoDyT3sF4eJf7IUYBDkYlHt4LwldDhVgTy4orcw8xSnAwK4nw3noGFOJN SaysSi3Kjy8qzUktPsQozcGiJM6rb7IpVEggPbEkNTs1tSC1CCbLxMEp1cDIm//3XNeZhHWT Jmj0TCvNn7bZaC/H2veyzya2qLjbrSlf+bOHyej5jt+rljkZnDMOv5nMyDaLa79g/NP51skr fvlNmyC7P39J54EikYRN7ldEcl6nC7M98XjUsWICO4v2bDVt9uiCjdWTQrOYde8pPDhqt1N6 7uLPDPEtRx4fSG+QzwlizLuixFKckWioxVxUnAgAu9wETRACAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2715 Lines: 90 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 Signed-off-by: Jacek Anaszewski --- drivers/leds/leds-88pm860x.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c index 1497a09..c9fcf49 100644 --- a/drivers/leds/leds-88pm860x.c +++ b/drivers/leds/leds-88pm860x.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -33,7 +32,6 @@ struct pm860x_led { struct led_classdev cdev; struct i2c_client *i2c; - struct work_struct work; struct pm860x_chip *chip; struct mutex lock; char name[MFD_NAME_SIZE]; @@ -69,17 +67,18 @@ static int led_power_set(struct pm860x_chip *chip, int port, int on) return ret; } -static void pm860x_led_work(struct work_struct *work) +static int pm860x_led_set(struct led_classdev *cdev, + enum led_brightness value) { - - struct pm860x_led *led; + struct pm860x_led *led = container_of(cdev, struct pm860x_led, cdev); struct pm860x_chip *chip; unsigned char buf[3]; int ret; - led = container_of(work, struct pm860x_led, work); chip = led->chip; mutex_lock(&led->lock); + led->brightness = value >> 3; + if ((led->current_brightness == 0) && led->brightness) { led_power_set(chip, led->port, 1); if (led->iset) { @@ -112,15 +111,8 @@ static void pm860x_led_work(struct work_struct *work) dev_dbg(chip->dev, "Update LED. (reg:%d, brightness:%d)\n", led->reg_control, led->brightness); mutex_unlock(&led->lock); -} -static void pm860x_led_set(struct led_classdev *cdev, - enum led_brightness value) -{ - struct pm860x_led *data = container_of(cdev, struct pm860x_led, cdev); - - data->brightness = value >> 3; - schedule_work(&data->work); + return 0; } #ifdef CONFIG_OF @@ -212,9 +204,8 @@ static int pm860x_led_probe(struct platform_device *pdev) data->current_brightness = 0; data->cdev.name = data->name; - data->cdev.brightness_set = pm860x_led_set; + data->cdev.brightness_set_blocking = pm860x_led_set; mutex_init(&data->lock); - INIT_WORK(&data->work, pm860x_led_work); ret = led_classdev_register(chip->dev, &data->cdev); if (ret < 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/