Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964878AbbHKJiz (ORCPT ); Tue, 11 Aug 2015 05:38:55 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:36617 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964821AbbHKJiv (ORCPT ); Tue, 11 Aug 2015 05:38:51 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-31-55c9c2a93f68 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 , Sakari Ailus Subject: [PATCH/RFC v5 10/57] leds: max77693: Remove work queue Date: Tue, 11 Aug 2015 11:37:23 +0200 Message-id: <1439285890-27329-11-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+NgFprFLMWRmVeSWpSXmKPExsVy+t9jQd2Vh06GGuxaZmxxdOdEJoveq88Z LS7vmsNmsfXNOkaL3bueslp82vKNyaKzbxqLA7vHzll32T3mnQz02DP/B6tH35ZVjB5Np9pZ PT5vkgtgi+KySUnNySxLLdK3S+DK+HHlKGPBWtmKj4vPsjUwfpfoYuTkkBAwkTj29D4bhC0m ceHeeiCbi0NIYBajxLu979ghnJ+MEtN77jKCVLEJGEr8fPGaqYuRg0NEQE5i55lKkBpmgYOM EusvH2EFqREWsJf4t2oDWD2LgKrEyrNzwWxeAU+J45MOMYL0SggoSMyZZAMS5gQKX3++CKxE SMBD4vjsJrYJjLwLGBlWMUqkFiQXFCel5xrmpZbrFSfmFpfmpesl5+duYgSH2DOpHYwHd7kf YhTgYFTiAVpwMlSINbGsuDL3EKMEB7OSCG/hVKAQb0piZVVqUX58UWlOavEhRmkOFiVxXtkN m0OFBNITS1KzU1MLUotgskwcnFINjM6s6ZOf8DcFuj0R099Rn3uVY/K7U8FPV7mVfBHcdEUx 8fZr890re/OWKN5bq2dXFjo9WXhTQOy5Q6X7Ndbpzbr3VG/q8+n2ItPf3Lz5+Gj115g9mjVr tJQqwqf1Sn7UzDvz48+dqGPXNDPOGU2/ZzqpWez20jm/qiT+cO7Nq91QcSRskrTMtw9KLMUZ iYZazEXFiQA8ON0sLQIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3893 Lines: 114 Now the core implements the work queue, remove it from the drivers. Signed-off-by: Jacek Anaszewski Cc: Sakari Ailus Cc: Bryan Wu --- drivers/leds/leds-max77693.c | 45 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c index 856d929..cc4146a 100644 --- a/drivers/leds/leds-max77693.c +++ b/drivers/leds/leds-max77693.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #define MODE_OFF 0 @@ -62,8 +61,6 @@ struct max77693_sub_led { int fled_id; /* corresponding LED Flash class device */ struct led_classdev_flash fled_cdev; - /* assures led-triggers compatibility */ - struct work_struct work_brightness_set; /* V4L2 Flash device */ struct v4l2_flash *v4l2_flash; @@ -463,10 +460,14 @@ static int max77693_setup(struct max77693_led_device *led, return max77693_set_mode_reg(led, MODE_OFF); } -static int __max77693_led_brightness_set(struct max77693_led_device *led, - int fled_id, enum led_brightness value) +/* LED subsystem callbacks */ +static void max77693_led_brightness_set(struct led_classdev *led_cdev, + enum led_brightness value) { - int ret; + struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); + struct max77693_sub_led *sub_led = flcdev_to_sub_led(fled_cdev); + struct max77693_led_device *led = sub_led_to_led(sub_led); + int fled_id = sub_led->fled_id, ret; mutex_lock(&led->lock); @@ -494,32 +495,6 @@ static int __max77693_led_brightness_set(struct max77693_led_device *led, ret); unlock: mutex_unlock(&led->lock); - return ret; -} - -static void max77693_led_brightness_set_work( - struct work_struct *work) -{ - struct max77693_sub_led *sub_led = - container_of(work, struct max77693_sub_led, - work_brightness_set); - struct max77693_led_device *led = sub_led_to_led(sub_led); - - __max77693_led_brightness_set(led, sub_led->fled_id, - sub_led->torch_brightness); -} - -/* LED subsystem callbacks */ - -static void max77693_led_brightness_set( - struct led_classdev *led_cdev, - enum led_brightness value) -{ - struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); - struct max77693_sub_led *sub_led = flcdev_to_sub_led(fled_cdev); - - sub_led->torch_brightness = value; - schedule_work(&sub_led->work_brightness_set); } static int max77693_led_flash_brightness_set( @@ -926,9 +901,7 @@ static void max77693_init_fled_cdev(struct max77693_sub_led *sub_led, led_cfg->iout_torch_max[FLED2] : led_cfg->iout_torch_max[fled_id]) / TORCH_IOUT_STEP; - led_cdev->flags |= LED_DEV_CAP_FLASH; - INIT_WORK(&sub_led->work_brightness_set, - max77693_led_brightness_set_work); + led_cdev->flags |= LED_DEV_CAP_FLASH | LED_BRIGHTNESS_BLOCKING; max77693_init_flash_settings(sub_led, led_cfg); @@ -1050,13 +1023,11 @@ static int max77693_led_remove(struct platform_device *pdev) if (led->iout_joint || max77693_fled_used(led, FLED1)) { v4l2_flash_release(sub_leds[FLED1].v4l2_flash); led_classdev_flash_unregister(&sub_leds[FLED1].fled_cdev); - cancel_work_sync(&sub_leds[FLED1].work_brightness_set); } if (!led->iout_joint && max77693_fled_used(led, FLED2)) { v4l2_flash_release(sub_leds[FLED2].v4l2_flash); led_classdev_flash_unregister(&sub_leds[FLED2].fled_cdev); - cancel_work_sync(&sub_leds[FLED2].work_brightness_set); } mutex_destroy(&led->lock); -- 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/