Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758695AbcC3IAO (ORCPT ); Wed, 30 Mar 2016 04:00:14 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:31610 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753031AbcC3IAL (ORCPT ); Wed, 30 Mar 2016 04:00:11 -0400 X-AuditID: cbfec7f4-f796c6d000001486-47-56fb8788b206 Message-id: <56FB8787.7090808@samsung.com> Date: Wed, 30 Mar 2016 10:00:07 +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: Heiner Kallweit Cc: Pavel Machek , linux-leds@vger.kernel.org, Benjamin Tissoires , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 4/4] leds: core: add support for RGB LED's References: <56D60B4C.5000506@gmail.com> <20160329100535.GC24964@amd> <56FAE8CD.1010804@gmail.com> In-reply-to: <56FAE8CD.1010804@gmail.com> Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrELMWRmVeSWpSXmKPExsVy+t/xa7od7b/DDF5t47K4PmUzq8Wi9zNY LS7vmsNmsfXNOkaLRctamS3unjrK5sDmsXPWXXaP9/uusnmsWP2d3ePzJrkAligum5TUnMyy 1CJ9uwSujI+fDjAW/BCqWPx6KUsDYyt/FyMnh4SAicS57yvZIGwxiQv31gPZXBxCAksZJZ50 XmWBcJ4xSmx4+oYJpIpXQEti6eyf7CA2i4CqxOzPt8DibAKGEj9fvAazRQUiJP6c3scKUS8o 8WPyPRYQWwSod8LrNWAbmAXWMEpcfvIEyOHgEBZwlHg6IwykRkggRWLH0uNgF3EKaEqcbegH s5kFbCUWvF/HAmHLS2xe85Z5AqPALCQrZiEpm4WkbAEj8ypG0dTS5ILipPRcQ73ixNzi0rx0 veT83E2MkJD+soNx8TGrQ4wCHIxKPLwbpH+HCbEmlhVX5h5ilOBgVhLhlWsDCvGmJFZWpRbl xxeV5qQWH2KU5mBREuedu+t9iJBAemJJanZqakFqEUyWiYNTqoFxy/2Pt0qWGkaaCMp+lDub Y8X0xWaeaUPUlKDaWQ+1HTdouR3aMvPO/axAle+KwV2rKpdx1z9fKVskqyi6OIhhK4cPx+Xl fduC3x7YwcLnu8b6x37dtqmMHhKqHB0eK5gnv9S4JXfzxvMZd+5I3rCXEK0r+ZKvdbtupUza XuWXDv/mLwjhEd6nxFKckWioxVxUnAgA7xESx2UCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2357 Lines: 67 On 03/29/2016 10:42 PM, Heiner Kallweit wrote: > Am 29.03.2016 um 12:05 schrieb Pavel Machek: >> On Tue 2016-03-01 22:36:12, Heiner Kallweit wrote: >>> Export a function to convert HSV color values to RGB. >>> It's intended to be called by drivers for RGB LEDs. >>> >>> Signed-off-by: Heiner Kallweit >>> --- >>> v2: >>> - move hsv -> rgb conversion to separate file >>> - remove flag LED_DEV_CAP_RGB >>> v3: >>> - call led_hsv_to_rgb only if LED_DEV_CAP_HSV is set >>> This is needed in cases when we have monochrome and color LEDs >>> as well in a system. >>> v4: >>> - Export led_hsv_to_rgb and let the device driver call it instead >>> of doing the conversion in the core >>> v5: >>> - don't ignore led_cdev->brightness_get silently if LED_DEV_CAP_RGB >>> is set but warn >>> --- >>> drivers/leds/led-class.c | 7 +++++++ >>> drivers/leds/led-rgb-core.c | 36 ++++++++++++++++++++++++++++++++++++ >>> include/linux/leds.h | 8 ++++++++ >>> 3 files changed, 51 insertions(+) >>> >>> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c >>> index 8a3748a..a4b144e 100644 >>> --- a/drivers/leds/led-class.c >>> +++ b/drivers/leds/led-class.c >>> @@ -193,6 +193,13 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) >>> char name[64]; >>> int ret; >>> >>> + /* >>> + * for now reading back the color is not supported as multiple >>> + * HSV -> RGB -> HSV conversions may distort the color due to >>> + * rounding issues in the conversion algorithm >>> + */ >>> + WARN_ON(led_cdev->flags & LED_DEV_CAP_RGB && led_cdev->brightness_get); >>> + >> >> Backtrace is useless here, you may want to add some ()s and you don't >> really want user to be causing messages in syslog this easily. >> > I agree that the backtrace doesn't provide a benefit here. I requested it to provide a verbose notification for a LED RGB class driver developer, in case they try to implement a brightness_get op, which would be harmful in case of HSV interface for RGB LEDs. > However I don't see how a user could create syslog entries. > The warn condition can be true only for drivers implementing the RGB extension > in a not supported way (by setting flag LED_DEV_CAP_RGB and implementing > brightness_get). > > Pavel >> > > > -- Best regards, Jacek Anaszewski