Skip to content

Commit 061514d

Browse files
nathanchancebroonie
authored andcommitted
regulator: lp872x: Remove lp872x_dvs_state
After this driver was converted to gpiod, clang started warning: vers/regulator/lp872x.c:689:57: error: implicit conversion from enumeration type 'enum lp872x_dvs_state' to different enumeration type 'enum gpiod_flags' [-Werror,-Wenum-conversion] dvs->gpio = devm_gpiod_get_optional(lp->dev, "ti,dvs", pinstate); ~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~ 1 error generated. lp872x_dvs_state was updated to have values from gpiod_flags but this is not enough to avoid an implicit conversion warning from either GCC or clang (although GCC enables this warning under -Wextra instead of -Wall like clang so it is not seen under normal builds). Eliminate lp872x_dvs_state in favor of using gpiod_flags everywhere so that there is no more warning about an implicit conversion. Fixes: 72bf80c ("regulator: lp872x: replacing legacy gpio interface for gpiod") Link: ClangBuiltLinux#1481 Signed-off-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent ed96f35 commit 061514d

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

drivers/regulator/lp872x.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ struct lp872x {
103103
enum lp872x_id chipid;
104104
struct lp872x_platform_data *pdata;
105105
int num_regulators;
106-
enum lp872x_dvs_state dvs_pin;
106+
enum gpiod_flags dvs_pin;
107107
};
108108

109109
/* LP8720/LP8725 shared voltage table for LDOs */
@@ -251,9 +251,9 @@ static int lp872x_regulator_enable_time(struct regulator_dev *rdev)
251251
static void lp872x_set_dvs(struct lp872x *lp, enum lp872x_dvs_sel dvs_sel,
252252
struct gpio_desc *gpio)
253253
{
254-
enum lp872x_dvs_state state;
254+
enum gpiod_flags state;
255255

256-
state = dvs_sel == SEL_V1 ? DVS_HIGH : DVS_LOW;
256+
state = dvs_sel == SEL_V1 ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
257257
gpiod_set_value(gpio, state);
258258
lp->dvs_pin = state;
259259
}
@@ -269,7 +269,7 @@ static u8 lp872x_select_buck_vout_addr(struct lp872x *lp,
269269
switch (buck) {
270270
case LP8720_ID_BUCK:
271271
if (val & LP8720_EXT_DVS_M) {
272-
addr = (lp->dvs_pin == DVS_HIGH) ?
272+
addr = (lp->dvs_pin == GPIOD_OUT_HIGH) ?
273273
LP8720_BUCK_VOUT1 : LP8720_BUCK_VOUT2;
274274
} else {
275275
if (lp872x_read_byte(lp, LP8720_ENABLE, &val))
@@ -283,7 +283,7 @@ static u8 lp872x_select_buck_vout_addr(struct lp872x *lp,
283283
if (val & LP8725_DVS1_M)
284284
addr = LP8725_BUCK1_VOUT1;
285285
else
286-
addr = (lp->dvs_pin == DVS_HIGH) ?
286+
addr = (lp->dvs_pin == GPIOD_OUT_HIGH) ?
287287
LP8725_BUCK1_VOUT1 : LP8725_BUCK1_VOUT2;
288288
break;
289289
case LP8725_ID_BUCK2:
@@ -675,7 +675,7 @@ static const struct regulator_desc lp8725_regulator_desc[] = {
675675
static int lp872x_init_dvs(struct lp872x *lp)
676676
{
677677
struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs : NULL;
678-
enum lp872x_dvs_state pinstate;
678+
enum gpiod_flags pinstate;
679679
u8 mask[] = { LP8720_EXT_DVS_M, LP8725_DVS1_M | LP8725_DVS2_M };
680680
u8 default_dvs_mode[] = { LP8720_DEFAULT_DVS, LP8725_DEFAULT_DVS };
681681

@@ -841,7 +841,7 @@ static struct lp872x_platform_data
841841

842842
of_property_read_u8(np, "ti,dvs-vsel", (u8 *)&pdata->dvs->vsel);
843843
of_property_read_u8(np, "ti,dvs-state", &dvs_state);
844-
pdata->dvs->init_state = dvs_state ? DVS_HIGH : DVS_LOW;
844+
pdata->dvs->init_state = dvs_state ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
845845

846846
if (of_get_child_count(np) == 0)
847847
goto out;

include/linux/regulator/lp872x.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ enum lp872x_regulator_id {
4040
LP872X_ID_MAX,
4141
};
4242

43-
enum lp872x_dvs_state {
44-
DVS_LOW = GPIOD_OUT_LOW,
45-
DVS_HIGH = GPIOD_OUT_HIGH,
46-
};
47-
4843
enum lp872x_dvs_sel {
4944
SEL_V1,
5045
SEL_V2,
@@ -59,7 +54,7 @@ enum lp872x_dvs_sel {
5954
struct lp872x_dvs {
6055
struct gpio_desc *gpio;
6156
enum lp872x_dvs_sel vsel;
62-
enum lp872x_dvs_state init_state;
57+
enum gpiod_flags init_state;
6358
};
6459

6560
/**

0 commit comments

Comments
 (0)