* [PATCH] leds: lp50xx: Fix bank enable mask
@ 2021-08-28 21:42 DonDrews
[not found] ` <CAHP10D8mwCb-_dacVDiLTQkr-YzppNAydR76kSG=YP-xZhK0Uw@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: DonDrews @ 2021-08-28 21:42 UTC (permalink / raw)
Cc: pavel, linux-leds, DonDrews
Fixes an issue where previously 0 is used as a sentinel when
moving device tree configuration into the bank enable mask. This
prevented the first LED from being added to bank control.
Signed-off-by: DonDrews <donovancarldrews@gmail.com>
---
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 401df1e2e05d..45f56caea182 100644
--- a/drivers/leds/leds-lp50xx.c
+++ b/drivers/leds/leds-lp50xx.c
@@ -347,17 +347,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]);
led_config_lo = bank_enable_mask;
led_config_hi = bank_enable_mask >> 8;
@@ -413,7 +411,7 @@ static int lp50xx_probe_leds(struct fwnode_handle *child, struct lp50xx *priv,
return ret;
}
- ret = lp50xx_set_banks(priv, led_banks);
+ ret = lp50xx_set_banks(priv, led_banks, num_leds);
if (ret) {
dev_err(priv->dev, "Cannot setup banked LEDs\n");
return ret;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <CAHP10D8mwCb-_dacVDiLTQkr-YzppNAydR76kSG=YP-xZhK0Uw@mail.gmail.com>]
* Re: [PATCH] leds: lp50xx: Fix bank enable mask [not found] ` <CAHP10D8mwCb-_dacVDiLTQkr-YzppNAydR76kSG=YP-xZhK0Uw@mail.gmail.com> @ 2021-09-13 9:16 ` Pavel Machek 2021-09-14 9:16 ` Pavel Machek 0 siblings, 1 reply; 3+ messages in thread From: Pavel Machek @ 2021-09-13 9:16 UTC (permalink / raw) To: Donovan Drews; +Cc: linux-leds [-- Attachment #1: Type: text/plain, Size: 2265 bytes --] On Sun 2021-09-12 13:54:26, Donovan Drews wrote: > Just bumping this patch in case it was overlooked. Please don't. Patches are not usually merged during the -rc1 time. Best regards, Pavel > On Sat, Aug 28, 2021 at 2:43 PM DonDrews <donovancarldrews@gmail.com> wrote: > > > Fixes an issue where previously 0 is used as a sentinel when > > moving device tree configuration into the bank enable mask. This > > prevented the first LED from being added to bank control. > > > > Signed-off-by: DonDrews <donovancarldrews@gmail.com> > > --- > > 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 401df1e2e05d..45f56caea182 100644 > > --- a/drivers/leds/leds-lp50xx.c > > +++ b/drivers/leds/leds-lp50xx.c > > @@ -347,17 +347,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]); > > > > led_config_lo = bank_enable_mask; > > led_config_hi = bank_enable_mask >> 8; > > @@ -413,7 +411,7 @@ static int lp50xx_probe_leds(struct fwnode_handle > > *child, struct lp50xx *priv, > > return ret; > > } > > > > - ret = lp50xx_set_banks(priv, led_banks); > > + ret = lp50xx_set_banks(priv, led_banks, num_leds); > > if (ret) { > > dev_err(priv->dev, "Cannot setup banked LEDs\n"); > > return ret; > > -- > > 2.17.1 > > > > -- http://www.livejournal.com/~pavelmachek [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 181 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] leds: lp50xx: Fix bank enable mask 2021-09-13 9:16 ` Pavel Machek @ 2021-09-14 9:16 ` Pavel Machek 0 siblings, 0 replies; 3+ messages in thread From: Pavel Machek @ 2021-09-14 9:16 UTC (permalink / raw) To: Donovan Drews; +Cc: linux-leds [-- Attachment #1: Type: text/plain, Size: 809 bytes --] Hi! > > Just bumping this patch in case it was overlooked. > > Please don't. Patches are not usually merged during the -rc1 time. > > Best regards, > Pavel > > > On Sat, Aug 28, 2021 at 2:43 PM DonDrews <donovancarldrews@gmail.com> wrote: > > > > > Fixes an issue where previously 0 is used as a sentinel when > > > moving device tree configuration into the bank enable mask. This > > > prevented the first LED from being added to bank control. Remove whitespace at the start of the line. > > > Signed-off-by: DonDrews <donovancarldrews@gmail.com> And I'll need your full name here. Fixes: tag if you want this to go to stable would not hurt. Otherwise looks good. Best regards, Pavel -- http://www.livejournal.com/~pavelmachek [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 181 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-14 9:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-28 21:42 [PATCH] leds: lp50xx: Fix bank enable mask DonDrews
[not found] ` <CAHP10D8mwCb-_dacVDiLTQkr-YzppNAydR76kSG=YP-xZhK0Uw@mail.gmail.com>
2021-09-13 9:16 ` Pavel Machek
2021-09-14 9:16 ` Pavel Machek
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).