Commit 125ec900 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

leds: lm355x: avoid enum conversion warning

[ Upstream commit 985b1f59 ]

clang points out that doing arithmetic between diffent enums is usually
a mistake:

drivers/leds/leds-lm355x.c:167:28: warning: bitwise operation between different enumeration types ('enum lm355x_tx2' and 'enum lm355x_ntc') [-Wenum-enum-conversion]
                reg_val = pdata->pin_tx2 | pdata->ntc_pin;
                          ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
drivers/leds/leds-lm355x.c:178:28: warning: bitwise operation between different enumeration types ('enum lm355x_tx2' and 'enum lm355x_ntc') [-Wenum-enum-conversion]
                reg_val = pdata->pin_tx2 | pdata->ntc_pin | pdata->pass_mode;
                          ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~

In this driver, it is intentional, so add a cast to hide the false-positive
warning. It appears to be the only instance of this warning at the moment.

Fixes: b98d13c7 ("leds: Add new LED driver for lm355x chips")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 64918e3f
...@@ -168,18 +168,19 @@ static int lm355x_chip_init(struct lm355x_chip_data *chip) ...@@ -168,18 +168,19 @@ static int lm355x_chip_init(struct lm355x_chip_data *chip)
/* input and output pins configuration */ /* input and output pins configuration */
switch (chip->type) { switch (chip->type) {
case CHIP_LM3554: case CHIP_LM3554:
reg_val = pdata->pin_tx2 | pdata->ntc_pin; reg_val = (u32)pdata->pin_tx2 | (u32)pdata->ntc_pin;
ret = regmap_update_bits(chip->regmap, 0xE0, 0x28, reg_val); ret = regmap_update_bits(chip->regmap, 0xE0, 0x28, reg_val);
if (ret < 0) if (ret < 0)
goto out; goto out;
reg_val = pdata->pass_mode; reg_val = (u32)pdata->pass_mode;
ret = regmap_update_bits(chip->regmap, 0xA0, 0x04, reg_val); ret = regmap_update_bits(chip->regmap, 0xA0, 0x04, reg_val);
if (ret < 0) if (ret < 0)
goto out; goto out;
break; break;
case CHIP_LM3556: case CHIP_LM3556:
reg_val = pdata->pin_tx2 | pdata->ntc_pin | pdata->pass_mode; reg_val = (u32)pdata->pin_tx2 | (u32)pdata->ntc_pin |
(u32)pdata->pass_mode;
ret = regmap_update_bits(chip->regmap, 0x0A, 0xC4, reg_val); ret = regmap_update_bits(chip->regmap, 0x0A, 0xC4, reg_val);
if (ret < 0) if (ret < 0)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment