aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorAndrew F. Davis <afd@ti.com>2015-07-22 17:51:56 -0400
committerSebastian Reichel <sre@kernel.org>2015-07-24 11:34:06 -0400
commit6d0a1815e814ee5eaa0cec17913d5e4abae99ef0 (patch)
treeaaef117318b41a37b6fa868c96ee3d9678de0935 /drivers/power
parentce33edfa4903d8b8ded2569e880489678f75a85b (diff)
power: bq27x00_battery: Checkpatch fixes
Remove space before tab. Remove unnecessary line continuations. Add braces to else statement. Remove unnecessary parentheses. Remove unneeded blank lines. Remove unnecessary 'out of memory' message. Add missing line after declarations. Change use of printk to pr_err. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/bq27x00_battery.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index 9cdad1992a2d..8287261fd978 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -108,7 +108,7 @@ struct bq27x00_reg_cache {
108}; 108};
109 109
110struct bq27x00_device_info { 110struct bq27x00_device_info {
111 struct device *dev; 111 struct device *dev;
112 int id; 112 int id;
113 enum bq27x00_chip chip; 113 enum bq27x00_chip chip;
114 114
@@ -202,8 +202,8 @@ static enum power_supply_property bq27510_battery_props[] = {
202 202
203static unsigned int poll_interval = 360; 203static unsigned int poll_interval = 360;
204module_param(poll_interval, uint, 0644); 204module_param(poll_interval, uint, 0644);
205MODULE_PARM_DESC(poll_interval, "battery poll interval in seconds - " \ 205MODULE_PARM_DESC(poll_interval,
206 "0 disables polling"); 206 "battery poll interval in seconds - 0 disables polling");
207 207
208/* 208/*
209 * Common code for BQ27x00 devices 209 * Common code for BQ27x00 devices
@@ -319,8 +319,9 @@ static int bq27x00_battery_read_ilmd(struct bq27x00_device_info *di)
319 ilmd = bq27x00_read(di, BQ27510_REG_DCAP, false); 319 ilmd = bq27x00_read(di, BQ27510_REG_DCAP, false);
320 else 320 else
321 ilmd = bq27x00_read(di, BQ27500_REG_DCAP, false); 321 ilmd = bq27x00_read(di, BQ27500_REG_DCAP, false);
322 } else 322 } else {
323 ilmd = bq27x00_read(di, BQ27000_REG_ILMD, true); 323 ilmd = bq27x00_read(di, BQ27000_REG_ILMD, true);
324 }
324 325
325 if (ilmd < 0) { 326 if (ilmd < 0) {
326 dev_dbg(di->dev, "error reading initial last measured discharge\n"); 327 dev_dbg(di->dev, "error reading initial last measured discharge\n");
@@ -451,7 +452,7 @@ static int bq27x00_battery_read_health(struct bq27x00_device_info *di)
451 return tval; 452 return tval;
452 } 453 }
453 454
454 if ((di->chip == BQ27500)) { 455 if (di->chip == BQ27500) {
455 if (tval & BQ27500_FLAG_SOCF) 456 if (tval & BQ27500_FLAG_SOCF)
456 tval = POWER_SUPPLY_HEALTH_DEAD; 457 tval = POWER_SUPPLY_HEALTH_DEAD;
457 else if (tval & BQ27500_FLAG_OTC) 458 else if (tval & BQ27500_FLAG_OTC)
@@ -836,7 +837,6 @@ static void bq27x00_powersupply_unregister(struct bq27x00_device_info *di)
836 mutex_destroy(&di->lock); 837 mutex_destroy(&di->lock);
837} 838}
838 839
839
840/* i2c specific code */ 840/* i2c specific code */
841#ifdef CONFIG_BATTERY_BQ27X00_I2C 841#ifdef CONFIG_BATTERY_BQ27X00_I2C
842 842
@@ -897,14 +897,12 @@ static int bq27x00_battery_probe(struct i2c_client *client,
897 897
898 name = devm_kasprintf(&client->dev, GFP_KERNEL, "%s-%d", id->name, num); 898 name = devm_kasprintf(&client->dev, GFP_KERNEL, "%s-%d", id->name, num);
899 if (!name) { 899 if (!name) {
900 dev_err(&client->dev, "failed to allocate device name\n");
901 retval = -ENOMEM; 900 retval = -ENOMEM;
902 goto batt_failed; 901 goto batt_failed;
903 } 902 }
904 903
905 di = devm_kzalloc(&client->dev, sizeof(*di), GFP_KERNEL); 904 di = devm_kzalloc(&client->dev, sizeof(*di), GFP_KERNEL);
906 if (!di) { 905 if (!di) {
907 dev_err(&client->dev, "failed to allocate device info data\n");
908 retval = -ENOMEM; 906 retval = -ENOMEM;
909 goto batt_failed; 907 goto batt_failed;
910 } 908 }
@@ -965,8 +963,9 @@ static struct i2c_driver bq27x00_battery_driver = {
965static inline int bq27x00_battery_i2c_init(void) 963static inline int bq27x00_battery_i2c_init(void)
966{ 964{
967 int ret = i2c_add_driver(&bq27x00_battery_driver); 965 int ret = i2c_add_driver(&bq27x00_battery_driver);
966
968 if (ret) 967 if (ret)
969 printk(KERN_ERR "Unable to register BQ27x00 i2c driver\n"); 968 pr_err("Unable to register BQ27x00 i2c driver\n");
970 969
971 return ret; 970 return ret;
972} 971}
@@ -1037,10 +1036,8 @@ static int bq27000_battery_probe(struct platform_device *pdev)
1037 } 1036 }
1038 1037
1039 di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); 1038 di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL);
1040 if (!di) { 1039 if (!di)
1041 dev_err(&pdev->dev, "failed to allocate device info data\n");
1042 return -ENOMEM; 1040 return -ENOMEM;
1043 }
1044 1041
1045 platform_set_drvdata(pdev, di); 1042 platform_set_drvdata(pdev, di);
1046 1043
@@ -1073,8 +1070,9 @@ static struct platform_driver bq27000_battery_driver = {
1073static inline int bq27x00_battery_platform_init(void) 1070static inline int bq27x00_battery_platform_init(void)
1074{ 1071{
1075 int ret = platform_driver_register(&bq27000_battery_driver); 1072 int ret = platform_driver_register(&bq27000_battery_driver);
1073
1076 if (ret) 1074 if (ret)
1077 printk(KERN_ERR "Unable to register BQ27000 platform driver\n"); 1075 pr_err("Unable to register BQ27000 platform driver\n");
1078 1076
1079 return ret; 1077 return ret;
1080} 1078}