]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
Pull bugzilla-7897 into release branch
authorLen Brown <len.brown@intel.com>
Sat, 17 Feb 2007 03:12:04 +0000 (22:12 -0500)
committerLen Brown <len.brown@intel.com>
Sat, 17 Feb 2007 03:12:04 +0000 (22:12 -0500)
1  2 
drivers/acpi/sbs.c

diff --combined drivers/acpi/sbs.c
index 1eab2034c9a5b6d5bb3c37cae98156883a0ce24f,87b48f838164305f8734b1670fd4d86345983683..59640d9a0acceefe1ee8a4e6d9495edb4f5c5431
@@@ -59,6 -59,7 +59,6 @@@ extern void acpi_unlock_battery_dir(str
  #define ACPI_AC_CLASS                 "ac_adapter"
  #define ACPI_BATTERY_CLASS            "battery"
  #define ACPI_SBS_HID                  "ACPI0002"
 -#define ACPI_SBS_DRIVER_NAME          "ACPI Smart Battery System Driver"
  #define ACPI_SBS_DEVICE_NAME          "Smart Battery System"
  #define ACPI_SBS_FILE_INFO            "info"
  #define ACPI_SBS_FILE_STATE           "state"
@@@ -77,7 -78,7 +77,7 @@@
  #define       MAX_SBS_BAT                     4
  #define       MAX_SMBUS_ERR                   1
  
 -ACPI_MODULE_NAME("acpi_sbs");
 +ACPI_MODULE_NAME("sbs");
  
  MODULE_AUTHOR("Rich Townsend");
  MODULE_DESCRIPTION("Smart Battery System ACPI interface driver");
@@@ -109,7 -110,7 +109,7 @@@ static void acpi_battery_smbus_err_hand
  static void acpi_sbs_update_queue(void *data);
  
  static struct acpi_driver acpi_sbs_driver = {
 -      .name = ACPI_SBS_DRIVER_NAME,
 +      .name = "sbs",
        .class = ACPI_SBS_CLASS,
        .ids = ACPI_SBS_HID,
        .ops = {
@@@ -1033,21 -1034,19 +1033,19 @@@ static int acpi_battery_read_state(stru
        } else {
                seq_printf(seq, "capacity state:          ok\n");
        }
+       foo = (s16) battery->state.amperage * battery->info.ipscale;
+       if (battery->info.capacity_mode) {
+               foo = foo * battery->info.design_voltage / 1000;
+       }
        if (battery->state.amperage < 0) {
                seq_printf(seq, "charging state:          discharging\n");
-               foo = battery->state.remaining_capacity * cscale * 60 /
-                   (battery->state.average_time_to_empty == 0 ? 1 :
-                    battery->state.average_time_to_empty);
-               seq_printf(seq, "present rate:            %i%s\n",
-                          foo, battery->info.capacity_mode ? "0 mW" : " mA");
+               seq_printf(seq, "present rate:            %d %s\n",
+                          -foo, battery->info.capacity_mode ? "mW" : "mA");
        } else if (battery->state.amperage > 0) {
                seq_printf(seq, "charging state:          charging\n");
-               foo = (battery->info.full_charge_capacity -
-                      battery->state.remaining_capacity) * cscale * 60 /
-                   (battery->state.average_time_to_full == 0 ? 1 :
-                    battery->state.average_time_to_full);
-               seq_printf(seq, "present rate:            %i%s\n",
-                          foo, battery->info.capacity_mode ? "0 mW" : " mA");
+               seq_printf(seq, "present rate:            %d %s\n",
+                          foo, battery->info.capacity_mode ? "mW" : "mA");
        } else {
                seq_printf(seq, "charging state:          charged\n");
                seq_printf(seq, "present rate:            0 %s\n",