From: Len Brown <lenb@kernel.org>
To: linux-acpi@vger.kernel.org
Cc: Alexey Starikovskiy <astarikovskiy@suse.de>,
Len Brown <len.brown@intel.com>
Subject: [PATCH 30/37] ACPI: SBS: Add support for power_supply class (and sysfs)
Date: Wed, 10 Oct 2007 01:06:37 -0400 [thread overview]
Message-ID: <1191992804-14965-31-git-send-email-lenb@kernel.org> (raw)
Message-ID: <94f6c0860139da9219255b8ff45ad42117dda859.1191992584.git.len.brown@intel.com> (raw)
In-Reply-To: <1191992804-14965-1-git-send-email-lenb@kernel.org>
In-Reply-To: <fd1caaed466de2ee100e250b6c755376eda7ba3b.1191992584.git.len.brown@intel.com>
From: Alexey Starikovskiy <astarikovskiy@suse.de>
Add support for power_supply class and sysfs interface of it.
Refer to Documentation/power_supply_class.txt for interface description.
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
---
drivers/acpi/Kconfig | 9 +-
drivers/acpi/sbs.c | 314 +++++++++++++++++++++++++++++++++++++-------------
2 files changed, 237 insertions(+), 86 deletions(-)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 8560bc3..ba6a61f 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -349,12 +349,11 @@ config ACPI_HOTPLUG_MEMORY
$>modprobe acpi_memhotplug
config ACPI_SBS
- tristate "Smart Battery System (EXPERIMENTAL)"
+ tristate "Smart Battery System"
depends on X86
- depends on EXPERIMENTAL
+ depends on POWER_SUPPLY
help
- This driver adds support for the Smart Battery System.
- A "Smart Battery" is quite old and quite rare compared
- to today's ACPI "Control Method" battery.
+ This driver adds support for the Smart Battery System, another
+ type of access to battery information, found on some laptops.
endif # ACPI
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 3351dea..c4f9641 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -28,17 +28,20 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
+
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h>
+
#include <linux/acpi.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
#include <linux/delay.h>
+#include <linux/power_supply.h>
+
#include "sbshc.h"
-#define ACPI_SBS_COMPONENT 0x00080000
#define ACPI_SBS_CLASS "sbs"
#define ACPI_AC_CLASS "ac_adapter"
#define ACPI_BATTERY_CLASS "battery"
@@ -58,8 +61,6 @@ enum acpi_sbs_device_addr {
#define ACPI_SBS_NOTIFY_STATUS 0x80
#define ACPI_SBS_NOTIFY_INFO 0x81
-ACPI_MODULE_NAME("sbs");
-
MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>");
MODULE_DESCRIPTION("Smart Battery System ACPI interface driver");
MODULE_LICENSE("GPL");
@@ -76,28 +77,14 @@ extern void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
#define MAX_SBS_BAT 4
#define ACPI_SBS_BLOCK_MAX 32
-static int acpi_sbs_add(struct acpi_device *device);
-static int acpi_sbs_remove(struct acpi_device *device, int type);
-static int acpi_sbs_resume(struct acpi_device *device);
-
static const struct acpi_device_id sbs_device_ids[] = {
{"ACPI0002", 0},
{"", 0},
};
MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
-static struct acpi_driver acpi_sbs_driver = {
- .name = "sbs",
- .class = ACPI_SBS_CLASS,
- .ids = sbs_device_ids,
- .ops = {
- .add = acpi_sbs_add,
- .remove = acpi_sbs_remove,
- .resume = acpi_sbs_resume,
- },
-};
-
struct acpi_battery {
+ struct power_supply bat;
struct acpi_sbs *sbs;
struct proc_dir_entry *proc_entry;
unsigned long update_time;
@@ -105,7 +92,7 @@ struct acpi_battery {
char manufacturer_name[ACPI_SBS_BLOCK_MAX];
char device_name[ACPI_SBS_BLOCK_MAX];
char device_chemistry[ACPI_SBS_BLOCK_MAX];
- u32 alarm_capacity;
+ u16 alarm_capacity;
u16 full_charge_capacity;
u16 design_capacity;
u16 design_voltage;
@@ -124,7 +111,10 @@ struct acpi_battery {
u8 present:1;
};
+#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
+
struct acpi_sbs {
+ struct power_supply charger;
struct acpi_device *device;
struct acpi_smb_hc *hc;
struct mutex lock;
@@ -135,6 +125,8 @@ struct acpi_sbs {
u8 charger_present:1;
};
+#define to_acpi_sbs(x) container_of(x, struct acpi_sbs, charger)
+
static inline int battery_scale(int log)
{
int scale = 1;
@@ -164,6 +156,144 @@ static inline int acpi_battery_scale(struct acpi_battery *battery)
acpi_battery_ipscale(battery);
}
+static int sbs_get_ac_property(struct power_supply *psy,
+ enum power_supply_property psp,
+ union power_supply_propval *val)
+{
+ struct acpi_sbs *sbs = to_acpi_sbs(psy);
+ switch (psp) {
+ case POWER_SUPPLY_PROP_ONLINE:
+ val->intval = sbs->charger_present;
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static int acpi_battery_technology(struct acpi_battery *battery)
+{
+ if (!strcasecmp("NiCd", battery->device_chemistry))
+ return POWER_SUPPLY_TECHNOLOGY_NiCd;
+ if (!strcasecmp("NiMH", battery->device_chemistry))
+ return POWER_SUPPLY_TECHNOLOGY_NiMH;
+ if (!strcasecmp("LION", battery->device_chemistry))
+ return POWER_SUPPLY_TECHNOLOGY_LION;
+ if (!strcasecmp("LiP", battery->device_chemistry))
+ return POWER_SUPPLY_TECHNOLOGY_LIPO;
+ return POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
+}
+
+static int acpi_sbs_battery_get_property(struct power_supply *psy,
+ enum power_supply_property psp,
+ union power_supply_propval *val)
+{
+ struct acpi_battery *battery = to_acpi_battery(psy);
+
+ if ((!battery->present) && psp != POWER_SUPPLY_PROP_PRESENT)
+ return -ENODEV;
+ switch (psp) {
+ case POWER_SUPPLY_PROP_STATUS:
+ if (battery->current_now < 0)
+ val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
+ else if (battery->current_now > 0)
+ val->intval = POWER_SUPPLY_STATUS_CHARGING;
+ else
+ val->intval = POWER_SUPPLY_STATUS_FULL;
+ break;
+ case POWER_SUPPLY_PROP_PRESENT:
+ val->intval = battery->present;
+ break;
+ case POWER_SUPPLY_PROP_TECHNOLOGY:
+ val->intval = acpi_battery_technology(battery);
+ break;
+ case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
+ val->intval = battery->design_voltage *
+ acpi_battery_vscale(battery) * 1000;
+ break;
+ case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+ val->intval = battery->voltage_now *
+ acpi_battery_vscale(battery) * 1000;
+ break;
+ case POWER_SUPPLY_PROP_CURRENT_NOW:
+ val->intval = abs(battery->current_now) *
+ acpi_battery_ipscale(battery) * 1000;
+ break;
+ case POWER_SUPPLY_PROP_CURRENT_AVG:
+ val->intval = abs(battery->current_avg) *
+ acpi_battery_ipscale(battery) * 1000;
+ break;
+ case POWER_SUPPLY_PROP_CAPACITY:
+ val->intval = battery->state_of_charge;
+ break;
+ case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
+ case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
+ val->intval = battery->design_capacity *
+ acpi_battery_scale(battery) * 1000;
+ break;
+ case POWER_SUPPLY_PROP_CHARGE_FULL:
+ case POWER_SUPPLY_PROP_ENERGY_FULL:
+ val->intval = battery->full_charge_capacity *
+ acpi_battery_scale(battery) * 1000;
+ break;
+ case POWER_SUPPLY_PROP_CHARGE_NOW:
+ case POWER_SUPPLY_PROP_ENERGY_NOW:
+ val->intval = battery->capacity_now *
+ acpi_battery_scale(battery) * 1000;
+ break;
+ case POWER_SUPPLY_PROP_TEMP:
+ val->intval = battery->temp_now - 2730; // dK -> dC
+ break;
+ case POWER_SUPPLY_PROP_MODEL_NAME:
+ val->strval = battery->device_name;
+ break;
+ case POWER_SUPPLY_PROP_MANUFACTURER:
+ val->strval = battery->manufacturer_name;
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static enum power_supply_property sbs_ac_props[] = {
+ POWER_SUPPLY_PROP_ONLINE,
+};
+
+static enum power_supply_property sbs_charge_battery_props[] = {
+ POWER_SUPPLY_PROP_STATUS,
+ POWER_SUPPLY_PROP_PRESENT,
+ POWER_SUPPLY_PROP_TECHNOLOGY,
+ POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
+ POWER_SUPPLY_PROP_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_CURRENT_NOW,
+ POWER_SUPPLY_PROP_CURRENT_AVG,
+ POWER_SUPPLY_PROP_CAPACITY,
+ POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+ POWER_SUPPLY_PROP_CHARGE_FULL,
+ POWER_SUPPLY_PROP_CHARGE_NOW,
+ POWER_SUPPLY_PROP_TEMP,
+ POWER_SUPPLY_PROP_MODEL_NAME,
+ POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
+static enum power_supply_property sbs_energy_battery_props[] = {
+ POWER_SUPPLY_PROP_STATUS,
+ POWER_SUPPLY_PROP_PRESENT,
+ POWER_SUPPLY_PROP_TECHNOLOGY,
+ POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
+ POWER_SUPPLY_PROP_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_CURRENT_NOW,
+ POWER_SUPPLY_PROP_CURRENT_AVG,
+ POWER_SUPPLY_PROP_CAPACITY,
+ POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
+ POWER_SUPPLY_PROP_ENERGY_FULL,
+ POWER_SUPPLY_PROP_ENERGY_NOW,
+ POWER_SUPPLY_PROP_TEMP,
+ POWER_SUPPLY_PROP_MODEL_NAME,
+ POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
/* --------------------------------------------------------------------------
Smart Battery System Management
-------------------------------------------------------------------------- */
@@ -204,7 +334,7 @@ static int acpi_manager_get_info(struct acpi_sbs *sbs)
u16 battery_system_info;
result = acpi_smbus_read(sbs->hc, SMBUS_READ_WORD, ACPI_SBS_MANAGER,
- 0x04, (u8 *) & battery_system_info);
+ 0x04, (u8 *)&battery_system_info);
if (!result)
sbs->batteries_supported = battery_system_info & 0x000f;
return result;
@@ -215,9 +345,12 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
int i, result = 0;
for (i = 0; i < ARRAY_SIZE(info_readers); ++i) {
- result = acpi_smbus_read(battery->sbs->hc, info_readers[i].mode,
- ACPI_SBS_BATTERY, info_readers[i].command,
- (u8 *) battery + info_readers[i].offset);
+ result = acpi_smbus_read(battery->sbs->hc,
+ info_readers[i].mode,
+ ACPI_SBS_BATTERY,
+ info_readers[i].command,
+ (u8 *) battery +
+ info_readers[i].offset);
if (result)
break;
}
@@ -228,7 +361,8 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
{
int i, result = 0;
- if (time_before(jiffies, battery->update_time +
+ if (battery->update_time &&
+ time_before(jiffies, battery->update_time +
msecs_to_jiffies(cache_time)))
return 0;
for (i = 0; i < ARRAY_SIZE(state_readers); ++i) {
@@ -250,26 +384,36 @@ static int acpi_battery_get_alarm(struct acpi_battery *battery)
{
return acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD,
ACPI_SBS_BATTERY, 0x01,
- (u8 *) & battery->alarm_capacity);
+ (u8 *)&battery->alarm_capacity);
}
static int acpi_battery_set_alarm(struct acpi_battery *battery)
{
struct acpi_sbs *sbs = battery->sbs;
- u16 value;
- return 0;
+ u16 value, sel = 1 << (battery->id + 12);
+
+ int ret;
+
if (sbs->manager_present) {
- acpi_smbus_read(sbs->hc, SMBUS_READ_WORD, ACPI_SBS_MANAGER,
+ ret = acpi_smbus_read(sbs->hc, SMBUS_READ_WORD, ACPI_SBS_MANAGER,
0x01, (u8 *)&value);
- value &= 0x0fff;
- value |= 1 << (battery->id + 12);
- acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, ACPI_SBS_MANAGER,
- 0x01, (u8 *)&value, 2);
+ if (ret)
+ goto end;
+ if ((value & 0xf000) != sel) {
+ value &= 0x0fff;
+ value |= sel;
+ ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD,
+ ACPI_SBS_MANAGER,
+ 0x01, (u8 *)&value, 2);
+ if (ret)
+ goto end;
+ }
}
- value = battery->alarm_capacity / (acpi_battery_mode(battery) ? 10 : 1);
- return acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, ACPI_SBS_BATTERY,
- 0x01, (u8 *)&value, 2);
+ ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, ACPI_SBS_BATTERY,
+ 0x01, (u8 *)&battery->alarm_capacity, 2);
+ end:
+ return ret;
}
static int acpi_ac_get_present(struct acpi_sbs *sbs)
@@ -289,22 +433,19 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs)
-------------------------------------------------------------------------- */
/* Generic Routines */
-
static int
acpi_sbs_add_fs(struct proc_dir_entry **dir,
- struct proc_dir_entry *parent_dir,
- char *dir_name,
- struct file_operations *info_fops,
- struct file_operations *state_fops,
- struct file_operations *alarm_fops, void *data)
+ struct proc_dir_entry *parent_dir,
+ char *dir_name,
+ struct file_operations *info_fops,
+ struct file_operations *state_fops,
+ struct file_operations *alarm_fops, void *data)
{
struct proc_dir_entry *entry = NULL;
if (!*dir) {
*dir = proc_mkdir(dir_name, parent_dir);
if (!*dir) {
- ACPI_EXCEPTION((AE_INFO, AE_ERROR,
- "proc_mkdir() failed"));
return -ENODEV;
}
(*dir)->owner = THIS_MODULE;
@@ -313,10 +454,7 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
/* 'info' [R] */
if (info_fops) {
entry = create_proc_entry(ACPI_SBS_FILE_INFO, S_IRUGO, *dir);
- if (!entry) {
- ACPI_EXCEPTION((AE_INFO, AE_ERROR,
- "create_proc_entry() failed"));
- } else {
+ if (entry) {
entry->proc_fops = info_fops;
entry->data = data;
entry->owner = THIS_MODULE;
@@ -326,10 +464,7 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
/* 'state' [R] */
if (state_fops) {
entry = create_proc_entry(ACPI_SBS_FILE_STATE, S_IRUGO, *dir);
- if (!entry) {
- ACPI_EXCEPTION((AE_INFO, AE_ERROR,
- "create_proc_entry() failed"));
- } else {
+ if (entry) {
entry->proc_fops = state_fops;
entry->data = data;
entry->owner = THIS_MODULE;
@@ -339,16 +474,12 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
/* 'alarm' [R/W] */
if (alarm_fops) {
entry = create_proc_entry(ACPI_SBS_FILE_ALARM, S_IRUGO, *dir);
- if (!entry) {
- ACPI_EXCEPTION((AE_INFO, AE_ERROR,
- "create_proc_entry() failed"));
- } else {
+ if (entry) {
entry->proc_fops = alarm_fops;
entry->data = data;
entry->owner = THIS_MODULE;
}
}
-
return 0;
}
@@ -356,7 +487,6 @@ static void
acpi_sbs_remove_fs(struct proc_dir_entry **dir,
struct proc_dir_entry *parent_dir)
{
-
if (*dir) {
remove_proc_entry(ACPI_SBS_FILE_INFO, *dir);
remove_proc_entry(ACPI_SBS_FILE_STATE, *dir);
@@ -364,11 +494,9 @@ acpi_sbs_remove_fs(struct proc_dir_entry **dir,
remove_proc_entry((*dir)->name, parent_dir);
*dir = NULL;
}
-
}
/* Smart Battery Interface */
-
static struct proc_dir_entry *acpi_battery_dir = NULL;
static inline char *acpi_battery_units(struct acpi_battery *battery)
@@ -506,7 +634,8 @@ acpi_battery_write_alarm(struct file *file, const char __user * buffer,
goto end;
}
alarm_string[count] = 0;
- battery->alarm_capacity = simple_strtoul(alarm_string, NULL, 0);
+ battery->alarm_capacity = simple_strtoul(alarm_string, NULL, 0) /
+ acpi_battery_scale(battery);
acpi_battery_set_alarm(battery);
end:
mutex_unlock(&sbs->lock);
@@ -579,9 +708,6 @@ static struct file_operations acpi_ac_state_fops = {
/* --------------------------------------------------------------------------
Driver Interface
-------------------------------------------------------------------------- */
-
-/* Smart Battery */
-
static int acpi_battery_read(struct acpi_battery *battery)
{
int result = 0, saved_present = battery->present;
@@ -611,13 +737,14 @@ static int acpi_battery_read(struct acpi_battery *battery)
return result;
}
+/* Smart Battery */
static int acpi_battery_add(struct acpi_sbs *sbs, int id)
{
- int result;
struct acpi_battery *battery = &sbs->battery[id];
+ int result;
+
battery->id = id;
battery->sbs = sbs;
- battery->update_time = 0;
result = acpi_battery_read(battery);
if (result)
return result;
@@ -627,6 +754,19 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
battery->name, &acpi_battery_info_fops,
&acpi_battery_state_fops, &acpi_battery_alarm_fops,
battery);
+ battery->bat.name = battery->name;
+ battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
+ if (!acpi_battery_mode(battery)) {
+ battery->bat.properties = sbs_charge_battery_props;
+ battery->bat.num_properties =
+ ARRAY_SIZE(sbs_charge_battery_props);
+ } else {
+ battery->bat.properties = sbs_energy_battery_props;
+ battery->bat.num_properties =
+ ARRAY_SIZE(sbs_energy_battery_props);
+ }
+ battery->bat.get_property = acpi_sbs_battery_get_property;
+ result = power_supply_register(&sbs->device->dev, &battery->bat);
printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
battery->name, sbs->battery->present ? "present" : "absent");
@@ -635,7 +775,8 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
{
-
+ if (sbs->battery[id].bat.dev)
+ power_supply_unregister(&sbs->battery[id].bat);
if (sbs->battery[id].proc_entry) {
acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry),
acpi_battery_dir);
@@ -654,6 +795,12 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
&acpi_ac_state_fops, NULL, sbs);
if (result)
goto end;
+ sbs->charger.name = "sbs-charger";
+ sbs->charger.type = POWER_SUPPLY_TYPE_MAINS;
+ sbs->charger.properties = sbs_ac_props;
+ sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props);
+ sbs->charger.get_property = sbs_get_ac_property;
+ power_supply_register(&sbs->device->dev, &sbs->charger);
printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n",
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line");
@@ -663,7 +810,8 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
static void acpi_charger_remove(struct acpi_sbs *sbs)
{
-
+ if (sbs->charger.dev)
+ power_supply_unregister(&sbs->charger);
if (sbs->charger_entry)
acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
}
@@ -677,9 +825,12 @@ void acpi_sbs_callback(void *context)
u8 saved_battery_state;
acpi_ac_get_present(sbs);
if (sbs->charger_present != saved_charger_state) {
+#ifdef CONFIG_ACPI_PROC_EVENT
acpi_bus_generate_proc_event4(ACPI_AC_CLASS, ACPI_AC_DIR_NAME,
ACPI_SBS_NOTIFY_STATUS,
sbs->charger_present);
+#endif
+ kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE);
}
if (sbs->manager_present) {
for (id = 0; id < MAX_SBS_BAT; ++id) {
@@ -690,10 +841,13 @@ void acpi_sbs_callback(void *context)
acpi_battery_read(bat);
if (saved_battery_state == bat->present)
continue;
+#ifdef CONFIG_ACPI_PROC_EVENT
acpi_bus_generate_proc_event4(ACPI_BATTERY_CLASS,
bat->name,
ACPI_SBS_NOTIFY_STATUS,
bat->present);
+#endif
+ kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE);
}
}
}
@@ -782,45 +936,43 @@ static int acpi_sbs_resume(struct acpi_device *device)
return 0;
}
+static struct acpi_driver acpi_sbs_driver = {
+ .name = "sbs",
+ .class = ACPI_SBS_CLASS,
+ .ids = sbs_device_ids,
+ .ops = {
+ .add = acpi_sbs_add,
+ .remove = acpi_sbs_remove,
+ .resume = acpi_sbs_resume,
+ },
+};
+
static int __init acpi_sbs_init(void)
{
int result = 0;
if (acpi_disabled)
return -ENODEV;
-
acpi_ac_dir = acpi_lock_ac_dir();
- if (!acpi_ac_dir) {
- ACPI_EXCEPTION((AE_INFO, AE_ERROR,
- "acpi_lock_ac_dir() failed"));
+ if (!acpi_ac_dir)
return -ENODEV;
- }
-
acpi_battery_dir = acpi_lock_battery_dir();
if (!acpi_battery_dir) {
- ACPI_EXCEPTION((AE_INFO, AE_ERROR,
- "acpi_lock_battery_dir() failed"));
acpi_sbs_rmdirs();
return -ENODEV;
}
-
result = acpi_bus_register_driver(&acpi_sbs_driver);
if (result < 0) {
- ACPI_EXCEPTION((AE_INFO, AE_ERROR,
- "acpi_bus_register_driver() failed"));
acpi_sbs_rmdirs();
return -ENODEV;
}
-
return 0;
}
static void __exit acpi_sbs_exit(void)
{
acpi_bus_unregister_driver(&acpi_sbs_driver);
-
acpi_sbs_rmdirs();
-
return;
}
--
1.5.3.4.206.g58ba4
next prev parent reply other threads:[~2007-10-10 5:07 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-10 5:06 ACPI patch candidates for 2.6.24 merge window Len Brown
2007-10-10 5:06 ` [PATCH 01/37] sony-laptop: old Vaio models contain 2 IO port entries Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 02/37] fujitsu-laptop: create Fujitsu laptop platform specific driver Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 03/37] ACPI: thermal: use round_jiffies when thermal zone polling is enabled Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 04/37] ACPI: Thermal: Drop concurrent thermal checks Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 05/37] ACPI: video: Don't call absent methods Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 06/37] ACPI: VIDEO: Adjust current level to closest available one Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 07/37] ACPI: EC: Drop ECDT-based boot_ec as soon as we find DSDT-based one Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 08/37] sony-laptop/thinkpad-acpi: fix INPUT=n build Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 09/37] acpi_video: kernel build error if !INPUT Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 10/37] ACPI: thinkpad-acpi: make room for more features in tp_features bitfield Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 11/37] ACPI: thinkpad-acpi: issue EV_SYNC after EV_SWITCH Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 12/37] ACPI: thinkpad-acpi: add mutex-based locking to input device event send path Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 13/37] ACPI: thinkpad-acpi: keep track of module state Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 14/37] ACPI: thinkpad-acpi: check version of hot key firmware Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 15/37] ACPI: thinkpad-acpi: dequeue all pending hot key events at once (v2.2) Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 16/37] ACPI: thinkpad-acpi: fix regression on HKEY LID event handling Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 17/37] ACPI: thinkpad-acpi: use a separate platform device for hwmon and name it (v2) Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 18/37] ACPI: thinkpad-acpi: duplicate driver attributes to new hwmon pdrv Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 19/37] ACPI: Hibernate erroneously disabled Suspend wakeup devices Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-11 10:12 ` Rafael J. Wysocki
2007-10-10 5:06 ` [PATCH 20/37] ACPI: Battery: don't use acpi_extract_package() Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 21/37] ACPI: Battery: simplify update scheme Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 22/37] ACPI: Battery: Misc clean-ups, no functional changes Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 23/37] ACPI: Battery: Add sysfs support Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 24/37] ACPI: Battery: add sysfs alarm Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 25/37] ACPI: Add acpi_bus_generate_event4() function Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 26/37] ACPI: EC: Add new query handler to list head Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 27/37] ACPI: SBS: Split host controller (ACPI0001) from SBS driver (ACPI0002) Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 28/37] ACPI: SBS: Simplify data structures in SBS Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 29/37] ACPI: SBS: Make SBS reads table-driven Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` Len Brown [this message]
2007-10-10 5:06 ` [PATCH 30/37] ACPI: SBS: Add support for power_supply class (and sysfs) Len Brown
2007-10-10 5:06 ` [PATCH 31/37] ACPI: SBS: Add ACPI_PROCFS around procfs handling code Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 32/37] ACPI: SBS: Add sysfs alarm Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 33/37] ACPI: AC: Add sysfs interface Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 34/37] ACPI: thinkpad-acpi: skip blanks before the data when parsing sysfs Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 35/37] ACPI: suppress uninitialized var warning Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 36/37] Hibernation: Make sure that ACPI is enabled in acpi_hibernation_finish Len Brown
2007-10-10 5:06 ` Len Brown
2007-10-10 5:06 ` [PATCH 37/37] ACPI: clean up acpi_enter_sleep_state_prep Len Brown
2007-10-10 5:06 ` Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1191992804-14965-31-git-send-email-lenb@kernel.org \
--to=lenb@kernel.org \
--cc=astarikovskiy@suse.de \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.