@@ -161,10 +161,15 @@ static struct proc_dir_entry *acpi_power_dir;
static struct proc_dir_entry *acpi_sleep_dir;
static struct proc_dir_entry *acpi_lid_dir;
+static int acpi_power_buttons;
+static int acpi_sleep_buttons;
+static int acpi_lid_buttons;
+
static int acpi_button_add_fs(struct acpi_device *device)
{
struct acpi_button *button = acpi_driver_data(device);
struct proc_dir_entry *entry = NULL;
+ char name[10];
switch (button->type) {
case ACPI_BUTTON_TYPE_POWER:
@@ -190,7 +195,41 @@ static int acpi_button_add_fs(struct acpi_device *device)
if (!entry)
return -ENODEV;
- acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
+ switch (button->type) {
+ case ACPI_BUTTON_TYPE_POWER:
+ if (!acpi_power_buttons) {
+ acpi_device_dir(device) =
+ proc_mkdir(acpi_device_bid(device), entry);
+ } else {
+ snprintf(name, sizeof(name), "%s_%d",
+ acpi_device_bid(device), acpi_power_buttons);
+ acpi_device_dir(device) = proc_mkdir(name, entry);
+ }
+ acpi_power_buttons++;
+ break;
+ case ACPI_BUTTON_TYPE_SLEEP:
+ if (!acpi_sleep_buttons) {
+ acpi_device_dir(device) =
+ proc_mkdir(acpi_device_bid(device), entry);
+ } else {
+ snprintf(name, sizeof(name), "%s_%d",
+ acpi_device_bid(device), acpi_sleep_buttons);
+ acpi_device_dir(device) = proc_mkdir(name, entry);
+ }
+ acpi_sleep_buttons++;
+ break;
+ case ACPI_BUTTON_TYPE_LID:
+ if (!acpi_lid_buttons) {
+ acpi_device_dir(device) =
+ proc_mkdir(acpi_device_bid(device), entry);
+ } else {
+ snprintf(name, sizeof(name), "%s_%d",
+ acpi_device_bid(device), acpi_lid_buttons);
+ acpi_device_dir(device) = proc_mkdir(name, entry);
+ }
+ acpi_lid_buttons++;
+ break;
+ }
if (!acpi_device_dir(device))
return -ENODEV;