Changeset 21619


Ignore:
Timestamp:
2010-05-29T02:12:09+02:00 (7 years ago)
Author:
lars
Message:

[xburst] udc: Fix recursive spinlocks

Driver had recursive spinlock locking: 1. jz4740_queue() acquires lock 2. done()
is called in chain:
jz4740_queue()->jz4740_ep0_kick()->jz4740_ep0_in()->write_fifo_ep0()->done() and
it tries to acquire same lock. 3. Deadlock.

Signed-off-by:
Yauhen Kharuzhy <jekhor@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/xburst/patches-2.6.34/056-udc.patch

    r21438 r21619  
    1 From 9b62834f0e2aba2111ba22e734982f7c71293355 Mon Sep 17 00:00:00 2001 
     1From 644d56ba485f220b1b740b320760a12b5e4e0308 Mon Sep 17 00:00:00 2001 
    22From: Lars-Peter Clausen <lars@metafoo.de> 
    33Date: Sat, 24 Apr 2010 12:18:46 +0200 
     
    88 drivers/usb/gadget/Makefile       |    1 + 
    99 drivers/usb/gadget/gadget_chips.h |    9 + 
    10  drivers/usb/gadget/jz4740_udc.c   | 2439 +++++++++++++++++++++++++++++++++++++ 
    11  drivers/usb/gadget/jz4740_udc.h   |   99 ++ 
    12  5 files changed, 2562 insertions(+), 0 deletions(-) 
     10 drivers/usb/gadget/jz4740_udc.c   | 2437 +++++++++++++++++++++++++++++++++++++ 
     11 drivers/usb/gadget/jz4740_udc.h   |  100 ++ 
     12 5 files changed, 2561 insertions(+), 0 deletions(-) 
    1313 create mode 100644 drivers/usb/gadget/jz4740_udc.c 
    1414 create mode 100644 drivers/usb/gadget/jz4740_udc.h 
     
    8585diff --git a/drivers/usb/gadget/jz4740_udc.c b/drivers/usb/gadget/jz4740_udc.c 
    8686new file mode 100644 
    87 index 0000000..bea1a37 
     87index 0000000..e84c817 
    8888--- /dev/null 
    8989+++ b/drivers/usb/gadget/jz4740_udc.c 
    90 @@ -0,0 +1,2439 @@ 
     90@@ -0,0 +1,2437 @@ 
    9191+/* 
    9292+ * linux/drivers/usb/gadget/jz4740_udc.c 
     
    864864+{ 
    865865+       unsigned int stopped = ep->stopped; 
    866 +       unsigned long flags; 
    867866+       uint32_t index; 
    868867+ 
     
    883882+       ep->stopped = 1; 
    884883+       /* Read current index (completion may modify it) */ 
    885 +       spin_lock_irqsave(&ep->dev->lock, flags); 
    886884+       index = usb_readb(ep->dev, JZ_REG_UDC_INDEX); 
     885+       spin_unlock_irqrestore(&ep->dev->lock, ep->dev->lock_flags); 
    887886+ 
    888887+       req->req.complete(&ep->ep, &req->req); 
    889888+ 
     889+       spin_lock_irqsave(&ep->dev->lock, ep->dev->lock_flags); 
    890890+       /* Restore index */ 
    891891+       jz_udc_set_index(ep->dev, index); 
    892 +       spin_unlock_irqrestore(&ep->dev->lock, flags); 
    893892+       ep->stopped = stopped; 
    894893+} 
     
    13451344+       struct jz4740_ep *ep; 
    13461345+       struct jz4740_udc *dev; 
    1347 +       unsigned long flags; 
    13481346+ 
    13491347+       DEBUG("%s, %p\n", __FUNCTION__, _ep); 
     
    13721370+             _req->buf); 
    13731371+ 
    1374 +       spin_lock_irqsave(&dev->lock, flags); 
     1372+       spin_lock_irqsave(&dev->lock, dev->lock_flags); 
    13751373+ 
    13761374+       _req->status = -EINPROGRESS; 
     
    14181416+               list_add_tail(&req->queue, &ep->queue); 
    14191417+ 
    1420 +       spin_unlock_irqrestore(&dev->lock, flags); 
     1418+       spin_unlock_irqrestore(&dev->lock, dev->lock_flags); 
    14211419+ 
    14221420+       return 0; 
     
    25302528diff --git a/drivers/usb/gadget/jz4740_udc.h b/drivers/usb/gadget/jz4740_udc.h 
    25312529new file mode 100644 
    2532 index 0000000..ac1540f 
     2530index 0000000..7156768 
    25332531--- /dev/null 
    25342532+++ b/drivers/usb/gadget/jz4740_udc.h 
    2535 @@ -0,0 +1,99 @@ 
     2533@@ -0,0 +1,100 @@ 
    25362534+/* 
    25372535+ * linux/drivers/usb/gadget/jz4740_udc.h 
     
    26092607+       struct device *dev; 
    26102608+       spinlock_t lock; 
     2609+       unsigned long lock_flags; 
    26112610+ 
    26122611+       enum ep0state ep0state; 
Note: See TracChangeset for help on using the changeset viewer.