Commit 977ac789 authored by Bhumika Goyal's avatar Bhumika Goyal Committed by Felipe Balbi

usb: gadget: udc: constify usb_ep_ops structures

Declare usb_ep_ops structures as const as they are only stored in the
ops field of an usb_ep structure. This field is of type const, so
usb_ep_ops structures having this property can be made const too.
Done using Coccinelle( A smaller version of the script)

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct usb_ep_ops i@p={...};

@ok@
identifier r.i;
position p;
struct mv_ep a;
struct mv_u3d_ep b;
struct omap_ep c;

@@
(
a.ep.ops=&i@p;
|
b.ep.ops=&i@p;
|
c.ep.ops=&i@p;

)

@bad@
position p!={r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
+const
struct usb_ep_ops i;

File size details before and after applying  the patch.
First line of every .o file shows the file size before patching and
second line shows the file size after patching.

  text	   data	    bss	    dec	    hex	filename

   7782	    384	      8	   8174	   1fee	usb/gadget/udc/fotg210-udc.o
   7878	    296	      8	   8182	   1ff6	usb/gadget/udc/fotg210-udc.o

  17866	    992	     40	  18898	   49d2	usb/gadget/udc/fsl_udc_core.o
  17954	    896	     40	  18890	   49ca	usb/gadget/udc/fsl_udc_core.o

   9646	    288	      8	   9942	   26d6	usb/gadget/udc/fusb300_udc.o
   9742	    192	      8	   9942	   26d6	usb/gadget/udc/fusb300_udc.o

  12752	    416	      8	  13176	   3378	drivers/usb/gadget/udc/goku_udc.o
  12832	    328	      8	  13168	   3370	drivers/usb/gadget/udc/goku_udc.o

  16541	   1696	      8	  18245	   4745	drivers/usb/gadget/udc/gr_udc.o
  16637	   1600	      8	  18245	   4745	drivers/usb/gadget/udc/gr_udc.o

  15798	    288	     16	  16102	   3ee6	drivers/usb/gadget/udc/m66592-udc.o
  15894	    192	     16	  16102	   3ee6	drivers/usb/gadget/udc/m66592-udc.o

  17751	   3808	     16	  21575	   5447	usb/gadget/udc/mv_u3d_core.o
  17839	   3712	     16	  21567	   543f	usb/gadget/udc/mv_u3d_core.o

  17348	   1112	     24	  18484	   4834	usb/gadget/udc/mv_udc_core.o
  17436	   1016	     24	  18476	   482c	usb/gadget/udc/mv_udc_core.o

  25990	   2620	     13	  28623	   6fcf	drivers/usb/gadget/udc/net2272.o
  26086	   2524	     13	  28623	   6fcf	drivers/usb/gadget/udc/net2272.o

  18409	   7312	      8	  25729	   6481	drivers/usb/gadget/udc/pxa27x_udc.o
  18505	   7208	      8	  25721	   6479	drivers/usb/gadget/udc/pxa27x_udc.o

  18644	    288	     16	  18948	   4a04	usb/gadget/udc/r8a66597-udc.o
  18740	    192	     16	  18948	   4a04	usb/gadget/udc/r8a66597-udc.o

Files: drivers/usb/gadget/udc/{s3c-hsudc.o/omap_udc.o/fsl_qe_udc.o} did
not complie.
Signed-off-by: default avatarBhumika Goyal <bhumirks@gmail.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 741d2558
...@@ -527,7 +527,7 @@ static void fotg210_ep_fifo_flush(struct usb_ep *_ep) ...@@ -527,7 +527,7 @@ static void fotg210_ep_fifo_flush(struct usb_ep *_ep)
{ {
} }
static struct usb_ep_ops fotg210_ep_ops = { static const struct usb_ep_ops fotg210_ep_ops = {
.enable = fotg210_ep_enable, .enable = fotg210_ep_enable,
.disable = fotg210_ep_disable, .disable = fotg210_ep_disable,
......
...@@ -1847,7 +1847,7 @@ static int qe_ep_set_halt(struct usb_ep *_ep, int value) ...@@ -1847,7 +1847,7 @@ static int qe_ep_set_halt(struct usb_ep *_ep, int value)
return status; return status;
} }
static struct usb_ep_ops qe_ep_ops = { static const struct usb_ep_ops qe_ep_ops = {
.enable = qe_ep_enable, .enable = qe_ep_enable,
.disable = qe_ep_disable, .disable = qe_ep_disable,
......
...@@ -1118,7 +1118,7 @@ static void fsl_ep_fifo_flush(struct usb_ep *_ep) ...@@ -1118,7 +1118,7 @@ static void fsl_ep_fifo_flush(struct usb_ep *_ep)
} while (fsl_readl(&dr_regs->endptstatus) & bits); } while (fsl_readl(&dr_regs->endptstatus) & bits);
} }
static struct usb_ep_ops fsl_ep_ops = { static const struct usb_ep_ops fsl_ep_ops = {
.enable = fsl_ep_enable, .enable = fsl_ep_enable,
.disable = fsl_ep_disable, .disable = fsl_ep_disable,
......
...@@ -518,7 +518,7 @@ static void fusb300_fifo_flush(struct usb_ep *_ep) ...@@ -518,7 +518,7 @@ static void fusb300_fifo_flush(struct usb_ep *_ep)
{ {
} }
static struct usb_ep_ops fusb300_ep_ops = { static const struct usb_ep_ops fusb300_ep_ops = {
.enable = fusb300_enable, .enable = fusb300_enable,
.disable = fusb300_disable, .disable = fusb300_disable,
......
...@@ -968,7 +968,7 @@ static void goku_fifo_flush(struct usb_ep *_ep) ...@@ -968,7 +968,7 @@ static void goku_fifo_flush(struct usb_ep *_ep)
command(regs, COMMAND_FIFO_CLEAR, ep->num); command(regs, COMMAND_FIFO_CLEAR, ep->num);
} }
static struct usb_ep_ops goku_ep_ops = { static const struct usb_ep_ops goku_ep_ops = {
.enable = goku_ep_enable, .enable = goku_ep_enable,
.disable = goku_ep_disable, .disable = goku_ep_disable,
......
...@@ -1841,7 +1841,7 @@ static void gr_fifo_flush(struct usb_ep *_ep) ...@@ -1841,7 +1841,7 @@ static void gr_fifo_flush(struct usb_ep *_ep)
spin_unlock(&ep->dev->lock); spin_unlock(&ep->dev->lock);
} }
static struct usb_ep_ops gr_ep_ops = { static const struct usb_ep_ops gr_ep_ops = {
.enable = gr_ep_enable, .enable = gr_ep_enable,
.disable = gr_ep_disable, .disable = gr_ep_disable,
......
...@@ -1436,7 +1436,7 @@ static void m66592_fifo_flush(struct usb_ep *_ep) ...@@ -1436,7 +1436,7 @@ static void m66592_fifo_flush(struct usb_ep *_ep)
spin_unlock_irqrestore(&ep->m66592->lock, flags); spin_unlock_irqrestore(&ep->m66592->lock, flags);
} }
static struct usb_ep_ops m66592_ep_ops = { static const struct usb_ep_ops m66592_ep_ops = {
.enable = m66592_enable, .enable = m66592_enable,
.disable = m66592_disable, .disable = m66592_disable,
......
...@@ -995,7 +995,7 @@ static int mv_u3d_ep_set_wedge(struct usb_ep *_ep) ...@@ -995,7 +995,7 @@ static int mv_u3d_ep_set_wedge(struct usb_ep *_ep)
return mv_u3d_ep_set_halt_wedge(_ep, 1, 1); return mv_u3d_ep_set_halt_wedge(_ep, 1, 1);
} }
static struct usb_ep_ops mv_u3d_ep_ops = { static const struct usb_ep_ops mv_u3d_ep_ops = {
.enable = mv_u3d_ep_enable, .enable = mv_u3d_ep_enable,
.disable = mv_u3d_ep_disable, .disable = mv_u3d_ep_disable,
......
...@@ -946,7 +946,7 @@ static int mv_ep_set_wedge(struct usb_ep *_ep) ...@@ -946,7 +946,7 @@ static int mv_ep_set_wedge(struct usb_ep *_ep)
return mv_ep_set_halt_wedge(_ep, 1, 1); return mv_ep_set_halt_wedge(_ep, 1, 1);
} }
static struct usb_ep_ops mv_ep_ops = { static const struct usb_ep_ops mv_ep_ops = {
.enable = mv_ep_enable, .enable = mv_ep_enable,
.disable = mv_ep_disable, .disable = mv_ep_disable,
......
...@@ -181,7 +181,7 @@ static void net2272_dequeue_all(struct net2272_ep *); ...@@ -181,7 +181,7 @@ static void net2272_dequeue_all(struct net2272_ep *);
static int net2272_kick_dma(struct net2272_ep *, struct net2272_request *); static int net2272_kick_dma(struct net2272_ep *, struct net2272_request *);
static int net2272_fifo_status(struct usb_ep *); static int net2272_fifo_status(struct usb_ep *);
static struct usb_ep_ops net2272_ep_ops; static const struct usb_ep_ops net2272_ep_ops;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -1067,7 +1067,7 @@ net2272_fifo_flush(struct usb_ep *_ep) ...@@ -1067,7 +1067,7 @@ net2272_fifo_flush(struct usb_ep *_ep)
net2272_ep_write(ep, EP_STAT1, 1 << BUFFER_FLUSH); net2272_ep_write(ep, EP_STAT1, 1 << BUFFER_FLUSH);
} }
static struct usb_ep_ops net2272_ep_ops = { static const struct usb_ep_ops net2272_ep_ops = {
.enable = net2272_enable, .enable = net2272_enable,
.disable = net2272_disable, .disable = net2272_disable,
......
...@@ -1112,7 +1112,7 @@ static int omap_ep_set_halt(struct usb_ep *_ep, int value) ...@@ -1112,7 +1112,7 @@ static int omap_ep_set_halt(struct usb_ep *_ep, int value)
return status; return status;
} }
static struct usb_ep_ops omap_ep_ops = { static const struct usb_ep_ops omap_ep_ops = {
.enable = omap_ep_enable, .enable = omap_ep_enable,
.disable = omap_ep_disable, .disable = omap_ep_disable,
......
...@@ -1473,7 +1473,7 @@ static int pxa_ep_disable(struct usb_ep *_ep) ...@@ -1473,7 +1473,7 @@ static int pxa_ep_disable(struct usb_ep *_ep)
return 0; return 0;
} }
static struct usb_ep_ops pxa_ep_ops = { static const struct usb_ep_ops pxa_ep_ops = {
.enable = pxa_ep_enable, .enable = pxa_ep_enable,
.disable = pxa_ep_disable, .disable = pxa_ep_disable,
......
...@@ -1706,7 +1706,7 @@ static void r8a66597_fifo_flush(struct usb_ep *_ep) ...@@ -1706,7 +1706,7 @@ static void r8a66597_fifo_flush(struct usb_ep *_ep)
spin_unlock_irqrestore(&ep->r8a66597->lock, flags); spin_unlock_irqrestore(&ep->r8a66597->lock, flags);
} }
static struct usb_ep_ops r8a66597_ep_ops = { static const struct usb_ep_ops r8a66597_ep_ops = {
.enable = r8a66597_enable, .enable = r8a66597_enable,
.disable = r8a66597_disable, .disable = r8a66597_disable,
......
...@@ -954,7 +954,7 @@ static int s3c_hsudc_dequeue(struct usb_ep *_ep, struct usb_request *_req) ...@@ -954,7 +954,7 @@ static int s3c_hsudc_dequeue(struct usb_ep *_ep, struct usb_request *_req)
return 0; return 0;
} }
static struct usb_ep_ops s3c_hsudc_ep_ops = { static const struct usb_ep_ops s3c_hsudc_ep_ops = {
.enable = s3c_hsudc_ep_enable, .enable = s3c_hsudc_ep_enable,
.disable = s3c_hsudc_ep_disable, .disable = s3c_hsudc_ep_disable,
.alloc_request = s3c_hsudc_alloc_request, .alloc_request = s3c_hsudc_alloc_request,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment