usb: gadget: Clear usb_endpoint_descriptor inside the struct usb_ep on disable
authorIdo Shayevitz <idos@codeaurora.org>
Wed, 8 Feb 2012 11:56:48 +0000 (13:56 +0200)
committerFelipe Balbi <balbi@ti.com>
Fri, 24 Feb 2012 10:22:38 +0000 (12:22 +0200)
This fix a bug in f_serial, which expect the ep->desc to be NULL after
disabling an endpoint.

Cc: stable@vger.kernel.org
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
15 files changed:
drivers/usb/dwc3/gadget.c
drivers/usb/gadget/amd5536udc.c
drivers/usb/gadget/at91_udc.c
drivers/usb/gadget/atmel_usba_udc.c
drivers/usb/gadget/ci13xxx_udc.c
drivers/usb/gadget/fsl_qe_udc.c
drivers/usb/gadget/fsl_udc_core.c
drivers/usb/gadget/goku_udc.c
drivers/usb/gadget/langwell_udc.c
drivers/usb/gadget/mv_udc_core.c
drivers/usb/gadget/omap_udc.c
drivers/usb/gadget/pch_udc.c
drivers/usb/gadget/pxa25x_udc.c
drivers/usb/gadget/s3c-hsudc.c
drivers/usb/gadget/s3c2410_udc.c

index a696bde5322268013819ac43d9059da653d9c045..a1a04d00a9e4e710584addf17dcbabdd703a54da 100644 (file)
@@ -440,6 +440,7 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
 
        dep->stream_capable = false;
        dep->desc = NULL;
+       dep->endpoint.desc = NULL;
        dep->comp_desc = NULL;
        dep->type = 0;
        dep->flags = 0;
index c16ff55a74e84696ec26afe376547c5af42a9dd8..18883bd0f162dfdb4d9025a24caa7de6a81d9e12 100644 (file)
@@ -445,6 +445,7 @@ static void ep_init(struct udc_regs __iomem *regs, struct udc_ep *ep)
 
        VDBG(ep->dev, "ep-%d reset\n", ep->num);
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        ep->ep.ops = &udc_ep_ops;
        INIT_LIST_HEAD(&ep->queue);
 
index d8dee225bf8edd06a1d7bfd5e8a4f13a6f4ab200..15a8cdb2ded507a91e3e86ebc59ab076256ab75c 100644 (file)
@@ -557,6 +557,7 @@ static int at91_ep_disable (struct usb_ep * _ep)
 
        /* restore the endpoint's pristine config */
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        ep->ep.maxpacket = ep->maxpacket;
 
        /* reset fifos and endpoint */
index e2fb6d583bd91a9b849da93224ef002bbb03f683..5e10f651ad6383d60c22d8c7ec4a5102e340cd36 100644 (file)
@@ -659,6 +659,7 @@ static int usba_ep_disable(struct usb_ep *_ep)
                return -EINVAL;
        }
        ep->desc = NULL;
+       ep->ep.desc = NULL;
 
        list_splice_init(&ep->queue, &req_list);
        if (ep->can_dma) {
index 27e313718422a5c2f1726330ab822d1fa9f133c8..9e892890e08af2ba0e9bd8a121e79ca890fa5ae7 100644 (file)
@@ -2181,6 +2181,7 @@ static int ep_disable(struct usb_ep *ep)
        } while (mEp->dir != direction);
 
        mEp->desc = NULL;
+       mEp->ep.desc = NULL;
 
        spin_unlock_irqrestore(mEp->lock, flags);
        return retval;
index b95697c03d07a7a2287fdb3200367051e308c4a6..877a2c46672b71e50dde237a4a0be029525cbf7d 100644 (file)
@@ -1638,6 +1638,7 @@ static int qe_ep_disable(struct usb_ep *_ep)
        /* Nuke all pending requests (does flush) */
        nuke(ep, -ESHUTDOWN);
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        ep->stopped = 1;
        ep->tx_req = NULL;
        qe_ep_reset(udc, ep->epnum);
index d7ea6c076ce98e185ee43b557c524d2b29c67270..b5435735042228e2a0765f6ce459fbb3cfbff064 100644 (file)
@@ -659,6 +659,7 @@ static int fsl_ep_disable(struct usb_ep *_ep)
        nuke(ep, -ESHUTDOWN);
 
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        ep->stopped = 1;
        spin_unlock_irqrestore(&udc->lock, flags);
 
index 5af70fcce139ba675ec9d0b2739183317cb92936..59777490a19ae481294487f16b963b6d4affa834 100644 (file)
@@ -235,6 +235,7 @@ static void ep_reset(struct goku_udc_regs __iomem *regs, struct goku_ep *ep)
 
        ep->ep.maxpacket = MAX_FIFO_SIZE;
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        ep->stopped = 1;
        ep->irqs = 0;
        ep->dma = 0;
