leds: lp50xx: Fix bank enable mask
PATCH 1/1 leds: lp50xx: Fix bank enable mask
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.
--- drivers/leds/leds-lp50xx.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/leds/leds-lp50xx.c +4 -6
@@ -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;
Signature · 1 line
2.17.1
A message that is not in the archive (sent off-list or not yet received): CAHP10D8mwCb-_dacVDiLTQkr-YzppNAydR76kSG=YP-xZhK0Uw@mail.gmail.com
Quoted 1 line · Donovan Drews
Just bumping this patch in case it was overlooked.
Please don't. Patches are not usually merged during the -rc1 time.
Best regards,
Pavel
Quoted 52 lines · DonDrews
Quoted 51 lines
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 <[email protected]>--- drivers/leds/leds-lp50xx.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/leds/leds-lp50xx.c +3
-5@@ -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;drivers/leds/leds-lp50xx.c +1
-1@@ -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
Signature · 1 line
http://www.livejournal.com/~pavelmachek
Hi!
Quoted 12 lines
Quoted 1 line
Just bumping this patch in case it was overlooked.
Please don't. Patches are not usually merged during the -rc1 time.
Best regards,
PavelQuoted 5 lines · DonDrews
Quoted 4 lines
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.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Signed-off-by DonDrews <[email protected]>
And I'll need your full name here.
Otherwise looks good.
Best regards,
Pavel
Signature · 1 line
http://www.livejournal.com/~pavelmachek