2020-01-01 08:23:57

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 04/16] usb: gadget: udc: atmel: constify copied structure

The usba_gadget_template structure is only copied into another
structure, so make it const.

The opportunity for this change was found using Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
drivers/usb/gadget/udc/atmel_usba_udc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 8a42768e3213..6e0432141c40 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1122,7 +1122,7 @@ static struct usb_endpoint_descriptor usba_ep0_desc = {
.bInterval = 1,
};

-static struct usb_gadget usba_gadget_template = {
+static const struct usb_gadget usba_gadget_template = {
.ops = &usba_udc_ops,
.max_speed = USB_SPEED_HIGH,
.name = "atmel_usba_udc",


2020-01-06 11:17:04

by Cristian Birsan

[permalink] [raw]
Subject: Re: [PATCH 04/16] usb: gadget: udc: atmel: constify copied structure


On 1/1/20 9:43 AM, Julia Lawall wrote:

> The usba_gadget_template structure is only copied into another
> structure, so make it const.
>
> The opportunity for this change was found using Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>

Acked-by: Cristian Birsan <[email protected]>

>
> ---
> drivers/usb/gadget/udc/atmel_usba_udc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> index 8a42768e3213..6e0432141c40 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> @@ -1122,7 +1122,7 @@ static struct usb_endpoint_descriptor usba_ep0_desc = {
> .bInterval = 1,
> };
>
> -static struct usb_gadget usba_gadget_template = {
> +static const struct usb_gadget usba_gadget_template = {
> .ops = &usba_udc_ops,
> .max_speed = USB_SPEED_HIGH,
> .name = "atmel_usba_udc",
>