From 81024fc41a9353160bc445fda4f96d1aa5e82791 Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Wed, 4 May 2011 13:41:31 +0200 Subject: [PATCH 1/2] APM: take over maintainership Commit 04a6553f076 ("apm: orphan the driver") Orphaned the APM driver as Stephen is not willing/able to maintain it any more. As I still have some hardware that is using APM and running 2.6, I can take it over. Signed-off-by: Jiri Kosina --- MAINTAINERS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 16a5c5f2c6a6..5b0d3c7b7e72 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -548,10 +548,11 @@ S: Maintained F: sound/aoa/ APM DRIVER -L: linux-laptop@vger.kernel.org -S: Orphan +M: Jiri Kosina +S: Odd fixes F: arch/x86/kernel/apm_32.c F: include/linux/apm_bios.h +F: drivers/char/apm-emulation.c APPLE BCM5974 MULTITOUCH DRIVER M: Henrik Rydberg From fda5fe19725edd6805f2fd742235d1a0d0ba93f5 Mon Sep 17 00:00:00 2001 From: Paul Parsons Date: Fri, 13 May 2011 02:46:03 +0100 Subject: [PATCH 2/2] apm-emulation: apm_mutex breaks ACK; remove it apm_mutex is locked by a process (e.g. apm -s) at the start of apm_ioctl() and remains locked while pm_suspend() is called. Any subsequent process trying to ACK the suspend (e.g. apmd) is then blocked at the start of apm_ioctl(), causing the suspend to be delayed for 5 seconds in apm_suspend_notifier() while the ACK times out. In short, ACKs don't work. The driver's data structures are sufficiently protected by assorted locks. And pm_suspend() has its own mutex to prevent reentrancy. Consequently there is no obvious requirement for apm_mutex, which evolved from earlier BKL calls. So let's remove it. Signed-off-by: Paul Parsons Acked-by: Rafael J. Wysocki Signed-off-by: Jiri Kosina --- drivers/char/apm-emulation.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c index 45b987c9889e..548708c4b2b8 100644 --- a/drivers/char/apm-emulation.c +++ b/drivers/char/apm-emulation.c @@ -126,7 +126,6 @@ struct apm_user { /* * Local variables */ -static DEFINE_MUTEX(apm_mutex); static atomic_t suspend_acks_pending = ATOMIC_INIT(0); static atomic_t userspace_notification_inhibit = ATOMIC_INIT(0); static int apm_disabled; @@ -275,7 +274,6 @@ apm_ioctl(struct file *filp, u_int cmd, u_long arg) if (!as->suser || !as->writer) return -EPERM; - mutex_lock(&apm_mutex); switch (cmd) { case APM_IOC_SUSPEND: mutex_lock(&state_lock); @@ -336,7 +334,6 @@ apm_ioctl(struct file *filp, u_int cmd, u_long arg) mutex_unlock(&state_lock); break; } - mutex_unlock(&apm_mutex); return err; } @@ -371,7 +368,6 @@ static int apm_open(struct inode * inode, struct file * filp) { struct apm_user *as; - mutex_lock(&apm_mutex); as = kzalloc(sizeof(*as), GFP_KERNEL); if (as) { /* @@ -391,7 +387,6 @@ static int apm_open(struct inode * inode, struct file * filp) filp->private_data = as; } - mutex_unlock(&apm_mutex); return as ? 0 : -ENOMEM; }