• Bhumika Goyal's avatar
    usb: gadget: udc: constify usb_ep_ops structures · 977ac789
    Bhumika Goyal authored
    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>
    977ac789
fusb300_udc.c 36 KB