linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Murphy <dmurphy@ti.com>
To: Jacek Anaszewski <jacek.anaszewski@gmail.com>, <pavel@ucw.cz>
Cc: <linux-leds@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v8 6/9] leds: multicolor: Introduce a multicolor class definition
Date: Mon, 23 Sep 2019 10:11:28 -0500	[thread overview]
Message-ID: <f371559c-f9f6-d799-d741-afa28c5b89bc@ti.com> (raw)
In-Reply-To: <135685e7-e3cc-da4d-3349-9affba5b89cc@gmail.com>

Jacek

On 9/21/19 1:08 PM, Jacek Anaszewski wrote:
> Dan,
>
> One more remark below.
>
> On 9/20/19 7:41 PM, Dan Murphy wrote:
>> Introduce a multicolor class that groups colored LEDs
>> within a LED node.
>>
>> The framework allows for dynamically setting individual LEDs
>> or setting brightness levels of LEDs and updating them virtually
>> simultaneously.
>>
>> Signed-off-by: Dan Murphy <dmurphy@ti.com>
>> ---
>>   drivers/leds/Kconfig                 |  10 +
>>   drivers/leds/Makefile                |   1 +
>>   drivers/leds/led-class-multicolor.c  | 316 +++++++++++++++++++++++++++
>>   include/linux/led-class-multicolor.h |  76 +++++++
>>   4 files changed, 403 insertions(+)
>>   create mode 100644 drivers/leds/led-class-multicolor.c
>>   create mode 100644 include/linux/led-class-multicolor.h
>>
>> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
>> index 6e7703fd03d0..cfb1ebb6517f 100644
>> --- a/drivers/leds/Kconfig
>> +++ b/drivers/leds/Kconfig
>> @@ -30,6 +30,16 @@ config LEDS_CLASS_FLASH
> [...]
>> +static int led_multicolor_init_color_dir(struct led_classdev_mc_data *data,
>> +					 struct led_classdev_mc *mcled_cdev)
>> +{
>> +	struct led_classdev *led_cdev = mcled_cdev->led_cdev;
>> +	u32 color_id;
>> +	int ret;
>> +	int i, j = 0;
>> +
>> +	data->mcled_cdev = mcled_cdev;
>> +
>> +	ret = sysfs_create_group(&led_cdev->dev->kobj, &led_color_group);
>> +	if (ret)
>> +		return ret;
>> +
>> +	for (i = 0; i < LED_COLOR_ID_MAX; i++) {
>> +		color_id = (mcled_cdev->available_colors & (1 << i));
> Please use bitops for accessing available_colors.
>
>> +		if (color_id) {
> Here you need: if (test_bit(i, &mcled_cdev->available_colors))

Then I can get rid of the color_id and just use test_bit.

Then your other request for color_mask is not needed because we can just 
test against the incremental 'i'

Dan

>> +			ret = led_multicolor_init_color(data, mcled_cdev, i, j);
>> +			if (ret)
>> +				break;
>> +
>> +			j++;
>> +		}
>> +	}
>> +
>> +	return ret;
>> +}

  reply	other threads:[~2019-09-23 15:07 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20 17:41 [PATCH v8 0/9] Multicolor FW v8 update Dan Murphy
2019-09-20 17:41 ` [PATCH v8 1/9] leds: multicolor: Add sysfs interface definition Dan Murphy
2019-09-21 10:55   ` Jacek Anaszewski
2019-09-23 14:23     ` Dan Murphy
2019-09-20 17:41 ` [PATCH v8 2/9] documention: leds: Add multicolor class documentation Dan Murphy
2019-09-21 12:28   ` Jacek Anaszewski
2019-09-23 14:50     ` Dan Murphy
2019-09-23 21:21       ` Jacek Anaszewski
2019-09-20 17:41 ` [PATCH v8 3/9] dt: bindings: Add multicolor class dt bindings documention Dan Murphy
2019-09-21 12:57   ` Jacek Anaszewski
2019-09-23 14:52     ` Dan Murphy
2019-09-20 17:41 ` [PATCH v8 4/9] dt-bindings: leds: Add multicolor ID to the color ID list Dan Murphy
2019-09-21 12:58   ` Jacek Anaszewski
2019-09-20 17:41 ` [PATCH v8 5/9] " Dan Murphy
2019-09-21 12:59   ` Jacek Anaszewski
2019-09-20 17:41 ` [PATCH v8 6/9] leds: multicolor: Introduce a multicolor class definition Dan Murphy
2019-09-21 13:30   ` Jacek Anaszewski
2019-09-23 15:14     ` Dan Murphy
2019-09-23 21:36       ` Jacek Anaszewski
2019-09-21 18:08   ` Jacek Anaszewski
2019-09-23 15:11     ` Dan Murphy [this message]
2019-09-20 17:41 ` [PATCH v8 7/9] dt: bindings: lp50xx: Introduce the lp50xx family of RGB drivers Dan Murphy
2019-09-21 15:13   ` Jacek Anaszewski
2019-09-23 15:28     ` Dan Murphy
2019-09-23 21:42       ` Jacek Anaszewski
2019-09-24 14:52         ` Dan Murphy
2019-09-20 17:41 ` [PATCH v8 8/9] leds: lp50xx: Add the LP50XX family of the RGB LED driver Dan Murphy
2019-09-21 15:11   ` Jacek Anaszewski
2019-09-23 17:56     ` Dan Murphy
2019-09-23 21:59       ` Jacek Anaszewski
2019-09-20 17:41 ` [PATCH v8 9/9] leds: Update the lp55xx to use the multi color framework Dan Murphy
2019-09-21 18:06   ` Jacek Anaszewski
     [not found]     ` <b3ba9d9f-5267-8184-e858-e09b4debcdb6@ti.com>
2019-09-23 22:13       ` Jacek Anaszewski
2019-09-22  8:29   ` kbuild test robot
2019-09-20 17:44 ` [PATCH v8 0/9] Multicolor FW v8 update Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f371559c-f9f6-d799-d741-afa28c5b89bc@ti.com \
    --to=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).