All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Christian Hitz <christian@klarinett.li>
Cc: Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Christian Hitz <christian.hitz@bbv.ch>,
	stable@vger.kernel.org, linux-leds@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds: leds-lp50xx: allow LED 0 to be added to module bank
Date: Mon, 13 Oct 2025 19:35:40 +0200	[thread overview]
Message-ID: <c68111e0-e651-44ee-af7f-737a408fe080@gmail.com> (raw)
In-Reply-To: <20251013085514.512508-1-christian@klarinett.li>

On 10/13/25 10:54, Christian Hitz wrote:
> On Sat, 11 Oct 2025 14:16:16 +0200 Jacek Anaszewski <jacek.anaszewski@gmail.com> wrote:
> 
>> Hi Christian,
>>
>> On 10/8/25 14:32, Christian Hitz wrote:
>>> From: Christian Hitz <christian.hitz@bbv.ch>
>>>
>>> led_banks contains LED module number(s) that should be grouped into the
>>> module bank. led_banks is 0-initialized.
>>> By checking the led_banks entries for 0, un-set entries are detected.
>>> But a 0-entry also indicates that LED module 0 should be grouped into the
>>> module bank.
>>>
>>> By only iterating over the available entries no check for unused entries
>>> is required and LED module 0 can be added to bank.
>>>
>>> Signed-off-by: Christian Hitz <christian.hitz@bbv.ch>
>>> Cc: stable@vger.kernel.org
>>> ---
>>>    drivers/leds/leds-lp50xx.c | 10 ++++------
>>>    1 file changed, 4 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c
>>> index 94f8ef6b482c..d50c7f3e8f99 100644
>>> --- a/drivers/leds/leds-lp50xx.c
>>> +++ b/drivers/leds/leds-lp50xx.c
>>> @@ -341,17 +341,15 @@ static int lp50xx_brightness_set(struct led_classdev *cdev,
>>>    	return ret;
>>>    }
>>>    
>>> -static int lp50xx_set_banks(struct lp50xx *priv, u32 led_banks[])
>>> +static int lp50xx_set_banks(struct lp50xx *priv, u32 led_banks[], int num_leds)
>>>    {
>>>    	u8 led_config_lo, led_config_hi;
>>>    	u32 bank_enable_mask = 0;
>>>    	int ret;
>>>    	int i;
>>>    
>>> -	for (i = 0; i < priv->chip_info->max_modules; i++) {
>>> -		if (led_banks[i])
>>> -			bank_enable_mask |= (1 << led_banks[i]);
>>> -	}
>>> +	for (i = 0; i < num_leds; i++)
>>> +		bank_enable_mask |= (1 << led_banks[i]);
>>
>> Probably the first idea was to have a bitmask indicating which bank
>> to enable, but it ended up in having array of bank ids in DT with no
>> related adjustment in the driver.
>>
>> This patch deserves Fixes tag.
> 
> This code has not changed since the inital introduction of this driver.

Yeah, I had on mind design approach changes between subsequent
versions of the patch that was adding the driver.

> Fixes: 242b81170fb8 ("leds: lp50xx: Add the LP50XX family of the RGB LED driver")
-- 
Best regards,
Jacek Anaszewski


  reply	other threads:[~2025-10-13 17:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-08 12:32 [PATCH] leds: leds-lp50xx: allow LED 0 to be added to module bank Christian Hitz
2025-10-11 12:16 ` Jacek Anaszewski
2025-10-13  8:54   ` Christian Hitz
2025-10-13 17:35     ` Jacek Anaszewski [this message]
2025-10-23 13:13 ` (subset) " Lee Jones

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=c68111e0-e651-44ee-af7f-737a408fe080@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=christian.hitz@bbv.ch \
    --cc=christian@klarinett.li \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.