aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFranck Bui-Huu <vagabon.xyz@gmail.com>2006-02-23 03:35:06 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-02-28 15:42:06 -0500
commitd5ec33490c67affef93aebf76e1238260c82d377 (patch)
tree3e12575848db0034de60bc44c3e1127aac2c59e3 /drivers
parent754501b324fc3c42522a46d3ace205e7a6a50e77 (diff)
[PATCH] USB: lh7a40x gadget driver: Fixed a dead lock
There is a dead lock in lh7a40x udc driver. When the driver receive a SET_FEATURE HALT request, the dev lock is taken by the interrupt handler lh7a40x_udc_irq then the handler will call lh7a40x_set_halt function which in its turn will try to acquire the dev lock. Signed-off-by: Franck Bui-Huu <franck.bui-huu@innova-card.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index e02fea5a5433..1a362c5e7f3d 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -1062,11 +1062,11 @@ static int lh7a40x_ep_enable(struct usb_ep *_ep,
1062 ep->pio_irqs = 0; 1062 ep->pio_irqs = 0;
1063 ep->ep.maxpacket = le16_to_cpu(desc->wMaxPacketSize); 1063 ep->ep.maxpacket = le16_to_cpu(desc->wMaxPacketSize);
1064 1064
1065 spin_unlock_irqrestore(&ep->dev->lock, flags);
1066
1065 /* Reset halt state (does flush) */ 1067 /* Reset halt state (does flush) */
1066 lh7a40x_set_halt(_ep, 0); 1068 lh7a40x_set_halt(_ep, 0);
1067 1069
1068 spin_unlock_irqrestore(&ep->dev->lock, flags);
1069
1070 DEBUG("%s: enabled %s\n", __FUNCTION__, _ep->name); 1070 DEBUG("%s: enabled %s\n", __FUNCTION__, _ep->name);
1071 return 0; 1071 return 0;
1072} 1072}
@@ -1775,6 +1775,7 @@ static void lh7a40x_ep0_setup(struct lh7a40x_udc *dev, u32 csr)
1775 break; 1775 break;
1776 1776
1777 qep = &dev->ep[ep_num]; 1777 qep = &dev->ep[ep_num];
1778 spin_unlock(&dev->lock);
1778 if (ctrl.bRequest == USB_REQ_SET_FEATURE) { 1779 if (ctrl.bRequest == USB_REQ_SET_FEATURE) {
1779 DEBUG_SETUP("SET_FEATURE (%d)\n", 1780 DEBUG_SETUP("SET_FEATURE (%d)\n",
1780 ep_num); 1781 ep_num);
@@ -1784,6 +1785,7 @@ static void lh7a40x_ep0_setup(struct lh7a40x_udc *dev, u32 csr)
1784 ep_num); 1785 ep_num);
1785 lh7a40x_set_halt(&qep->ep, 0); 1786 lh7a40x_set_halt(&qep->ep, 0);
1786 } 1787 }
1788 spin_lock(&dev->lock);
1787 usb_set_index(0); 1789 usb_set_index(0);
1788 1790
1789 /* Reply with a ZLP on next IN token */ 1791 /* Reply with a ZLP on next IN token */