Skip to contentSkip to conversation

regulator: tps65023: Remove num_voltages array

PATCH Superseded Axel Lin 2 participants 2 messages Aug 2, 2011 Voltage and current regulator framework

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: tps65023: Remove num_voltages array

We can get n_voltages for each regulator from table_len of struct tps_info.

---
 drivers/regulator/tps65023-regulator.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/regulator/tps65023-regulator.c +3 -5
index 701a590..dd0c72f 100644
@@ -106,10 +106,6 @@ static const u16 LDO2_VSEL_table[] = {
 	2500, 2800, 3000, 3300,
 };
 
-static unsigned int num_voltages[] = {ARRAY_SIZE(VDCDC1_VSEL_table),
-				0, 0, ARRAY_SIZE(LDO1_VSEL_table),
-				ARRAY_SIZE(LDO2_VSEL_table)};
-
 /* Regulator specific details */
 struct tps_info {
 	const char *name;
@@ -453,7 +449,7 @@ static int __devinit tps_65023_probe(struct i2c_client *client,
 
 		tps->desc[i].name = info->name;
 		tps->desc[i].id = i;
-		tps->desc[i].n_voltages = num_voltages[i];
+		tps->desc[i].n_voltages = info->table_len;
 		tps->desc[i].ops = (i > TPS65023_DCDC_3 ?
 					&tps65023_ldo_ops : &tps65023_dcdc_ops);
 		tps->desc[i].type = REGULATOR_VOLTAGE;
@@ -519,12 +515,14 @@ static const struct tps_info tps65023_regs[] = {
 		.name = "VDCDC2",
 		.min_uV =  3300000,
 		.max_uV = 3300000,
+		.table_len = 0,
 		.fixed = 1,
 	},
 	{
 		.name = "VDCDC3",
 		.min_uV =  1800000,
 		.max_uV = 1800000,
+		.table_len = 0,
 		.fixed = 1,
 	},
 	{
Signature · 1 line
1.7.4.1
#1 lore raw

drivers/regulator/tps65023-regulator.c static const struct tps_info tps65023_regs[] = { · line 526

Quoted 13 lines · Axel Lin
drivers/regulator/tps65023-regulator.c +2 -0
@@ -519,12 +515,14 @@ static const struct tps_info tps65023_regs[] = {
 		.name = "VDCDC2",
 		.min_uV =  3300000,
 		.max_uV = 3300000,
+		.table_len = 0,
 		.fixed = 1,
 	},
 	{
 		.name = "VDCDC3",
 		.min_uV =  1800000,
 		.max_uV = 1800000,
+		.table_len = 0,
 		.fixed = 1,

No need to explicitly set things to zero, it's the default for things declared static. If this isn't declared static then it should be.