USB: musb: host endpoint_disable() oops fixes
authorSergei Shtylyov <sshtylyov@ru.mvista.com>
Sat, 21 Feb 2009 23:31:01 +0000 (15:31 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 27 Feb 2009 22:40:51 +0000 (14:40 -0800)
commitdc61d238b8c850c34632ae1fbbdea529f8c41d16
treee800cb6312d12f8347ca60fbab2c8b829d733c17
parenta2fd814e6a9e172f7077b68a2a9391bbde777a92
USB: musb: host endpoint_disable() oops fixes

The musb_h_disable() routine can oops in some cases:

 - It's not safe to read hep->hcpriv outside musb->lock,
   since it gets changed on completion IRQ paths.

 - The list iterators aren't safe to use in that way;
   just remove the first element while !list_empty(),
   so deletions on other code paths can't make trouble.

We need two "scrub the list" loops because only one branch
should touch hardware and advance the schedule.

[ dbrownell@users.sourceforge.net: massively simplify
  patch description; add key points as code comments ]

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/musb/musb_host.c