Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932764AbbENJTI (ORCPT ); Thu, 14 May 2015 05:19:08 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:40897 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932662AbbENJTE (ORCPT ); Thu, 14 May 2015 05:19:04 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-3d-55546885cc1f Message-id: <55546884.5060201@samsung.com> Date: Thu, 14 May 2015 11:19:00 +0200 From: Jacek Anaszewski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-version: 1.0 To: Stas Sergeev Cc: linux-leds@vger.kernel.org, Linux kernel , Bryan Wu , Richard Purdie , Stas Sergeev Subject: Re: [PATCH] leds: remove redundant SET_BRIGHTNESS_SYNC flag References: <55537091.7040306@list.ru> <555466C9.7080702@samsung.com> In-reply-to: <555466C9.7080702@samsung.com> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsVy+t/xK7qtGSGhBgdny1gc3TmRyeLyrjls FlvfrGO02L3rKatF66YGZovOvmksDmweO2fdZfe4t+Uys8ee+T9YPZpOtbN6fN4kF8AaxWWT kpqTWZZapG+XwJWxsvk9S8F7sYq1Zw4xNzA2C3UxcnJICJhInO49zQphi0lcuLeerYuRi0NI YCmjxK8X61ggnGeMErumv2YHqeIV0JI48LyFGcRmEVCVuN/6CyzOJmAo8fPFayYQW1QgQuLP 6X2sEPWCEj8m3wMaxMEhIiAvsaGxDGQms8BeRolHF/vB5ggLuEiceniRBcQWEnCVuL4JYj6n gLbEldkrweYwC5hJPGpZxwxhy0tsXvOWeQKjwCwkK2YhKZuFpGwBI/MqRtHU0uSC4qT0XEO9 4sTc4tK8dL3k/NxNjJDg/rKDcfExq0OMAhyMSjy8K9SDQ4VYE8uKK3MPMUpwMCuJ8K6PDgkV 4k1JrKxKLcqPLyrNSS0+xCjNwaIkzjt31/sQIYH0xJLU7NTUgtQimCwTB6dUA2Py5eBytb3a ZTcPaV/O375tTve6rDvPWcKm/jkjdm6Hlr/Utoq7+0SYtrromfXZ5S5l2erjekSsh/Ho5C0Z Zx7OTuuef+gAM/ObBe9Op27b0HD8ize783qG/nMCl34f9ZTomnpjhoFnd1v1n66wna3ub35d /K00fbuDRemtJRc5n0YXzfGXOqmjxFKckWioxVxUnAgAS+u6QmoCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3089 Lines: 88 On 05/14/2015 11:11 AM, Jacek Anaszewski wrote: > I personally can't find any strong argument against this optimization. > I added both flags on Bryan's request while implementing LED Flash class > extension. I can see a few occurrences in the include/linux directory > where both SYNC and ASYNC flags are implemented. The argument in favour I meant: "in favour of keeping that as is" > could be the fact that the flags influence the core functionality of > the subsystem. > > Bryan, could you express your opinion, please? > > On 05/13/2015 05:41 PM, Stas Sergeev wrote: >> >> There is a complimentary flag called SET_BRIGHTNESS_ASYNC. >> Having both is redundant. This patch removes the unneeded flag >> without any functionality change. >> >> CC: Bryan Wu >> CC: Richard Purdie >> CC: linux-leds@vger.kernel.org >> CC: linux-kernel@vger.kernel.org >> >> Signed-off-by: Stas Sergeev >> --- >> drivers/leds/led-class-flash.c | 1 - >> drivers/leds/led-core.c | 4 +--- >> include/linux/leds.h | 2 +- >> 3 files changed, 2 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/leds/led-class-flash.c >> b/drivers/leds/led-class-flash.c >> index 3b25734..bb67364 100644 >> --- a/drivers/leds/led-class-flash.c >> +++ b/drivers/leds/led-class-flash.c >> @@ -318,7 +318,6 @@ int led_classdev_flash_register(struct device >> *parent, >> >> /* Setting a torch brightness needs to have immediate effect */ >> led_cdev->flags &= ~SET_BRIGHTNESS_ASYNC; >> - led_cdev->flags |= SET_BRIGHTNESS_SYNC; >> >> return 0; >> } >> diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c >> index 9886dac..356e851 100644 >> --- a/drivers/leds/led-core.c >> +++ b/drivers/leds/led-core.c >> @@ -129,10 +129,8 @@ void led_set_brightness(struct led_classdev >> *led_cdev, >> if (led_cdev->flags & SET_BRIGHTNESS_ASYNC) { >> led_set_brightness_async(led_cdev, brightness); >> return; >> - } else if (led_cdev->flags & SET_BRIGHTNESS_SYNC) >> + } else >> ret = led_set_brightness_sync(led_cdev, brightness); >> - else >> - ret = -EINVAL; >> >> if (ret < 0) >> dev_dbg(led_cdev->dev, "Setting LED brightness failed (%d)\n", >> diff --git a/include/linux/leds.h b/include/linux/leds.h >> index 9a2b000..c9e6e5d 100644 >> --- a/include/linux/leds.h >> +++ b/include/linux/leds.h >> @@ -45,7 +45,7 @@ struct led_classdev { >> #define LED_BLINK_INVERT (1 << 19) >> #define LED_SYSFS_DISABLE (1 << 20) >> #define SET_BRIGHTNESS_ASYNC (1 << 21) >> -#define SET_BRIGHTNESS_SYNC (1 << 22) >> +/* bit 22 unused, take it */ >> #define LED_DEV_CAP_FLASH (1 << 23) >> >> /* Set LED brightness level */ >> > > -- Best Regards, Jacek Anaszewski -- 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/