usb: renesas_usbhs: gadget: disable all eps when the driver stops
commit9b989b4d325b08f365212cc3bdd0c09dee0a72a0
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Wed, 19 Jul 2017 07:16:55 +0000 (19 16:16 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jul 2017 22:06:06 +0000 (27 15:06 -0700)
treee690ec149d5962ec9b120dd5607053fd92f9835a
parentabe87c1c0dfff2389f4f26c4622ad0afd09c25f7
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