Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965067AbbHKJuO (ORCPT ); Tue, 11 Aug 2015 05:50:14 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:58965 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964861AbbHKJjR (ORCPT ); Tue, 11 Aug 2015 05:39:17 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-80-55c9c2c44524 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 , Jacek Anaszewski Subject: [PATCH/RFC v5 19/57] leds: pca9532: Remove work queue for LEDs. Date: Tue, 11 Aug 2015 11:37:32 +0200 Message-id: <1439285890-27329-20-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+NgFprNLMWRmVeSWpSXmKPExsVy+t9jQd0jh06GGrReELM4f/cQs8XRnROZ LHqvPme0uLxrDpvF1jfrGC1273rKatHZN43Fgd1j56y7QGLHZyaPPfN/sHr0bVnF6NF0qp3V 4/MmuQC2KC6blNSczLLUIn27BK6MvQfeshc8F6rY93U+awPjJf4uRk4OCQETifc9D5ghbDGJ C/fWs3UxcnEICcxilPj7bDkrhPOTUeLcwv8sIFVsAoYSP1+8Zupi5OAQEZCT2HmmEqSGWWAT o8Tlo12sIDXCAh4ST7pWsIPYLAKqEt/evWEDsXkFPCX+PX4E1ishoCAxZ5INSJgTKHz9+SJG EFsIqPX47Ca2CYy8CxgZVjFKpBYkFxQnpeca5qWW6xUn5haX5qXrJefnbmIEB9kzqR2MB3e5 H2IU4GBU4gFacDJUiDWxrLgy9xCjBAezkghv4VSgEG9KYmVValF+fFFpTmrxIUZpDhYlcV7Z DZtDhQTSE0tSs1NTC1KLYLJMHJxSDYz6dvEJW4J+259e1b54lq7c9VW+HPn9D8wDTvU0N79Q L1iptbZpkt5EU7M0Wa45SRM/8+S28QWsTbxhNfPS+bX/0238O+MesC3e8cu/+dZ54XtrBP+y rmnd/WnaX7H7LctmPToVv8+f72jFBGHdXSYXr1eyrrpiKnfI/88xvvhGb+a1Zfl+oQeVWIoz Eg21mIuKEwEk3mM1LgIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2579 Lines: 78 From: Andrew Lunn Now the core implements the work queue, remove it from the driver. Signed-off-by: Andrew Lunn Signed-off-by: Jacek Anaszewski --- drivers/leds/leds-pca9532.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c index 5a6363d..18d4d61 100644 --- a/drivers/leds/leds-pca9532.c +++ b/drivers/leds/leds-pca9532.c @@ -174,7 +174,9 @@ static void pca9532_set_brightness(struct led_classdev *led_cdev, if (err) return; /* XXX: led api doesn't allow error code? */ } - schedule_work(&led->work); + if (led->state == PCA9532_PWM0) + pca9532_setpwm(led->client, 0); + pca9532_setled(led); } static int pca9532_set_blink(struct led_classdev *led_cdev, @@ -198,7 +200,10 @@ static int pca9532_set_blink(struct led_classdev *led_cdev, err = pca9532_calcpwm(client, 0, psc, led_cdev->brightness); if (err) return err; - schedule_work(&led->work); + if (led->state == PCA9532_PWM0) + pca9532_setpwm(led->client, 0); + pca9532_setled(led); + return 0; } @@ -233,15 +238,6 @@ static void pca9532_input_work(struct work_struct *work) mutex_unlock(&data->update_lock); } -static void pca9532_led_work(struct work_struct *work) -{ - struct pca9532_led *led; - led = container_of(work, struct pca9532_led, work); - if (led->state == PCA9532_PWM0) - pca9532_setpwm(led->client, 0); - pca9532_setled(led); -} - #ifdef CONFIG_LEDS_PCA9532_GPIO static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset) { @@ -307,7 +303,6 @@ static int pca9532_destroy_devices(struct pca9532_data *data, int n_devs) break; case PCA9532_TYPE_LED: led_classdev_unregister(&data->leds[i].ldev); - cancel_work_sync(&data->leds[i].work); break; case PCA9532_TYPE_N2100_BEEP: if (data->idev != NULL) { @@ -361,7 +356,7 @@ static int pca9532_configure(struct i2c_client *client, led->ldev.brightness = LED_OFF; led->ldev.brightness_set = pca9532_set_brightness; led->ldev.blink_set = pca9532_set_blink; - INIT_WORK(&led->work, pca9532_led_work); + led->ldev.flags |= LED_BRIGHTNESS_BLOCKING; err = led_classdev_register(&client->dev, &led->ldev); if (err < 0) { dev_err(&client->dev, -- 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/