linux/drivers/power/supply
Arnd Bergmann 9edeaada19 power: supply: sbs-battery: simplify DT parsing
After the change to use the gpio descriptor interface, we get a warning if
-Wmaybe-uninitialized is added back to the build flags (it is currently
disabled:

drivers/power/supply/sbs-battery.c: In function 'sbs_probe':
drivers/power/supply/sbs-battery.c:760:28: error: 'pdata' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The problem is that if neither the DT properties nor a platform_data
pointer are provided, the chip->pdata pointer gets set to an uninitialized
value.

Looking at the code some more, I found that the sbs_of_populate_pdata
function is more complex than necessary and has confusing calling
conventions of possibly returning a valid pointer, a NULL pointer
or an ERR_PTR pointer (in addition to the uninitialized pointer).

To fix all of that, this gets rid of the chip->pdata pointer and
simply moves the two integers into the sbs_info structure. This
makes it much clearer from reading sbs_probe() what the precedence
of the three possible values are (pdata, DT, hardcoded defaults)
and completely avoids the #ifdef CONFIG_OF guards as
of_property_read_u32() gets replaced with a compile-time stub
when that is disabled, and returns an error if passed a NULL of_node
pointer.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 3b5dd3a494 ("power: supply: sbs-battery: Use gpio_desc and sleeping calls for battery detect")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-07 01:46:59 +02:00
..
88pm860x_battery.c
88pm860x_charger.c
Kconfig
Makefile
ab8500_bmdata.c
ab8500_btemp.c power: ab8500_btemp: Remove deprecated create_singlethread_workqueue 2016-08-16 00:54:37 +02:00
ab8500_charger.c power: ab8500_charger: Remove deprecated create_singlethread_workqueue 2016-08-16 00:54:37 +02:00
ab8500_fg.c power: ab8500_fg: Remove deprecated create_singlethread_workqueue 2016-08-16 00:54:37 +02:00
abx500_chargalg.c power: abx500_chargalg: Remove deprecated create_singlethread_workqueue 2016-08-16 00:54:37 +02:00
act8945a_charger.c power: supply: act8945a_charger: Add max current property 2016-09-01 13:55:55 +02:00
apm_power.c
axp20x_usb_power.c
axp288_charger.c power: axp288_charger: remove duplicated include from axp288_charger.c 2016-08-16 00:36:37 +02:00
axp288_fuel_gauge.c power: axp288_fuel_gauge: remove duplicated include from axp288_fuel_gauge.c 2016-08-16 00:36:27 +02:00
bq27xxx_battery.c power:bq27xxx: 27000/10 read FLAGS register as single 2016-08-15 21:26:52 +02:00
bq27xxx_battery_i2c.c
bq2415x_charger.c
bq24190_charger.c
bq24257_charger.c
bq24735-charger.c power: supply: bq24735-charger: Request status GPIO with initial input setup 2016-09-05 12:59:49 +02:00
bq25890_charger.c
charger-manager.c
collie_battery.c
da9030_battery.c
da9052-battery.c
da9150-charger.c
da9150-fg.c
ds2760_battery.c power: ds2760_battery: Remove deprecated create_singlethread_workqueue 2016-08-16 00:54:37 +02:00
ds2780_battery.c
ds2781_battery.c
ds2782_battery.c
generic-adc-battery.c
goldfish_battery.c
gpio-charger.c
intel_mid_battery.c power: intel_mid_battery: Remove deprecated create_singlethread_workqueue 2016-08-16 00:54:37 +02:00
ipaq_micro_battery.c power: ipaq_micro_battery: Remove deprecated create_singlethread_workqueue 2016-08-16 00:54:37 +02:00
isp1704_charger.c
jz4740-battery.c
lp8727_charger.c
lp8788-charger.c
ltc2941-battery-gauge.c
max8903_charger.c
max8925_power.c
max8997_charger.c
max8998_charger.c
max14577_charger.c power: supply: Change Krzysztof Kozlowski's email to kernel.org 2016-08-17 14:15:58 +02:00
max17040_battery.c
max17042_battery.c Power Supply Fixes for 4.8 cycle 2016-08-16 01:17:42 +02:00
max77693_charger.c power: supply: Change Krzysztof Kozlowski's email to kernel.org 2016-08-17 14:15:58 +02:00
olpc_battery.c
pcf50633-charger.c
pda_power.c
pm2301_charger.c power: pm2301_charger: Remove deprecated create_singlethread_workqueue 2016-08-16 00:54:37 +02:00
pm2301_charger.h
pmu_battery.c
power_supply.h
power_supply_core.c
power_supply_leds.c
power_supply_sysfs.c
qcom_smbb.c
rt5033_battery.c
rt9455_charger.c
rx51_battery.c
s3c_adc_battery.c
sbs-battery.c power: supply: sbs-battery: simplify DT parsing 2016-09-07 01:46:59 +02:00
smb347-charger.c
test_power.c
tosa_battery.c
tps65090-charger.c
tps65217_charger.c Power Supply Fixes for 4.8 cycle 2016-08-16 01:17:42 +02:00
twl4030_charger.c
twl4030_madc_battery.c
wm97xx_battery.c
wm831x_backup.c
wm831x_power.c
wm8350_power.c
z2_battery.c power: z2_battery: remove .owner field for driver 2016-08-16 00:36:06 +02:00