Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965000AbbHKJjZ (ORCPT ); Tue, 11 Aug 2015 05:39:25 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:37728 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964909AbbHKJjU (ORCPT ); Tue, 11 Aug 2015 05:39:20 -0400 X-AuditID: cbfee61b-f79706d000001b96-4e-55c9c2c75696 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 20/57] leds: lp3944: Remove work queue Date: Tue, 11 Aug 2015 11:37:33 +0200 Message-id: <1439285890-27329-21-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+NgFlrCLMWRmVeSWpSXmKPExsVy+t9jQd3jh06GGtxuELY4f/cQs8XRnROZ LHqvPme0uLxrDpvF1jfrGC1+d+9msdi96ymrRWffNBYHDo+ds+6ye+zc8ZnJY8/8H6wefVtW MXocurCOxaPpVDurx+dNcgHsUVw2Kak5mWWpRfp2CVwZLzumMRYslam4fKy6gbFJvIuRk0NC wERi7umPTBC2mMSFe+vZuhi5OIQEZjFKPJzQyg7h/ARyWiczglSxCRhK/HzxGqiDg0NEQE5i 55lKkBpmgfuMEjMazrOD1AgL2EpMvn0ZrJ5FQFXi5fN2MJtXwFPi/MVbbCC9EgIKEnMm2YCE OYHC158vAisREvCQOD67iW0CI+8CRoZVjBKpBckFxUnpuUZ5qeV6xYm5xaV56XrJ+bmbGMFh 90x6B+PhXe6HGAU4GJV4gBacDBViTSwrrsw9xCjBwawkwls4FSjEm5JYWZValB9fVJqTWnyI UZqDRUmcV99kU6iQQHpiSWp2ampBahFMlomDU6qBkWdT40GfH1muMyOWbzRq/avNH25oOnvC HslfmU56nb2ul6a3M/kZ/OVVilSYtWtdznqlMgF1z+7tcvO3a02u22Jpc/3+j6r1sZ0P9hRf 6j7EaZtq1Vrw3yDNWz7Lat4SM60TfO/dZqnvmh2oczpvSc7RnwdtvGw6hE/9Ui1o2bty7+ez d+9eUmIpzkg01GIuKk4EAH3HRQY3AgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3750 Lines: 121 From: Andrew Lunn Now the core implements the work queue, remove it from the driver. Signed-off-by: Andrew Lunn Cc: Antonio Ospite Signed-off-by: Jacek Anaszewski --- drivers/leds/leds-lp3944.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/drivers/leds/leds-lp3944.c b/drivers/leds/leds-lp3944.c index 53144fb..4b90663 100644 --- a/drivers/leds/leds-lp3944.c +++ b/drivers/leds/leds-lp3944.c @@ -31,7 +31,6 @@ #include #include #include -#include #include /* Read Only Registers */ @@ -68,10 +67,8 @@ struct lp3944_led_data { u8 id; enum lp3944_type type; - enum lp3944_status status; struct led_classdev ldev; struct i2c_client *client; - struct work_struct work; }; struct lp3944_data { @@ -275,8 +272,7 @@ static int lp3944_led_set_blink(struct led_classdev *led_cdev, dev_dbg(&led->client->dev, "%s: OK hardware accelerated blink!\n", __func__); - led->status = LP3944_LED_STATUS_DIM0; - schedule_work(&led->work); + lp3944_led_set(led, LP3944_LED_STATUS_DIM0); return 0; } @@ -289,16 +285,7 @@ static void lp3944_led_set_brightness(struct led_classdev *led_cdev, dev_dbg(&led->client->dev, "%s: %s, %d\n", __func__, led_cdev->name, brightness); - led->status = !!brightness; - schedule_work(&led->work); -} - -static void lp3944_led_work(struct work_struct *work) -{ - struct lp3944_led_data *led; - - led = container_of(work, struct lp3944_led_data, work); - lp3944_led_set(led, led->status); + lp3944_led_set(led, !!brightness); } static int lp3944_configure(struct i2c_client *client, @@ -318,14 +305,13 @@ static int lp3944_configure(struct i2c_client *client, case LP3944_LED_TYPE_LED: case LP3944_LED_TYPE_LED_INVERTED: led->type = pled->type; - led->status = pled->status; led->ldev.name = pled->name; led->ldev.max_brightness = 1; led->ldev.brightness_set = lp3944_led_set_brightness; led->ldev.blink_set = lp3944_led_set_blink; - led->ldev.flags = LED_CORE_SUSPENDRESUME; + led->ldev.flags = LED_CORE_SUSPENDRESUME | + LED_BRIGHTNESS_BLOCKING; - INIT_WORK(&led->work, lp3944_led_work); err = led_classdev_register(&client->dev, &led->ldev); if (err < 0) { dev_err(&client->dev, @@ -336,14 +322,14 @@ static int lp3944_configure(struct i2c_client *client, /* to expose the default value to userspace */ led->ldev.brightness = - (enum led_brightness) led->status; + (enum led_brightness) pled->status; /* Set the default led status */ - err = lp3944_led_set(led, led->status); + err = lp3944_led_set(led, pled->status); if (err < 0) { dev_err(&client->dev, "%s couldn't set STATUS %d\n", - led->ldev.name, led->status); + led->ldev.name, pled->status); goto exit; } break; @@ -364,7 +350,6 @@ exit: case LP3944_LED_TYPE_LED: case LP3944_LED_TYPE_LED_INVERTED: led_classdev_unregister(&data->leds[i].ldev); - cancel_work_sync(&data->leds[i].work); break; case LP3944_LED_TYPE_NONE: @@ -424,7 +409,6 @@ static int lp3944_remove(struct i2c_client *client) case LP3944_LED_TYPE_LED: case LP3944_LED_TYPE_LED_INVERTED: led_classdev_unregister(&data->leds[i].ldev); - cancel_work_sync(&data->leds[i].work); break; case LP3944_LED_TYPE_NONE: -- 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/