diff options
| author | Lan Tianyu <tianyu.lan@intel.com> | 2011-06-29 23:32:40 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2011-07-14 00:04:12 -0400 |
| commit | ae6f61870490c10a0b0436e5afffa00c9dacffef (patch) | |
| tree | b39d11dd55178656d3d3605c9bdf57242499a3bf | |
| parent | 8d86e5f91440aa56a5df516bf58fe3883552ad56 (diff) | |
ACPI / Battery: Add the power unit macro
This patch is cosmetic only, and makes no functional change.
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
| -rw-r--r-- | drivers/acpi/battery.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index fcc13ac0aa18..611434f413db 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
| @@ -55,6 +55,9 @@ | |||
| 55 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 | 55 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 |
| 56 | #define ACPI_BATTERY_NOTIFY_THRESHOLD 0x82 | 56 | #define ACPI_BATTERY_NOTIFY_THRESHOLD 0x82 |
| 57 | 57 | ||
| 58 | /* Battery power unit: 0 means mW, 1 means mA */ | ||
| 59 | #define ACPI_BATTERY_POWER_UNIT_MA 1 | ||
| 60 | |||
| 58 | #define _COMPONENT ACPI_BATTERY_COMPONENT | 61 | #define _COMPONENT ACPI_BATTERY_COMPONENT |
| 59 | 62 | ||
| 60 | ACPI_MODULE_NAME("battery"); | 63 | ACPI_MODULE_NAME("battery"); |
| @@ -301,7 +304,8 @@ static enum power_supply_property energy_battery_props[] = { | |||
| 301 | #ifdef CONFIG_ACPI_PROCFS_POWER | 304 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 302 | inline char *acpi_battery_units(struct acpi_battery *battery) | 305 | inline char *acpi_battery_units(struct acpi_battery *battery) |
| 303 | { | 306 | { |
| 304 | return (battery->power_unit)?"mA":"mW"; | 307 | return (battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) ? |
| 308 | "mA" : "mW"; | ||
| 305 | } | 309 | } |
| 306 | #endif | 310 | #endif |
| 307 | 311 | ||
| @@ -544,7 +548,7 @@ static int sysfs_add_battery(struct acpi_battery *battery) | |||
| 544 | { | 548 | { |
| 545 | int result; | 549 | int result; |
| 546 | 550 | ||
| 547 | if (battery->power_unit) { | 551 | if (battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) { |
| 548 | battery->bat.properties = charge_battery_props; | 552 | battery->bat.properties = charge_battery_props; |
| 549 | battery->bat.num_properties = | 553 | battery->bat.num_properties = |
| 550 | ARRAY_SIZE(charge_battery_props); | 554 | ARRAY_SIZE(charge_battery_props); |
| @@ -575,7 +579,8 @@ static void sysfs_remove_battery(struct acpi_battery *battery) | |||
| 575 | 579 | ||
| 576 | static void acpi_battery_quirks(struct acpi_battery *battery) | 580 | static void acpi_battery_quirks(struct acpi_battery *battery) |
| 577 | { | 581 | { |
| 578 | if (dmi_name_in_vendors("Acer") && battery->power_unit) { | 582 | if (dmi_name_in_vendors("Acer") && |
| 583 | battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) { | ||
| 579 | set_bit(ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, &battery->flags); | 584 | set_bit(ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, &battery->flags); |
| 580 | } | 585 | } |
| 581 | } | 586 | } |
