diff options
author | Joe Perches <joe@perches.com> | 2013-06-06 21:25:12 -0400 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-06-09 13:07:36 -0400 |
commit | e5409cbd8c0bf44f65e7528635cf05ed298e0c61 (patch) | |
tree | bb5bea82e368b4fbeb29d2cda3d50e74626bcbb0 /drivers/power/charger-manager.c | |
parent | e24142178fc2f60824af4312d326edacdcd667a3 (diff) |
charger-manager: Add missing newlines, fix a couple of typos, add pr_fmt
Make sure that dev_<level> calls are newline terminated.
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt to prefix
all pr_<level> calls with "charger-manager: "
Fix a couple of typos.
Fix formats with terminating n that should be \n.
Coalesce formats for easier grep.
Align arguments to open parenthesis for these dev_<level> calls.
Add missing spaces after coalescing multiple string segments.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power/charger-manager.c')
-rw-r--r-- | drivers/power/charger-manager.c | 137 |
1 files changed, 57 insertions, 80 deletions
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 98de1ddce458..ba420292628e 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c | |||
@@ -12,6 +12,8 @@ | |||
12 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
13 | **/ | 13 | **/ |
14 | 14 | ||
15 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
16 | |||
15 | #include <linux/io.h> | 17 | #include <linux/io.h> |
16 | #include <linux/module.h> | 18 | #include <linux/module.h> |
17 | #include <linux/irq.h> | 19 | #include <linux/irq.h> |
@@ -195,8 +197,8 @@ static bool is_charging(struct charger_manager *cm) | |||
195 | cm->charger_stat[i], | 197 | cm->charger_stat[i], |
196 | POWER_SUPPLY_PROP_ONLINE, &val); | 198 | POWER_SUPPLY_PROP_ONLINE, &val); |
197 | if (ret) { | 199 | if (ret) { |
198 | dev_warn(cm->dev, "Cannot read ONLINE value from %s.\n", | 200 | dev_warn(cm->dev, "Cannot read ONLINE value from %s\n", |
199 | cm->desc->psy_charger_stat[i]); | 201 | cm->desc->psy_charger_stat[i]); |
200 | continue; | 202 | continue; |
201 | } | 203 | } |
202 | if (val.intval == 0) | 204 | if (val.intval == 0) |
@@ -210,8 +212,8 @@ static bool is_charging(struct charger_manager *cm) | |||
210 | cm->charger_stat[i], | 212 | cm->charger_stat[i], |
211 | POWER_SUPPLY_PROP_STATUS, &val); | 213 | POWER_SUPPLY_PROP_STATUS, &val); |
212 | if (ret) { | 214 | if (ret) { |
213 | dev_warn(cm->dev, "Cannot read STATUS value from %s.\n", | 215 | dev_warn(cm->dev, "Cannot read STATUS value from %s\n", |
214 | cm->desc->psy_charger_stat[i]); | 216 | cm->desc->psy_charger_stat[i]); |
215 | continue; | 217 | continue; |
216 | } | 218 | } |
217 | if (val.intval == POWER_SUPPLY_STATUS_FULL || | 219 | if (val.intval == POWER_SUPPLY_STATUS_FULL || |
@@ -289,7 +291,7 @@ static bool is_polling_required(struct charger_manager *cm) | |||
289 | return is_charging(cm); | 291 | return is_charging(cm); |
290 | default: | 292 | default: |
291 | dev_warn(cm->dev, "Incorrect polling_mode (%d)\n", | 293 | dev_warn(cm->dev, "Incorrect polling_mode (%d)\n", |
292 | cm->desc->polling_mode); | 294 | cm->desc->polling_mode); |
293 | } | 295 | } |
294 | 296 | ||
295 | return false; | 297 | return false; |
@@ -331,9 +333,8 @@ static int try_charger_enable(struct charger_manager *cm, bool enable) | |||
331 | 333 | ||
332 | err = regulator_enable(desc->charger_regulators[i].consumer); | 334 | err = regulator_enable(desc->charger_regulators[i].consumer); |
333 | if (err < 0) { | 335 | if (err < 0) { |
334 | dev_warn(cm->dev, | 336 | dev_warn(cm->dev, "Cannot enable %s regulator\n", |
335 | "Cannot enable %s regulator\n", | 337 | desc->charger_regulators[i].regulator_name); |
336 | desc->charger_regulators[i].regulator_name); | ||
337 | } | 338 | } |
338 | } | 339 | } |
339 | } else { | 340 | } else { |
@@ -350,9 +351,8 @@ static int try_charger_enable(struct charger_manager *cm, bool enable) | |||
350 | 351 | ||
351 | err = regulator_disable(desc->charger_regulators[i].consumer); | 352 | err = regulator_disable(desc->charger_regulators[i].consumer); |
352 | if (err < 0) { | 353 | if (err < 0) { |
353 | dev_warn(cm->dev, | 354 | dev_warn(cm->dev, "Cannot disable %s regulator\n", |
354 | "Cannot disable %s regulator\n", | 355 | desc->charger_regulators[i].regulator_name); |
355 | desc->charger_regulators[i].regulator_name); | ||
356 | } | 356 | } |
357 | } | 357 | } |
358 | 358 | ||
@@ -365,9 +365,8 @@ static int try_charger_enable(struct charger_manager *cm, bool enable) | |||
365 | desc->charger_regulators[i].consumer)) { | 365 | desc->charger_regulators[i].consumer)) { |
366 | regulator_force_disable( | 366 | regulator_force_disable( |
367 | desc->charger_regulators[i].consumer); | 367 | desc->charger_regulators[i].consumer); |
368 | dev_warn(cm->dev, | 368 | dev_warn(cm->dev, "Disable regulator(%s) forcibly\n", |
369 | "Disable regulator(%s) forcibly.\n", | 369 | desc->charger_regulators[i].regulator_name); |
370 | desc->charger_regulators[i].regulator_name); | ||
371 | } | 370 | } |
372 | } | 371 | } |
373 | } | 372 | } |
@@ -450,7 +449,7 @@ static void uevent_notify(struct charger_manager *cm, const char *event) | |||
450 | strncpy(env_str, event, UEVENT_BUF_SIZE); | 449 | strncpy(env_str, event, UEVENT_BUF_SIZE); |
451 | kobject_uevent(&cm->dev->kobj, KOBJ_CHANGE); | 450 | kobject_uevent(&cm->dev->kobj, KOBJ_CHANGE); |
452 | 451 | ||
453 | dev_info(cm->dev, "%s", event); | 452 | dev_info(cm->dev, "%s\n", event); |
454 | } | 453 | } |
455 | 454 | ||
456 | /** | 455 | /** |
@@ -478,7 +477,7 @@ static void fullbatt_vchk(struct work_struct *work) | |||
478 | 477 | ||
479 | err = get_batt_uV(cm, &batt_uV); | 478 | err = get_batt_uV(cm, &batt_uV); |
480 | if (err) { | 479 | if (err) { |
481 | dev_err(cm->dev, "%s: get_batt_uV error(%d).\n", __func__, err); | 480 | dev_err(cm->dev, "%s: get_batt_uV error(%d)\n", __func__, err); |
482 | return; | 481 | return; |
483 | } | 482 | } |
484 | 483 | ||
@@ -486,7 +485,7 @@ static void fullbatt_vchk(struct work_struct *work) | |||
486 | if (diff < 0) | 485 | if (diff < 0) |
487 | return; | 486 | return; |
488 | 487 | ||
489 | dev_info(cm->dev, "VBATT dropped %duV after full-batt.\n", diff); | 488 | dev_info(cm->dev, "VBATT dropped %duV after full-batt\n", diff); |
490 | 489 | ||
491 | if (diff > desc->fullbatt_vchkdrop_uV) { | 490 | if (diff > desc->fullbatt_vchkdrop_uV) { |
492 | try_charger_restart(cm); | 491 | try_charger_restart(cm); |
@@ -519,7 +518,7 @@ static int check_charging_duration(struct charger_manager *cm) | |||
519 | duration = curr - cm->charging_start_time; | 518 | duration = curr - cm->charging_start_time; |
520 | 519 | ||
521 | if (duration > desc->charging_max_duration_ms) { | 520 | if (duration > desc->charging_max_duration_ms) { |
522 | dev_info(cm->dev, "Charging duration exceed %lldms", | 521 | dev_info(cm->dev, "Charging duration exceed %lldms\n", |
523 | desc->charging_max_duration_ms); | 522 | desc->charging_max_duration_ms); |
524 | uevent_notify(cm, "Discharging"); | 523 | uevent_notify(cm, "Discharging"); |
525 | try_charger_enable(cm, false); | 524 | try_charger_enable(cm, false); |
@@ -530,9 +529,9 @@ static int check_charging_duration(struct charger_manager *cm) | |||
530 | 529 | ||
531 | if (duration > desc->charging_max_duration_ms && | 530 | if (duration > desc->charging_max_duration_ms && |
532 | is_ext_pwr_online(cm)) { | 531 | is_ext_pwr_online(cm)) { |
533 | dev_info(cm->dev, "DisCharging duration exceed %lldms", | 532 | dev_info(cm->dev, "Discharging duration exceed %lldms\n", |
534 | desc->discharging_max_duration_ms); | 533 | desc->discharging_max_duration_ms); |
535 | uevent_notify(cm, "Recharing"); | 534 | uevent_notify(cm, "Recharging"); |
536 | try_charger_enable(cm, true); | 535 | try_charger_enable(cm, true); |
537 | ret = true; | 536 | ret = true; |
538 | } | 537 | } |
@@ -579,7 +578,7 @@ static bool _cm_monitor(struct charger_manager *cm) | |||
579 | */ | 578 | */ |
580 | } else if (!cm->emergency_stop && check_charging_duration(cm)) { | 579 | } else if (!cm->emergency_stop && check_charging_duration(cm)) { |
581 | dev_dbg(cm->dev, | 580 | dev_dbg(cm->dev, |
582 | "Charging/Discharging duration is out of range"); | 581 | "Charging/Discharging duration is out of range\n"); |
583 | /* | 582 | /* |
584 | * Check dropped voltage of battery. If battery voltage is more | 583 | * Check dropped voltage of battery. If battery voltage is more |
585 | * dropped than fullbatt_vchkdrop_uV after fully charged state, | 584 | * dropped than fullbatt_vchkdrop_uV after fully charged state, |
@@ -595,7 +594,7 @@ static bool _cm_monitor(struct charger_manager *cm) | |||
595 | */ | 594 | */ |
596 | } else if (!cm->emergency_stop && is_full_charged(cm) && | 595 | } else if (!cm->emergency_stop && is_full_charged(cm) && |
597 | cm->charger_enabled) { | 596 | cm->charger_enabled) { |
598 | dev_info(cm->dev, "EVENT_HANDLE: Battery Fully Charged.\n"); | 597 | dev_info(cm->dev, "EVENT_HANDLE: Battery Fully Charged\n"); |
599 | uevent_notify(cm, default_event_names[CM_EVENT_BATT_FULL]); | 598 | uevent_notify(cm, default_event_names[CM_EVENT_BATT_FULL]); |
600 | 599 | ||
601 | try_charger_enable(cm, false); | 600 | try_charger_enable(cm, false); |
@@ -725,7 +724,7 @@ static void fullbatt_handler(struct charger_manager *cm) | |||
725 | cm->fullbatt_vchk_jiffies_at = 1; | 724 | cm->fullbatt_vchk_jiffies_at = 1; |
726 | 725 | ||
727 | out: | 726 | out: |
728 | dev_info(cm->dev, "EVENT_HANDLE: Battery Fully Charged.\n"); | 727 | dev_info(cm->dev, "EVENT_HANDLE: Battery Fully Charged\n"); |
729 | uevent_notify(cm, default_event_names[CM_EVENT_BATT_FULL]); | 728 | uevent_notify(cm, default_event_names[CM_EVENT_BATT_FULL]); |
730 | } | 729 | } |
731 | 730 | ||
@@ -972,7 +971,7 @@ static bool cm_setup_timer(void) | |||
972 | mutex_unlock(&cm_list_mtx); | 971 | mutex_unlock(&cm_list_mtx); |
973 | 972 | ||
974 | if (wakeup_ms < UINT_MAX && wakeup_ms > 0) { | 973 | if (wakeup_ms < UINT_MAX && wakeup_ms > 0) { |
975 | pr_info("Charger Manager wakeup timer: %u ms.\n", wakeup_ms); | 974 | pr_info("Charger Manager wakeup timer: %u ms\n", wakeup_ms); |
976 | if (rtc_dev) { | 975 | if (rtc_dev) { |
977 | struct rtc_wkalrm tmp; | 976 | struct rtc_wkalrm tmp; |
978 | unsigned long time, now; | 977 | unsigned long time, now; |
@@ -1005,8 +1004,7 @@ static bool cm_setup_timer(void) | |||
1005 | ret = false; | 1004 | ret = false; |
1006 | } | 1005 | } |
1007 | 1006 | ||
1008 | pr_info("Waking up after %lu secs.\n", | 1007 | pr_info("Waking up after %lu secs\n", time - now); |
1009 | time - now); | ||
1010 | 1008 | ||
1011 | rtc_time_to_tm(time, &tmp.time); | 1009 | rtc_time_to_tm(time, &tmp.time); |
1012 | rtc_set_alarm(rtc_dev, &tmp); | 1010 | rtc_set_alarm(rtc_dev, &tmp); |
@@ -1101,7 +1099,7 @@ int setup_charger_manager(struct charger_global_desc *gd) | |||
1101 | g_desc = NULL; | 1099 | g_desc = NULL; |
1102 | 1100 | ||
1103 | if (!gd->rtc_only_wakeup) { | 1101 | if (!gd->rtc_only_wakeup) { |
1104 | pr_err("The callback rtc_only_wakeup is not given.\n"); | 1102 | pr_err("The callback rtc_only_wakeup is not given\n"); |
1105 | return -EINVAL; | 1103 | return -EINVAL; |
1106 | } | 1104 | } |
1107 | 1105 | ||
@@ -1112,7 +1110,7 @@ int setup_charger_manager(struct charger_global_desc *gd) | |||
1112 | /* Retry at probe. RTC may be not registered yet */ | 1110 | /* Retry at probe. RTC may be not registered yet */ |
1113 | } | 1111 | } |
1114 | } else { | 1112 | } else { |
1115 | pr_warn("No wakeup timer is given for charger manager." | 1113 | pr_warn("No wakeup timer is given for charger manager. " |
1116 | "In-suspend monitoring won't work.\n"); | 1114 | "In-suspend monitoring won't work.\n"); |
1117 | } | 1115 | } |
1118 | 1116 | ||
@@ -1138,13 +1136,13 @@ static void charger_extcon_work(struct work_struct *work) | |||
1138 | cable->min_uA, cable->max_uA); | 1136 | cable->min_uA, cable->max_uA); |
1139 | if (ret < 0) { | 1137 | if (ret < 0) { |
1140 | pr_err("Cannot set current limit of %s (%s)\n", | 1138 | pr_err("Cannot set current limit of %s (%s)\n", |
1141 | cable->charger->regulator_name, cable->name); | 1139 | cable->charger->regulator_name, cable->name); |
1142 | return; | 1140 | return; |
1143 | } | 1141 | } |
1144 | 1142 | ||
1145 | pr_info("Set current limit of %s : %duA ~ %duA\n", | 1143 | pr_info("Set current limit of %s : %duA ~ %duA\n", |
1146 | cable->charger->regulator_name, | 1144 | cable->charger->regulator_name, |
1147 | cable->min_uA, cable->max_uA); | 1145 | cable->min_uA, cable->max_uA); |
1148 | } | 1146 | } |
1149 | 1147 | ||
1150 | try_charger_enable(cable->cm, cable->attached); | 1148 | try_charger_enable(cable->cm, cable->attached); |
@@ -1210,9 +1208,8 @@ static int charger_extcon_init(struct charger_manager *cm, | |||
1210 | ret = extcon_register_interest(&cable->extcon_dev, | 1208 | ret = extcon_register_interest(&cable->extcon_dev, |
1211 | cable->extcon_name, cable->name, &cable->nb); | 1209 | cable->extcon_name, cable->name, &cable->nb); |
1212 | if (ret < 0) { | 1210 | if (ret < 0) { |
1213 | pr_info("Cannot register extcon_dev for %s(cable: %s).\n", | 1211 | pr_info("Cannot register extcon_dev for %s(cable: %s)\n", |
1214 | cable->extcon_name, | 1212 | cable->extcon_name, cable->name); |
1215 | cable->name); | ||
1216 | ret = -EINVAL; | 1213 | ret = -EINVAL; |
1217 | } | 1214 | } |
1218 | 1215 | ||
@@ -1243,8 +1240,8 @@ static int charger_manager_register_extcon(struct charger_manager *cm) | |||
1243 | charger->consumer = regulator_get(cm->dev, | 1240 | charger->consumer = regulator_get(cm->dev, |
1244 | charger->regulator_name); | 1241 | charger->regulator_name); |
1245 | if (charger->consumer == NULL) { | 1242 | if (charger->consumer == NULL) { |
1246 | dev_err(cm->dev, "Cannot find charger(%s)n", | 1243 | dev_err(cm->dev, "Cannot find charger(%s)\n", |
1247 | charger->regulator_name); | 1244 | charger->regulator_name); |
1248 | ret = -EINVAL; | 1245 | ret = -EINVAL; |
1249 | goto err; | 1246 | goto err; |
1250 | } | 1247 | } |
@@ -1255,8 +1252,8 @@ static int charger_manager_register_extcon(struct charger_manager *cm) | |||
1255 | 1252 | ||
1256 | ret = charger_extcon_init(cm, cable); | 1253 | ret = charger_extcon_init(cm, cable); |
1257 | if (ret < 0) { | 1254 | if (ret < 0) { |
1258 | dev_err(cm->dev, "Cannot initialize charger(%s)n", | 1255 | dev_err(cm->dev, "Cannot initialize charger(%s)\n", |
1259 | charger->regulator_name); | 1256 | charger->regulator_name); |
1260 | goto err; | 1257 | goto err; |
1261 | } | 1258 | } |
1262 | cable->charger = charger; | 1259 | cable->charger = charger; |
@@ -1347,10 +1344,8 @@ static ssize_t charger_externally_control_store(struct device *dev, | |||
1347 | } | 1344 | } |
1348 | } else { | 1345 | } else { |
1349 | dev_warn(cm->dev, | 1346 | dev_warn(cm->dev, |
1350 | "'%s' regulator should be controlled " | 1347 | "'%s' regulator should be controlled in charger-manager because charger-manager must need at least one charger for charging\n", |
1351 | "in charger-manager because charger-manager " | 1348 | charger->regulator_name); |
1352 | "must need at least one charger for charging\n", | ||
1353 | charger->regulator_name); | ||
1354 | } | 1349 | } |
1355 | 1350 | ||
1356 | return count; | 1351 | return count; |
@@ -1386,8 +1381,6 @@ static int charger_manager_register_sysfs(struct charger_manager *cm) | |||
1386 | snprintf(buf, 10, "charger.%d", i); | 1381 | snprintf(buf, 10, "charger.%d", i); |
1387 | str = kzalloc(sizeof(char) * (strlen(buf) + 1), GFP_KERNEL); | 1382 | str = kzalloc(sizeof(char) * (strlen(buf) + 1), GFP_KERNEL); |
1388 | if (!str) { | 1383 | if (!str) { |
1389 | dev_err(cm->dev, "Cannot allocate memory: %s\n", | ||
1390 | charger->regulator_name); | ||
1391 | ret = -ENOMEM; | 1384 | ret = -ENOMEM; |
1392 | goto err; | 1385 | goto err; |
1393 | } | 1386 | } |
@@ -1423,26 +1416,21 @@ static int charger_manager_register_sysfs(struct charger_manager *cm) | |||
1423 | !chargers_externally_control) | 1416 | !chargers_externally_control) |
1424 | chargers_externally_control = 0; | 1417 | chargers_externally_control = 0; |
1425 | 1418 | ||
1426 | dev_info(cm->dev, "'%s' regulator's externally_control" | 1419 | dev_info(cm->dev, "'%s' regulator's externally_control is %d\n", |
1427 | "is %d\n", charger->regulator_name, | 1420 | charger->regulator_name, charger->externally_control); |
1428 | charger->externally_control); | ||
1429 | 1421 | ||
1430 | ret = sysfs_create_group(&cm->charger_psy.dev->kobj, | 1422 | ret = sysfs_create_group(&cm->charger_psy.dev->kobj, |
1431 | &charger->attr_g); | 1423 | &charger->attr_g); |
1432 | if (ret < 0) { | 1424 | if (ret < 0) { |
1433 | dev_err(cm->dev, "Cannot create sysfs entry" | 1425 | dev_err(cm->dev, "Cannot create sysfs entry of %s regulator\n", |
1434 | "of %s regulator\n", | 1426 | charger->regulator_name); |
1435 | charger->regulator_name); | ||
1436 | ret = -EINVAL; | 1427 | ret = -EINVAL; |
1437 | goto err; | 1428 | goto err; |
1438 | } | 1429 | } |
1439 | } | 1430 | } |
1440 | 1431 | ||
1441 | if (chargers_externally_control) { | 1432 | if (chargers_externally_control) { |
1442 | dev_err(cm->dev, "Cannot register regulator because " | 1433 | dev_err(cm->dev, "Cannot register regulator because charger-manager must need at least one charger for charging battery\n"); |
1443 | "charger-manager must need at least " | ||
1444 | "one charger for charging battery\n"); | ||
1445 | |||
1446 | ret = -EINVAL; | 1434 | ret = -EINVAL; |
1447 | goto err; | 1435 | goto err; |
1448 | } | 1436 | } |
@@ -1463,7 +1451,7 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1463 | rtc_dev = rtc_class_open(g_desc->rtc_name); | 1451 | rtc_dev = rtc_class_open(g_desc->rtc_name); |
1464 | if (IS_ERR_OR_NULL(rtc_dev)) { | 1452 | if (IS_ERR_OR_NULL(rtc_dev)) { |
1465 | rtc_dev = NULL; | 1453 | rtc_dev = NULL; |
1466 | dev_err(&pdev->dev, "Cannot get RTC %s.\n", | 1454 | dev_err(&pdev->dev, "Cannot get RTC %s\n", |
1467 | g_desc->rtc_name); | 1455 | g_desc->rtc_name); |
1468 | ret = -ENODEV; | 1456 | ret = -ENODEV; |
1469 | goto err_alloc; | 1457 | goto err_alloc; |
@@ -1471,14 +1459,13 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1471 | } | 1459 | } |
1472 | 1460 | ||
1473 | if (!desc) { | 1461 | if (!desc) { |
1474 | dev_err(&pdev->dev, "No platform data (desc) found.\n"); | 1462 | dev_err(&pdev->dev, "No platform data (desc) found\n"); |
1475 | ret = -ENODEV; | 1463 | ret = -ENODEV; |
1476 | goto err_alloc; | 1464 | goto err_alloc; |
1477 | } | 1465 | } |
1478 | 1466 | ||
1479 | cm = kzalloc(sizeof(struct charger_manager), GFP_KERNEL); | 1467 | cm = kzalloc(sizeof(struct charger_manager), GFP_KERNEL); |
1480 | if (!cm) { | 1468 | if (!cm) { |
1481 | dev_err(&pdev->dev, "Cannot allocate memory.\n"); | ||
1482 | ret = -ENOMEM; | 1469 | ret = -ENOMEM; |
1483 | goto err_alloc; | 1470 | goto err_alloc; |
1484 | } | 1471 | } |
@@ -1487,7 +1474,6 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1487 | cm->dev = &pdev->dev; | 1474 | cm->dev = &pdev->dev; |
1488 | cm->desc = kmemdup(desc, sizeof(struct charger_desc), GFP_KERNEL); | 1475 | cm->desc = kmemdup(desc, sizeof(struct charger_desc), GFP_KERNEL); |
1489 | if (!cm->desc) { | 1476 | if (!cm->desc) { |
1490 | dev_err(&pdev->dev, "Cannot allocate memory.\n"); | ||
1491 | ret = -ENOMEM; | 1477 | ret = -ENOMEM; |
1492 | goto err_alloc_desc; | 1478 | goto err_alloc_desc; |
1493 | } | 1479 | } |
@@ -1498,33 +1484,28 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1498 | * Users may intentionally ignore those two features. | 1484 | * Users may intentionally ignore those two features. |
1499 | */ | 1485 | */ |
1500 | if (desc->fullbatt_uV == 0) { | 1486 | if (desc->fullbatt_uV == 0) { |
1501 | dev_info(&pdev->dev, "Ignoring full-battery voltage threshold" | 1487 | dev_info(&pdev->dev, "Ignoring full-battery voltage threshold as it is not supplied\n"); |
1502 | " as it is not supplied."); | ||
1503 | } | 1488 | } |
1504 | if (!desc->fullbatt_vchkdrop_ms || !desc->fullbatt_vchkdrop_uV) { | 1489 | if (!desc->fullbatt_vchkdrop_ms || !desc->fullbatt_vchkdrop_uV) { |
1505 | dev_info(&pdev->dev, "Disabling full-battery voltage drop " | 1490 | dev_info(&pdev->dev, "Disabling full-battery voltage drop checking mechanism as it is not supplied\n"); |
1506 | "checking mechanism as it is not supplied."); | ||
1507 | desc->fullbatt_vchkdrop_ms = 0; | 1491 | desc->fullbatt_vchkdrop_ms = 0; |
1508 | desc->fullbatt_vchkdrop_uV = 0; | 1492 | desc->fullbatt_vchkdrop_uV = 0; |
1509 | } | 1493 | } |
1510 | if (desc->fullbatt_soc == 0) { | 1494 | if (desc->fullbatt_soc == 0) { |
1511 | dev_info(&pdev->dev, "Ignoring full-battery soc(state of" | 1495 | dev_info(&pdev->dev, "Ignoring full-battery soc(state of charge) threshold as it is not supplied\n"); |
1512 | " charge) threshold as it is not" | ||
1513 | " supplied."); | ||
1514 | } | 1496 | } |
1515 | if (desc->fullbatt_full_capacity == 0) { | 1497 | if (desc->fullbatt_full_capacity == 0) { |
1516 | dev_info(&pdev->dev, "Ignoring full-battery full capacity" | 1498 | dev_info(&pdev->dev, "Ignoring full-battery full capacity threshold as it is not supplied\n"); |
1517 | " threshold as it is not supplied."); | ||
1518 | } | 1499 | } |
1519 | 1500 | ||
1520 | if (!desc->charger_regulators || desc->num_charger_regulators < 1) { | 1501 | if (!desc->charger_regulators || desc->num_charger_regulators < 1) { |
1521 | ret = -EINVAL; | 1502 | ret = -EINVAL; |
1522 | dev_err(&pdev->dev, "charger_regulators undefined.\n"); | 1503 | dev_err(&pdev->dev, "charger_regulators undefined\n"); |
1523 | goto err_no_charger; | 1504 | goto err_no_charger; |
1524 | } | 1505 | } |
1525 | 1506 | ||
1526 | if (!desc->psy_charger_stat || !desc->psy_charger_stat[0]) { | 1507 | if (!desc->psy_charger_stat || !desc->psy_charger_stat[0]) { |
1527 | dev_err(&pdev->dev, "No power supply defined.\n"); | 1508 | dev_err(&pdev->dev, "No power supply defined\n"); |
1528 | ret = -EINVAL; | 1509 | ret = -EINVAL; |
1529 | goto err_no_charger_stat; | 1510 | goto err_no_charger_stat; |
1530 | } | 1511 | } |
@@ -1544,9 +1525,8 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1544 | cm->charger_stat[i] = power_supply_get_by_name( | 1525 | cm->charger_stat[i] = power_supply_get_by_name( |
1545 | desc->psy_charger_stat[i]); | 1526 | desc->psy_charger_stat[i]); |
1546 | if (!cm->charger_stat[i]) { | 1527 | if (!cm->charger_stat[i]) { |
1547 | dev_err(&pdev->dev, "Cannot find power supply " | 1528 | dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", |
1548 | "\"%s\"\n", | 1529 | desc->psy_charger_stat[i]); |
1549 | desc->psy_charger_stat[i]); | ||
1550 | ret = -ENODEV; | 1530 | ret = -ENODEV; |
1551 | goto err_chg_stat; | 1531 | goto err_chg_stat; |
1552 | } | 1532 | } |
@@ -1555,7 +1535,7 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1555 | cm->fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); | 1535 | cm->fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); |
1556 | if (!cm->fuel_gauge) { | 1536 | if (!cm->fuel_gauge) { |
1557 | dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", | 1537 | dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", |
1558 | desc->psy_fuel_gauge); | 1538 | desc->psy_fuel_gauge); |
1559 | ret = -ENODEV; | 1539 | ret = -ENODEV; |
1560 | goto err_chg_stat; | 1540 | goto err_chg_stat; |
1561 | } | 1541 | } |
@@ -1575,9 +1555,7 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1575 | 1555 | ||
1576 | if (!desc->charging_max_duration_ms || | 1556 | if (!desc->charging_max_duration_ms || |
1577 | !desc->discharging_max_duration_ms) { | 1557 | !desc->discharging_max_duration_ms) { |
1578 | dev_info(&pdev->dev, "Cannot limit charging duration " | 1558 | dev_info(&pdev->dev, "Cannot limit charging duration checking mechanism to prevent overcharge/overheat and control discharging duration\n"); |
1579 | "checking mechanism to prevent overcharge/overheat " | ||
1580 | "and control discharging duration"); | ||
1581 | desc->charging_max_duration_ms = 0; | 1559 | desc->charging_max_duration_ms = 0; |
1582 | desc->discharging_max_duration_ms = 0; | 1560 | desc->discharging_max_duration_ms = 0; |
1583 | } | 1561 | } |
@@ -1598,7 +1576,6 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1598 | NUM_CHARGER_PSY_OPTIONAL), | 1576 | NUM_CHARGER_PSY_OPTIONAL), |
1599 | GFP_KERNEL); | 1577 | GFP_KERNEL); |
1600 | if (!cm->charger_psy.properties) { | 1578 | if (!cm->charger_psy.properties) { |
1601 | dev_err(&pdev->dev, "Cannot allocate for psy properties.\n"); | ||
1602 | ret = -ENOMEM; | 1579 | ret = -ENOMEM; |
1603 | goto err_chg_stat; | 1580 | goto err_chg_stat; |
1604 | } | 1581 | } |
@@ -1636,8 +1613,8 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1636 | 1613 | ||
1637 | ret = power_supply_register(NULL, &cm->charger_psy); | 1614 | ret = power_supply_register(NULL, &cm->charger_psy); |
1638 | if (ret) { | 1615 | if (ret) { |
1639 | dev_err(&pdev->dev, "Cannot register charger-manager with" | 1616 | dev_err(&pdev->dev, "Cannot register charger-manager with name \"%s\"\n", |
1640 | " name \"%s\".\n", cm->charger_psy.name); | 1617 | cm->charger_psy.name); |
1641 | goto err_register; | 1618 | goto err_register; |
1642 | } | 1619 | } |
1643 | 1620 | ||
@@ -1948,7 +1925,7 @@ void cm_notify_event(struct power_supply *psy, enum cm_event_types type, | |||
1948 | uevent_notify(cm, msg ? msg : default_event_names[type]); | 1925 | uevent_notify(cm, msg ? msg : default_event_names[type]); |
1949 | break; | 1926 | break; |
1950 | default: | 1927 | default: |
1951 | dev_err(cm->dev, "%s type not specified.\n", __func__); | 1928 | dev_err(cm->dev, "%s: type not specified\n", __func__); |
1952 | break; | 1929 | break; |
1953 | } | 1930 | } |
1954 | } | 1931 | } |