diff options
author | Jonghwa Lee <jonghwa3.lee@samsung.com> | 2013-10-21 18:33:48 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-03-20 17:41:08 +0900 |
commit | c9a1c736bf168aa8c6b1aa560458179a60f37030 (patch) | |
tree | df8cc786ccf11e0383d90e1478d52a92c17d28eb | |
parent | 664660cf614b3eab9f3e47a7a7007120aba54f23 (diff) | |
download | linux-3.10-c9a1c736bf168aa8c6b1aa560458179a60f37030.tar.gz linux-3.10-c9a1c736bf168aa8c6b1aa560458179a60f37030.tar.bz2 linux-3.10-c9a1c736bf168aa8c6b1aa560458179a60f37030.zip |
charger-manager: Add cm_chg_add_prorperty() macro.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
-rw-r--r-- | drivers/power/charger-manager.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 5c6fb102da1..00ae18c864f 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c @@ -925,6 +925,10 @@ static enum power_supply_property default_charger_props[] = { */ }; +#define cm_chg_add_property(_property) \ +{ cm->charger_psy.properties[cm->charger_psy.num_properties] = _property;\ + cm->charger_psy.num_properties++; } + static struct power_supply psy_default = { .name = "battery", .type = POWER_SUPPLY_TYPE_BATTERY, @@ -1725,27 +1729,17 @@ static int charger_manager_probe(struct platform_device *pdev) /* Find which optional psy-properties are available */ if (!cm->fuel_gauge->get_property(cm->fuel_gauge, - POWER_SUPPLY_PROP_CHARGE_NOW, &val)) { - cm->charger_psy.properties[cm->charger_psy.num_properties] = - POWER_SUPPLY_PROP_CHARGE_NOW; - cm->charger_psy.num_properties++; - } + POWER_SUPPLY_PROP_CHARGE_NOW, &val)) + cm_chg_add_property(POWER_SUPPLY_PROP_CHARGE_NOW); if (!cm->fuel_gauge->get_property(cm->fuel_gauge, POWER_SUPPLY_PROP_CURRENT_NOW, - &val)) { - cm->charger_psy.properties[cm->charger_psy.num_properties] = - POWER_SUPPLY_PROP_CURRENT_NOW; - cm->charger_psy.num_properties++; - } + &val)) + cm_chg_add_property(POWER_SUPPLY_PROP_CURRENT_NOW); if (desc->measure_battery_temp) { - cm->charger_psy.properties[cm->charger_psy.num_properties] = - POWER_SUPPLY_PROP_TEMP; - cm->charger_psy.num_properties++; + cm_chg_add_property(POWER_SUPPLY_PROP_TEMP); } else { - cm->charger_psy.properties[cm->charger_psy.num_properties] = - POWER_SUPPLY_PROP_TEMP_AMBIENT; - cm->charger_psy.num_properties++; + cm_chg_add_property(POWER_SUPPLY_PROP_TEMP_AMBIENT); } INIT_DELAYED_WORK(&cm->fullbatt_vchk_work, fullbatt_vchk); |