Staging: emxx_udc: constify usb_ep_ops structure
PATCH 1/1 Staging: emxx_udc: constify usb_ep_ops structure
Declare the structure usb_ep_ops as constant as it is only stored in the ops field of a usb_ep structure which is a field of a nbu2ss_ep structure. The ops field is of type const struct usb_ep_ops *, so usb_ep_ops structures having this property can be decalared as const. Done using coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct usb_ep_ops i@p = {...};
@ok1@
identifier r1.i;
position p;
struct nbu2ss_ep s;
@@
s.ep.ops=&i@p
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct usb_ep_ops i={...};
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct usb_ep_ops i;
File size before:
text data bss dec hex filename
16007 376 3720 20103 4e87drivers/staging/emxx_udc/emxx_udc.o
File size after:
text data bss dec hex filename
16095 280 3720 20095 4e7fdrivers/staging/emxx_udc/emxx_udc.o
--- drivers/staging/emxx_udc/emxx_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/emxx_udc/emxx_udc.c +1 -1
@@ -2933,7 +2933,7 @@ static void nbu2ss_ep_fifo_flush(struct usb_ep *_ep) }/*-------------------------------------------------------------------------*/ -static struct usb_ep_ops nbu2ss_ep_ops = { +static const struct usb_ep_ops nbu2ss_ep_ops = { .enable = nbu2ss_ep_enable, .disable = nbu2ss_ep_disable,
Signature · 1 line
1.9.1
Quoted 43 lines · Bhumika Goyal
Declare the structure
usb_ep_opsas constant as it is only stored in the ops field of ausb_epstructure which is a field of anbu2ss_epstructure. The ops field is of type const structusb_ep_ops*, sousb_ep_opsstructures having this property can be decalared as const. Done using coccinelle:@r1 disable
optional_qualifier@
identifier i;
position p;
@@
static structusb_ep_opsi@p = {...};@ok1@
identifier r1.i;
position p;
structnbu2ss_eps;
@@
s.ep.ops=&i@p@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
structusb_ep_opsi={...};@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
structusb_ep_opsi;File size before:
text data bss dec hex filename
16007 376 3720 20103 4e87drivers/staging/emxx_udc/emxx_udc.o
Quoted 6 lines
File size after:
text data bss dec hex filename
16095 280 3720 20095 4e7fdrivers/staging/emxx_udc/emxx_udc.oSigned-off-by Bhumika Goyal <[email protected]>
Quoted 27 lines
--- drivers/staging/emxx_udc/emxx_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/emxx_udc/emxx_udc.c +1
-2@@ -2933,7 +2933,7 @@ static void nbu2ss_ep_fifo_flush(struct usb_ep *_ep) }/*-------------------------------------------------------------------------*/ -static struct usb_ep_ops nbu2ss_ep_ops = { +static const struct usb_ep_ops nbu2ss_ep_ops = { .enable = nbu2ss_ep_enable, .disable = nbu2ss_ep_disable, --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1475999788-12028-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.