Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965125AbbHKJkP (ORCPT ); Tue, 11 Aug 2015 05:40:15 -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 S964856AbbHKJkI (ORCPT ); Tue, 11 Aug 2015 05:40:08 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-aa-55c9c2e119d4 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 , Guennadi Liakhovetski , Jacek Anaszewski Subject: [PATCH/RFC v5 29/57] leds: dac124d085: Remove work queue Date: Tue, 11 Aug 2015 11:37:42 +0200 Message-id: <1439285890-27329-30-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+NgFlrELMWRmVeSWpSXmKPExsVy+t9jQd2Hh06GGrzaqWxx/u4hZoujOycy WbzfOI/Jovfqc0aLy7vmsFlsfbOO0WL3rqesFp1901gcODx2zrrL7vHhY5zHzh2fmTz2zP/B 6tG3ZRWjR9OpdlaPz5vkAtijuGxSUnMyy1KL9O0SuDLOvDEs2CVZsfnKdbYGxhsiXYycHBIC JhIvtl5mgbDFJC7cW8/WxcjFISQwi1Hi0dm1LBDOT0aJrr132UCq2AQMJX6+eM3UxcjBISIg J7HzTCVIDbPAY0aJ9udT2UDiwgKOEnv314KUswioShyY9IERxOYV8JS4tvUCC0iJhICCxJxJ NiBhTqDw9eeLwEqEBDwkjs9uYpvAyLuAkWEVo0RqQXJBcVJ6rmFearlecWJucWleul5yfu4m RnDIPZPawXhwl/shRgEORiUeoAUnQ4VYE8uKK3MPMUpwMCuJ8BZOBQrxpiRWVqUW5ccXleak Fh9ilOZgURLnld2wOVRIID2xJDU7NbUgtQgmy8TBKdXAqHGi68Ie94BQeyXZRVsZFtT973O8 IR0b5e1+xny/Glftz5995lb1JyLYF7vlTD8uOG9vwZ8Dm0UaM7OtYivVOHuq/nFzFDv9tGAX OqNRF+m1I8CiRELNs25WbtYS+csnL9dsEpX44eJ1sTq0ruGS9gejsPYL26NP7q74b3O8eNqB f6++yn1WYinOSDTUYi4qTgQAH6Qn7TUCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3397 Lines: 111 From: Andrew Lunn Now the core implements the work queue, remove it from the drivers. Signed-off-by: Andrew Lunn Cc: Guennadi Liakhovetski Signed-off-by: Jacek Anaszewski --- drivers/leds/leds-dac124s085.c | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c index db3ba8b..62039a1 100644 --- a/drivers/leds/leds-dac124s085.c +++ b/drivers/leds/leds-dac124s085.c @@ -13,20 +13,15 @@ #include #include #include -#include -#include #include struct dac124s085_led { struct led_classdev ldev; struct spi_device *spi; int id; - int brightness; char name[sizeof("dac124s085-3")]; struct mutex mutex; - struct work_struct work; - spinlock_t lock; }; struct dac124s085 { @@ -38,31 +33,20 @@ struct dac124s085 { #define ALL_WRITE_UPDATE (2 << 12) #define POWER_DOWN_OUTPUT (3 << 12) -static void dac124s085_led_work(struct work_struct *work) +static void dac124s085_set_brightness(struct led_classdev *ldev, + enum led_brightness brightness) { - struct dac124s085_led *led = container_of(work, struct dac124s085_led, - work); + struct dac124s085_led *led = container_of(ldev, struct dac124s085_led, + ldev); u16 word; mutex_lock(&led->mutex); word = cpu_to_le16(((led->id) << 14) | REG_WRITE_UPDATE | - (led->brightness & 0xfff)); + (brightness & 0xfff)); spi_write(led->spi, (const u8 *)&word, sizeof(word)); mutex_unlock(&led->mutex); } -static void dac124s085_set_brightness(struct led_classdev *ldev, - enum led_brightness brightness) -{ - struct dac124s085_led *led = container_of(ldev, struct dac124s085_led, - ldev); - - spin_lock(&led->lock); - led->brightness = brightness; - schedule_work(&led->work); - spin_unlock(&led->lock); -} - static int dac124s085_probe(struct spi_device *spi) { struct dac124s085 *dac; @@ -78,16 +62,14 @@ static int dac124s085_probe(struct spi_device *spi) for (i = 0; i < ARRAY_SIZE(dac->leds); i++) { led = dac->leds + i; led->id = i; - led->brightness = LED_OFF; led->spi = spi; snprintf(led->name, sizeof(led->name), "dac124s085-%d", i); - spin_lock_init(&led->lock); - INIT_WORK(&led->work, dac124s085_led_work); mutex_init(&led->mutex); led->ldev.name = led->name; led->ldev.brightness = LED_OFF; led->ldev.max_brightness = 0xfff; led->ldev.brightness_set = dac124s085_set_brightness; + led->ldev.flags |= LED_BRIGHTNESS_BLOCKING; ret = led_classdev_register(&spi->dev, &led->ldev); if (ret < 0) goto eledcr; @@ -109,10 +91,8 @@ static int dac124s085_remove(struct spi_device *spi) struct dac124s085 *dac = spi_get_drvdata(spi); int i; - for (i = 0; i < ARRAY_SIZE(dac->leds); i++) { + for (i = 0; i < ARRAY_SIZE(dac->leds); i++) led_classdev_unregister(&dac->leds[i].ldev); - cancel_work_sync(&dac->leds[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/