]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Pull battery into release branch
authorLen Brown <len.brown@intel.com>
Tue, 20 Nov 2007 06:17:42 +0000 (01:17 -0500)
committerLen Brown <len.brown@intel.com>
Tue, 20 Nov 2007 06:17:42 +0000 (01:17 -0500)
1  2 
drivers/acpi/battery.c

diff --combined drivers/acpi/battery.c
index 192c244f61902b1e510c41780cd3655d9c7a1756,cbb27b4ddea4d48372e735f140c1c8906fc0bfe8..2e8e790c1180ee500d7a1a3ef7d929ff7ed3df65
@@@ -132,7 -132,7 +132,7 @@@ static int acpi_battery_technology(stru
        return POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
  }
  
 -static int acpi_battery_update(struct acpi_battery *battery);
 +static int acpi_battery_get_state(struct acpi_battery *battery);
  
  static int acpi_battery_get_property(struct power_supply *psy,
                                     enum power_supply_property psp,
  {
        struct acpi_battery *battery = to_acpi_battery(psy);
  
 -      if ((!acpi_battery_present(battery)) &&
 -           psp != POWER_SUPPLY_PROP_PRESENT)
 +      if (acpi_battery_present(battery)) {
 +              /* run battery update only if it is present */
 +              acpi_battery_get_state(battery);
 +      } else if (psp != POWER_SUPPLY_PROP_PRESENT)
                return -ENODEV;
 -      acpi_battery_update(battery);
        switch (psp) {
        case POWER_SUPPLY_PROP_STATUS:
                if (battery->state & 0x01)
                        val->intval = POWER_SUPPLY_STATUS_CHARGING;
                else if (battery->state == 0)
                        val->intval = POWER_SUPPLY_STATUS_FULL;
+               else
+                       val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
                break;
        case POWER_SUPPLY_PROP_PRESENT:
                val->intval = acpi_battery_present(battery);
@@@ -458,7 -459,6 +460,7 @@@ static void sysfs_remove_battery(struc
                return;
        device_remove_file(battery->bat.dev, &alarm_attr);
        power_supply_unregister(&battery->bat);
 +      battery->bat.dev = NULL;
  }
  
  static int acpi_battery_update(struct acpi_battery *battery)