Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 154197
b: refs/heads/master
c: d940669
h: refs/heads/master
i:
  154195: 8788a11
v: v3
  • Loading branch information
Bjorn Helgaas authored and Len Brown committed Jun 18, 2009
1 parent c89ff60 commit ade47c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 48fe112744d1ff2e899a6491633ac58a3229aabf
refs/heads/master: d94066910943837558d2a461c6766da981260bf0
22 changes: 5 additions & 17 deletions trunk/drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,13 +796,12 @@ static void acpi_battery_remove_fs(struct acpi_device *device)
Driver Interface
-------------------------------------------------------------------------- */

static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
static void acpi_battery_notify(struct acpi_device *device, u32 event)
{
struct acpi_battery *battery = data;
struct acpi_device *device;
struct acpi_battery *battery = acpi_driver_data(device);

if (!battery)
return;
device = battery->device;
acpi_battery_update(battery);
acpi_bus_generate_proc_event(device, event,
acpi_battery_present(battery));
Expand All @@ -819,7 +818,6 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
static int acpi_battery_add(struct acpi_device *device)
{
int result = 0;
acpi_status status = 0;
struct acpi_battery *battery = NULL;
if (!device)
return -EINVAL;
Expand All @@ -837,14 +835,6 @@ static int acpi_battery_add(struct acpi_device *device)
if (result)
goto end;
#endif
status = acpi_install_notify_handler(device->handle,
ACPI_ALL_NOTIFY,
acpi_battery_notify, battery);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Installing notify handler"));
result = -ENODEV;
goto end;
}
printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
device->status.battery_present ? "present" : "absent");
Expand All @@ -860,15 +850,11 @@ static int acpi_battery_add(struct acpi_device *device)

static int acpi_battery_remove(struct acpi_device *device, int type)
{
acpi_status status = 0;
struct acpi_battery *battery = NULL;

if (!device || !acpi_driver_data(device))
return -EINVAL;
battery = acpi_driver_data(device);
status = acpi_remove_notify_handler(device->handle,
ACPI_ALL_NOTIFY,
acpi_battery_notify);
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_remove_fs(device);
#endif
Expand Down Expand Up @@ -896,10 +882,12 @@ static struct acpi_driver acpi_battery_driver = {
.name = "battery",
.class = ACPI_BATTERY_CLASS,
.ids = battery_device_ids,
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
.ops = {
.add = acpi_battery_add,
.resume = acpi_battery_resume,
.remove = acpi_battery_remove,
.notify = acpi_battery_notify,
},
};

Expand Down

0 comments on commit ade47c7

Please sign in to comment.