From: Linus Torvalds Date: Sun, 7 Mar 2010 00:34:34 +0000 (-0800) Subject: usbfs: fix deadlock on 'usbfs_mutex', clean up poll X-Git-Tag: v2.6.34-rc1~22 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bc80cd935a4d5fd8574f6994bd95d0aad273d56;p=pandora-kernel.git usbfs: fix deadlock on 'usbfs_mutex', clean up poll The caller of usbfs_conn_disc_event() in some cases (but not always) already holds usbfs_mutex, so trying to protect the event counter with that lock causes nasty deadlocks. The problem was introduced by commit 554f76962d ("USB: Remove BKL from poll()") when the BLK protection was turned into using the mutex instead. So fix this by using an atomic variable instead. And while we're at it, get rid of the atrocious naming of said variable and the waitqueue it is associated with. This also cleans up the unnecessary locking in the poll routine, since the whole point of how the pollwait table works is that you can just add yourself to the waiting list, and then check the condition you're waiting for afterwards - avoiding all races. It also gets rid of the unnecessary dynamic allocation of the device status that just contained a single word. We should use f_version for this, as Dmitry Torokhov points out. That simplifies everything further. Reported-and-tested-by: Jeff Chua Acked-by: Greg Kroah-Hartman Acked-by: Alan Stern Cc: Oliver Neukum Cc: Dmitry Torokhov Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed