Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 144129
b: refs/heads/master
c: 106c19e
h: refs/heads/master
i:
  144127: 5611be4
v: v3
  • Loading branch information
Bjorn Helgaas authored and Len Brown committed Apr 11, 2009
1 parent 64ef9d6 commit a15e1ac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 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: bf04a77227db76f163bc2355ef4e176794987be2
refs/heads/master: 106c19e7b978e1b84ea5cabbd470a0ddced577c8
31 changes: 13 additions & 18 deletions trunk/drivers/acpi/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ static struct acpi_driver acpi_button_driver = {
};

struct acpi_button {
struct acpi_device *device; /* Fixed button kludge */
unsigned int type;
struct input_dev *input;
char phys[32]; /* for input device */
Expand Down Expand Up @@ -126,10 +125,10 @@ static struct proc_dir_entry *acpi_button_dir;

static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_button *button = seq->private;
struct acpi_device *device = seq->private;

seq_printf(seq, "type: %s\n",
acpi_device_name(button->device));
acpi_device_name(device));
return 0;
}

Expand All @@ -140,11 +139,11 @@ static int acpi_button_info_open_fs(struct inode *inode, struct file *file)

static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_button *button = seq->private;
struct acpi_device *device = seq->private;
acpi_status status;
unsigned long long state;

status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state);
status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state);
seq_printf(seq, "state: %s\n",
ACPI_FAILURE(status) ? "unsupported" :
(state ? "open" : "closed"));
Expand Down Expand Up @@ -198,17 +197,15 @@ static int acpi_button_add_fs(struct acpi_device *device)
/* 'info' [R] */
entry = proc_create_data(ACPI_BUTTON_FILE_INFO,
S_IRUGO, acpi_device_dir(device),
&acpi_button_info_fops,
acpi_driver_data(device));
&acpi_button_info_fops, device);
if (!entry)
return -ENODEV;

/* show lid state [R] */
if (button->type == ACPI_BUTTON_TYPE_LID) {
entry = proc_create_data(ACPI_BUTTON_FILE_STATE,
S_IRUGO, acpi_device_dir(device),
&acpi_button_state_fops,
acpi_driver_data(device));
&acpi_button_state_fops, device);
if (!entry)
return -ENODEV;
}
Expand Down Expand Up @@ -238,13 +235,13 @@ static int acpi_button_remove_fs(struct acpi_device *device)
/* --------------------------------------------------------------------------
Driver Interface
-------------------------------------------------------------------------- */
static int acpi_lid_send_state(struct acpi_button *button)
static int acpi_lid_send_state(struct acpi_device *device)
{
struct acpi_button *button = acpi_driver_data(device);
unsigned long long state;
acpi_status status;

status = acpi_evaluate_integer(button->device->handle, "_LID", NULL,
&state);
status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state);
if (ACPI_FAILURE(status))
return -ENODEV;

Expand All @@ -266,7 +263,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
case ACPI_BUTTON_NOTIFY_STATUS:
input = button->input;
if (button->type == ACPI_BUTTON_TYPE_LID) {
acpi_lid_send_state(button);
acpi_lid_send_state(device);
} else {
int keycode = test_bit(KEY_SLEEP, input->keybit) ?
KEY_SLEEP : KEY_POWER;
Expand All @@ -277,8 +274,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
input_sync(input);
}

acpi_bus_generate_proc_event(button->device, event,
++button->pushed);
acpi_bus_generate_proc_event(device, event, ++button->pushed);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
Expand All @@ -292,7 +288,7 @@ static int acpi_button_resume(struct acpi_device *device)
struct acpi_button *button = acpi_driver_data(device);

if (button->type == ACPI_BUTTON_TYPE_LID)
return acpi_lid_send_state(button);
return acpi_lid_send_state(device);
return 0;
}

Expand All @@ -307,7 +303,6 @@ static int acpi_button_add(struct acpi_device *device)
if (!button)
return -ENOMEM;

button->device = device;
device->driver_data = button;

button->input = input = input_allocate_device();
Expand Down Expand Up @@ -390,7 +385,7 @@ static int acpi_button_add(struct acpi_device *device)
if (error)
goto err_remove_fs;
if (button->type == ACPI_BUTTON_TYPE_LID)
acpi_lid_send_state(button);
acpi_lid_send_state(device);

if (device->wakeup.flags.valid) {
/* Button's GPE is run-wake GPE */
Expand Down

0 comments on commit a15e1ac

Please sign in to comment.