usb: renesas_usbhs: gadget: disable all eps when the driver stops
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Wed, 19 Jul 2017 07:16:55 +0000 (16:16 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jul 2017 22:08:01 +0000 (15:08 -0700)
commitdbc969ca944f1a3f61af083f4126bb5408d37b4c
tree54438801384211b36f71c1e979ec7579ac911864
parent5433bfcc85273a89c7c5a565a337697ff31ae499
usb: renesas_usbhs: gadget: disable all eps when the driver stops

commit b8b9c974afee685789fcbb191b52d1790be3608c upstream.

A gadget driver will not disable eps immediately when ->disconnect()
is called. But, since this driver assumes all eps stop after
the ->disconnect(), unexpected behavior happens (especially in system
suspend).
So, this patch disables all eps in usbhsg_try_stop(). After disabling
eps by renesas_usbhs driver, since some functions will be called by
both a gadget and renesas_usbhs driver, renesas_usbhs driver should
protect uep->pipe. To protect uep->pipe easily, this patch adds a new
lock in struct usbhsg_uep.

Fixes: 2f98382dc ("usb: renesas_usbhs: Add Renesas USBHS Gadget")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/renesas_usbhs/mod_gadget.c