Skip to contentSkip to conversation

ACPI/Button: Fix enable Button GPEs twice

PATCH Superseded Lan Tianyu 2 participants 2 messages Dec 6, 2013 ACPI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Lan Tianyu

author
#0 lore raw

PATCH 1/1 ACPI/Button: Fix enable Button GPEs twice

Button GPEs have been enabled in the acpi_wake_device_init() during boot and Button driver enables these GPEs second time. This causes disabling these gpes via sysfs interface requires twice "echo disable

Quoted 1 line

/sys/firmware/acpi/interrupts/gpeXXX". This patch is to remove

related code in the Button driver.

---
Update:
fix a typo, sorry for noise.

 drivers/acpi/button.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/acpi/button.c +3 -9
index 9e3a6cb..6643f2d 100644
@@ -406,15 +406,9 @@ static int acpi_button_add(struct acpi_device *device)
 		lid_device = device;
 	}
 
-	if (device->wakeup.flags.valid) {
-		/* Button's GPE is run-wake GPE */
-		acpi_enable_gpe(device->wakeup.gpe_device,
-				device->wakeup.gpe_number);
-		if (!device_may_wakeup(&device->dev)) {
-			device_set_wakeup_enable(&device->dev, true);
-			button->wakeup_enabled = true;
-		}
-	}
+	/* Button GPEs have been enabled in the acpi_wakeup_device_list()*/
+	if (device->wakeup.flags.valid)
+		button->wakeup_enabled = true;
 
 	printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device));
 	return 0;
Signature · 1 line
1.8.2.1
#1 lore raw
Quoted 24 lines · Lan Tianyu

Button GPEs have been enabled in the acpi_wake_device_init() during boot and Button driver enables these GPEs second time. This causes disabling these gpes via sysfs interface requires twice "echo disable

Quoted 1 line

/sys/firmware/acpi/interrupts/gpeXXX". This patch is to remove

related code in the Button driver.

---
Update:
fix a typo, sorry for noise.

 drivers/acpi/button.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/acpi/button.c +0 -2
index 9e3a6cb..6643f2d 100644
@@ -406,15 +406,9 @@ static int acpi_button_add(struct acpi_device *device)
 		lid_device = device;
 	}
 
-	if (device->wakeup.flags.valid) {
-		/* Button's GPE is run-wake GPE */

drivers/acpi/button.c static int acpi_button_add(struct acpi_device *device) · line 411

Quoted 10 lines
drivers/acpi/button.c +3 -7
-		acpi_enable_gpe(device->wakeup.gpe_device,
-				device->wakeup.gpe_number);
-		if (!device_may_wakeup(&device->dev)) {
-			device_set_wakeup_enable(&device->dev, true);
-			button->wakeup_enabled = true;
-		}
-	}
+	/* Button GPEs have been enabled in the acpi_wakeup_device_list()*/
+	if (device->wakeup.flags.valid)
+		button->wakeup_enabled = true;

It doesn't seem we need this wakeup_enabled flag anymore, since we want button/lid's GPE to be always enabled no matter if button driver is in use or not and we have already taken care of this in acpi_wakeup_device_init function, we can drop it from button driver.

Thanks,
Aaron

Quoted 4 lines
drivers/acpi/button.c +0 -0
 	printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device));
 	return 0;