Skip to contentSkip to conversation

power: supply: ab8500: Drop pointless static qualifier in ab8500_btemp_batctrl_volt_to_res()

PATCH In review Mao Wenan 2 participants 3 messages Dec 4, 2019

Subsystems (3)
lore
Share & tools
lore

Mao Wenan

author
#0 lore raw

PATCH 1/1 power: supply: ab8500: Drop pointless static qualifier in ab8500_btemp_batctrl_volt_to_res()

There is no need to have the 'T *v' variable static since new value always be assigned before use it.

---
 drivers/power/supply/ab8500_btemp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/ab8500_btemp.c +1 -1
index 909f0242bacb..d3d4f7327d1b 100644
@@ -180,7 +180,7 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di,
 static int ab8500_btemp_read_batctrl_voltage(struct ab8500_btemp *di)
 {
 	int vbtemp, ret;
-	static int prev;
+	int prev;
 
 	ret = iio_read_channel_processed(di->bat_ctrl, &vbtemp);
 	if (ret < 0) {
Signature · 1 line
2.20.1
#1 lore raw
Quoted 14 lines · Mao Wenan

There is no need to have the 'T *v' variable static since new value always be assigned before use it.

---
 drivers/power/supply/ab8500_btemp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/ab8500_btemp.c +0 -0
index 909f0242bacb..d3d4f7327d1b 100644

drivers/power/supply/ab8500_btemp.c static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di, · line 183

Quoted 5 lines
drivers/power/supply/ab8500_btemp.c +1 -1
@@ -180,7 +180,7 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di,
 static int ab8500_btemp_read_batctrl_voltage(struct ab8500_btemp *di)
 {
 	int vbtemp, ret;
-	static int prev;
+	int prev;

No. We use it first on linux-next (yesterday). It needs to be static.

regards,
dan carpenter

#2 lore raw
Quoted 10 lines · Dan Carpenter
Quoted 9 lines · Mao Wenan

There is no need to have the 'T *v' variable static since new value always be assigned before use it.

---
 drivers/power/supply/ab8500_btemp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

drivers/power/supply/ab8500_btemp.c static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di, · line 183

Quoted 10 lines
drivers/power/supply/ab8500_btemp.c +1 -1
index 909f0242bacb..d3d4f7327d1b 100644
@@ -180,7 +180,7 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di,
 static int ab8500_btemp_read_batctrl_voltage(struct ab8500_btemp *di)
 {
 	int vbtemp, ret;
-	static int prev;
+	int prev;

No. We use it first on linux-next (yesterday). It needs to be static.

It's surprising that your patch didn't cause an uninitialized variable compile warning for you.

regards,
dan carpenter