Re: ACPI: Always return valid 'status' from acpi_battery_get_property()

Alexey Starikovskiy
2007-11-19T12:45:38Z

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

Henrique de Moraes Holschuh wrote:
> On Thu, 08 Nov 2007, Alexey Starikovskiy wrote:
>
>>> handle explicitly. There doesn't seem to be any status enum value
>>> defined that makes more sense than 'unknown' for a battery at a
>>> critical charge level.
>>>
>
> Maybe one should be added?
>
>
There is already "Critical" field for capacity.
It seems that the state should be limited to only 3 options:
charging, discharging, and not charging.

Regards,
Alex.

[-- Attachment #2: always_return_valid_status.patch --]
[-- Type: text/x-patch, Size: 860 bytes --]

ACPI: Battery: Always return valid 'status' from get_property

From: Alexey Starikovskiy <astarikovskiy@suse.de>

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---

drivers/acpi/battery.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 192c244..064d80b 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -151,8 +151,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
else if (battery->state & 0x02)
val->intval = POWER_SUPPLY_STATUS_CHARGING;
- else if (battery->state == 0)
- val->intval = POWER_SUPPLY_STATUS_FULL;
+ else
+ val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
break;
case POWER_SUPPLY_PROP_PRESENT:
val->intval = acpi_battery_present(battery);