index fa0fcc11263fb8b6a73d21bcdbe7ba3f168e19dc..a2bb5e476f54f2a4c04325217deb5545c0aff30e 100644 (file)
@@ -492,6 +492,7 @@ static int langwell_ep_disable(struct usb_ep *_ep)
        nuke(ep, -ESHUTDOWN);
 
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        ep->stopped = 1;
 
        spin_unlock_irqrestore(&dev->lock, flags);
index 8dd398b99e2f91096d90e3072b3d41a158e382a8..ec6009fc050f1ede0dd5ffa13168e7553c11581e 100644 (file)
@@ -608,6 +608,7 @@ static int  mv_ep_disable(struct usb_ep *_ep)
        nuke(ep, -ESHUTDOWN);
 
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        ep->stopped = 1;
 
        spin_unlock_irqrestore(&udc->lock, flags);
index 576cd8578b452eac99a1bd15cdb81031c34da090..7d0835e4bb927bebbd14e200cc65d33018bc5e3a 100644 (file)
@@ -251,6 +251,7 @@ static int omap_ep_disable(struct usb_ep *_ep)
 
        spin_lock_irqsave(&ep->udc->lock, flags);
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        nuke (ep, -ESHUTDOWN);
        ep->ep.maxpacket = ep->maxpacket;
        ep->has_dma = 0;
index a992084d3890f1b00f40dc0e3a9b15ee85287039..350dbcd90681d23483d38345a4b17bcd5e619504 100644 (file)
@@ -1742,6 +1742,7 @@ static int pch_udc_pcd_ep_disable(struct usb_ep *usbep)
        pch_udc_ep_disable(ep);
        pch_udc_disable_ep_interrupts(ep->dev, PCH_UDC_EPINT(ep->in, ep->num));
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        INIT_LIST_HEAD(&ep->queue);
        spin_unlock_irqrestore(&ep->dev->lock, iflags);
        return 0;
index dd470635f4f783a160fb2547716ac169c50f6318..33adf3884275d5e09f670ccc64067d3ba23f10d0 100644 (file)
@@ -283,6 +283,7 @@ static int pxa25x_ep_disable (struct usb_ep *_ep)
        pxa25x_ep_fifo_flush (_ep);
 
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        ep->stopped = 1;
 
        local_irq_restore(flags);
@@ -1192,6 +1193,7 @@ static void udc_reinit(struct pxa25x_udc *dev)
                        list_add_tail (&ep->ep.ep_list, &dev->gadget.ep_list);
 
                ep->desc = NULL;
+               ep->ep.desc = NULL;
                ep->stopped = 0;
                INIT_LIST_HEAD (&ep->queue);
                ep->pio_irqs = 0;
index 5e8729374fba72dd4b71bd47a8808ba32bfa7fbe..ace95f933689e7538810ef499a4cff6afb8160f1 100644 (file)
@@ -817,6 +817,7 @@ static int s3c_hsudc_ep_disable(struct usb_ep *_ep)
        s3c_hsudc_nuke_ep(hsep, -ESHUTDOWN);
 
        hsep->desc = 0;
+       hsep->ep.desc = NULL;
        hsep->stopped = 1;
 
        spin_unlock_irqrestore(&hsudc->lock, flags);
@@ -1006,6 +1007,7 @@ static void s3c_hsudc_initep(struct s3c_hsudc *hsudc,
        hsep->ep.ops = &s3c_hsudc_ep_ops;
        hsep->fifo = hsudc->regs + S3C_BR(epnum);
        hsep->desc = 0;
+       hsep->ep.desc = NULL;
        hsep->stopped = 0;
        hsep->wedge = 0;
 
index 3f87cb9344bbee4486e49324b548d5977aa5f52c..ab9c65e2c1d57c880c976b1757f58567ac3529eb 100644 (file)
@@ -1148,6 +1148,7 @@ static int s3c2410_udc_ep_disable(struct usb_ep *_ep)
        dprintk(DEBUG_NORMAL, "ep_disable: %s\n", _ep->name);
 
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        ep->halted = 1;
 
        s3c2410_udc_nuke (ep->dev, ep, -ESHUTDOWN);
@@ -1630,6 +1631,7 @@ static void s3c2410_udc_reinit(struct s3c2410_udc *dev)
 
                ep->dev = dev;
                ep->desc = NULL;
+               ep->ep.desc = NULL;
                ep->halted = 0;
                INIT_LIST_HEAD (&ep->queue);
        }