aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorKim, Milo <Milo.Kim@ti.com>2012-01-04 00:03:18 -0500
committerAnton Vorontsov <cbouatmailru@gmail.com>2012-01-04 00:05:51 -0500
commitce09affc59bca2a1ac1f77b75915fd914fab1f70 (patch)
treee2900229b5eb5e8fad39808cae95d6c03aa614b6 /drivers/power
parent998a8e7a72f6a81f540d3a3774d8e8aae6c7f9f2 (diff)
lp8727_charger: Coding style changes
1. Useless braces were omitted 2. Useless void casts were omitted 3. module exit name changed lp8727_chg_exit -> lp8727_exit 4. Pointer coding style changes no space between pointer('*') and pointer name ex) u8 * data -> u8 *data 5. Author information change : email and additional author Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/lp8727_charger.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/power/lp8727_charger.c b/drivers/power/lp8727_charger.c
index a7e5cc2b4d74..b15b575c070c 100644
--- a/drivers/power/lp8727_charger.c
+++ b/drivers/power/lp8727_charger.c
@@ -91,7 +91,7 @@ struct lp8727_chg {
91 enum lp8727_dev_id devid; 91 enum lp8727_dev_id devid;
92}; 92};
93 93
94static int lp8727_i2c_read(struct lp8727_chg *pchg, u8 reg, u8 * data, u8 len) 94static int lp8727_i2c_read(struct lp8727_chg *pchg, u8 reg, u8 *data, u8 len)
95{ 95{
96 s32 ret; 96 s32 ret;
97 97
@@ -102,7 +102,7 @@ static int lp8727_i2c_read(struct lp8727_chg *pchg, u8 reg, u8 * data, u8 len)
102 return (ret != len) ? -EIO : 0; 102 return (ret != len) ? -EIO : 0;
103} 103}
104 104
105static int lp8727_i2c_write(struct lp8727_chg *pchg, u8 reg, u8 * data, u8 len) 105static int lp8727_i2c_write(struct lp8727_chg *pchg, u8 reg, u8 *data, u8 len)
106{ 106{
107 s32 ret; 107 s32 ret;
108 108
@@ -114,13 +114,13 @@ static int lp8727_i2c_write(struct lp8727_chg *pchg, u8 reg, u8 * data, u8 len)
114} 114}
115 115
116static inline int lp8727_i2c_read_byte(struct lp8727_chg *pchg, u8 reg, 116static inline int lp8727_i2c_read_byte(struct lp8727_chg *pchg, u8 reg,
117 u8 * data) 117 u8 *data)
118{ 118{
119 return lp8727_i2c_read(pchg, reg, data, 1); 119 return lp8727_i2c_read(pchg, reg, data, 1);
120} 120}
121 121
122static inline int lp8727_i2c_write_byte(struct lp8727_chg *pchg, u8 reg, 122static inline int lp8727_i2c_write_byte(struct lp8727_chg *pchg, u8 reg,
123 u8 * data) 123 u8 *data)
124{ 124{
125 return lp8727_i2c_write(pchg, reg, data, 1); 125 return lp8727_i2c_write(pchg, reg, data, 1);
126} 126}
@@ -153,21 +153,21 @@ static void lp8727_init_device(struct lp8727_chg *pchg)
153static int lp8727_is_dedicated_charger(struct lp8727_chg *pchg) 153static int lp8727_is_dedicated_charger(struct lp8727_chg *pchg)
154{ 154{
155 u8 val; 155 u8 val;
156 (void)lp8727_i2c_read_byte(pchg, STATUS1, &val); 156 lp8727_i2c_read_byte(pchg, STATUS1, &val);
157 return (val & DCPORT); 157 return (val & DCPORT);
158} 158}
159 159
160static int lp8727_is_usb_charger(struct lp8727_chg *pchg) 160static int lp8727_is_usb_charger(struct lp8727_chg *pchg)
161{ 161{
162 u8 val; 162 u8 val;
163 (void)lp8727_i2c_read_byte(pchg, STATUS1, &val); 163 lp8727_i2c_read_byte(pchg, STATUS1, &val);
164 return (val & CHPORT); 164 return (val & CHPORT);
165} 165}
166 166
167static void lp8727_ctrl_switch(struct lp8727_chg *pchg, u8 sw) 167static void lp8727_ctrl_switch(struct lp8727_chg *pchg, u8 sw)
168{ 168{
169 u8 val = sw; 169 u8 val = sw;
170 (void)lp8727_i2c_write_byte(pchg, SWCTRL, &val); 170 lp8727_i2c_write_byte(pchg, SWCTRL, &val);
171} 171}
172 172
173static void lp8727_id_detection(struct lp8727_chg *pchg, u8 id, int vbusin) 173static void lp8727_id_detection(struct lp8727_chg *pchg, u8 id, int vbusin)
@@ -207,9 +207,9 @@ static void lp8727_enable_chgdet(struct lp8727_chg *pchg)
207{ 207{
208 u8 val; 208 u8 val;
209 209
210 (void)lp8727_i2c_read_byte(pchg, CTRL2, &val); 210 lp8727_i2c_read_byte(pchg, CTRL2, &val);
211 val |= CHGDET_EN; 211 val |= CHGDET_EN;
212 (void)lp8727_i2c_write_byte(pchg, CTRL2, &val); 212 lp8727_i2c_write_byte(pchg, CTRL2, &val);
213} 213}
214 214
215static void lp8727_delayed_func(struct work_struct *_work) 215static void lp8727_delayed_func(struct work_struct *_work)
@@ -283,10 +283,9 @@ static int lp8727_charger_get_property(struct power_supply *psy,
283{ 283{
284 struct lp8727_chg *pchg = dev_get_drvdata(psy->dev->parent); 284 struct lp8727_chg *pchg = dev_get_drvdata(psy->dev->parent);
285 285
286 if (psp == POWER_SUPPLY_PROP_ONLINE) { 286 if (psp == POWER_SUPPLY_PROP_ONLINE)
287 val->intval = lp8727_is_charger_attached(psy->name, 287 val->intval = lp8727_is_charger_attached(psy->name,
288 pchg->devid); 288 pchg->devid);
289 }
290 289
291 return 0; 290 return 0;
292} 291}
@@ -301,7 +300,7 @@ static int lp8727_battery_get_property(struct power_supply *psy,
301 switch (psp) { 300 switch (psp) {
302 case POWER_SUPPLY_PROP_STATUS: 301 case POWER_SUPPLY_PROP_STATUS:
303 if (lp8727_is_charger_attached(psy->name, pchg->devid)) { 302 if (lp8727_is_charger_attached(psy->name, pchg->devid)) {
304 (void)lp8727_i2c_read_byte(pchg, STATUS1, &read); 303 lp8727_i2c_read_byte(pchg, STATUS1, &read);
305 if (((read & CHGSTAT) >> 4) == EOC) 304 if (((read & CHGSTAT) >> 4) == EOC)
306 val->intval = POWER_SUPPLY_STATUS_FULL; 305 val->intval = POWER_SUPPLY_STATUS_FULL;
307 else 306 else
@@ -311,7 +310,7 @@ static int lp8727_battery_get_property(struct power_supply *psy,
311 } 310 }
312 break; 311 break;
313 case POWER_SUPPLY_PROP_HEALTH: 312 case POWER_SUPPLY_PROP_HEALTH:
314 (void)lp8727_i2c_read_byte(pchg, STATUS2, &read); 313 lp8727_i2c_read_byte(pchg, STATUS2, &read);
315 read = (read & TEMP_STAT) >> 5; 314 read = (read & TEMP_STAT) >> 5;
316 if (read >= 0x1 && read <= 0x3) 315 if (read >= 0x1 && read <= 0x3)
317 val->intval = POWER_SUPPLY_HEALTH_OVERHEAT; 316 val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
@@ -352,7 +351,7 @@ static void lp8727_charger_changed(struct power_supply *psy)
352 eoc_level = pchg->chg_parm->eoc_level; 351 eoc_level = pchg->chg_parm->eoc_level;
353 ichg = pchg->chg_parm->ichg; 352 ichg = pchg->chg_parm->ichg;
354 val = (ichg << 4) | eoc_level; 353 val = (ichg << 4) | eoc_level;
355 (void)lp8727_i2c_write_byte(pchg, CHGCTRL2, &val); 354 lp8727_i2c_write_byte(pchg, CHGCTRL2, &val);
356 } 355 }
357 } 356 }
358} 357}
@@ -412,12 +411,13 @@ static void lp8727_unregister_psy(struct lp8727_chg *pchg)
412{ 411{
413 struct lp8727_psy *psy = pchg->psy; 412 struct lp8727_psy *psy = pchg->psy;
414 413
415 if (psy) { 414 if (!psy)
416 power_supply_unregister(&psy->ac); 415 return;
417 power_supply_unregister(&psy->usb); 416
418 power_supply_unregister(&psy->batt); 417 power_supply_unregister(&psy->ac);
419 kfree(psy); 418 power_supply_unregister(&psy->usb);
420 } 419 power_supply_unregister(&psy->batt);
420 kfree(psy);
421} 421}
422 422
423static int lp8727_probe(struct i2c_client *cl, const struct i2c_device_id *id) 423static int lp8727_probe(struct i2c_client *cl, const struct i2c_device_id *id)
@@ -443,10 +443,9 @@ static int lp8727_probe(struct i2c_client *cl, const struct i2c_device_id *id)
443 lp8727_intr_config(pchg); 443 lp8727_intr_config(pchg);
444 444
445 ret = lp8727_register_psy(pchg); 445 ret = lp8727_register_psy(pchg);
446 if (ret) { 446 if (ret)
447 dev_err(pchg->dev, 447 dev_err(pchg->dev,
448 "can not register power supplies. err=%d", ret); 448 "can not register power supplies. err=%d", ret);
449 }
450 449
451 return 0; 450 return 0;
452} 451}
@@ -481,14 +480,15 @@ static int __init lp8727_init(void)
481 return i2c_add_driver(&lp8727_driver); 480 return i2c_add_driver(&lp8727_driver);
482} 481}
483 482
484static void __exit lp8727_chg_exit(void) 483static void __exit lp8727_exit(void)
485{ 484{
486 i2c_del_driver(&lp8727_driver); 485 i2c_del_driver(&lp8727_driver);
487} 486}
488 487
489module_init(lp8727_init); 488module_init(lp8727_init);
490module_exit(lp8727_chg_exit); 489module_exit(lp8727_exit);
491 490
492MODULE_DESCRIPTION("National Semiconductor LP8727 charger driver"); 491MODULE_DESCRIPTION("National Semiconductor LP8727 charger driver");
493MODULE_AUTHOR("Woogyom Kim <milo.kim@nsc.com>"); 492MODULE_AUTHOR
493 ("Woogyom Kim <milo.kim@ti.com>, Daniel Jeong <daniel.jeong@ti.com>");
494MODULE_LICENSE("GPL"); 494MODULE_LICENSE("GPL");