2017-08-12 08:35:41

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] drm: udl: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/gpu/drm/udl/udl_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
index cd8b017..2877afc 100644
--- a/drivers/gpu/drm/udl/udl_drv.c
+++ b/drivers/gpu/drm/udl/udl_drv.c
@@ -118,7 +118,7 @@ static void udl_usb_disconnect(struct usb_interface *interface)
* which is compatible with all known USB 2.0 era graphics chips and firmware,
* but allows DisplayLink to increment those for any future incompatible chips
*/
-static struct usb_device_id id_table[] = {
+static const struct usb_device_id id_table[] = {
{.idVendor = 0x17e9, .bInterfaceClass = 0xff,
.bInterfaceSubClass = 0x00,
.bInterfaceProtocol = 0x00,
--
2.7.4


2017-08-12 08:38:12

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] w1: ds2490: constify usb_device_id and fix space before '[' error

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Fix checkpatch.pl error:
ERROR: space prohibited before open square bracket '['.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/w1/masters/ds2490.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
index 46ccb2f..a02da9a 100644
--- a/drivers/w1/masters/ds2490.c
+++ b/drivers/w1/masters/ds2490.c
@@ -1088,7 +1088,7 @@ static void ds_disconnect(struct usb_interface *intf)
kfree(dev);
}

-static struct usb_device_id ds_id_table [] = {
+static const struct usb_device_id ds_id_table[] = {
{ USB_DEVICE(0x04fa, 0x2490) },
{ },
};
--
2.7.4

2017-08-12 08:39:57

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] watchdog: pcwd_usb: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/watchdog/pcwd_usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index 5615f40..b9e376c 100644
--- a/drivers/watchdog/pcwd_usb.c
+++ b/drivers/watchdog/pcwd_usb.c
@@ -74,7 +74,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
#define USB_PCWD_PRODUCT_ID 0x1140

/* table of devices that work with this driver */
-static struct usb_device_id usb_pcwd_table[] = {
+static const struct usb_device_id usb_pcwd_table[] = {
{ USB_DEVICE(USB_PCWD_VENDOR_ID, USB_PCWD_PRODUCT_ID) },
{ } /* Terminating entry */
};
--
2.7.4

2017-08-14 14:12:43

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH] drm: udl: constify usb_device_id

On Sat, Aug 12, 2017 at 02:05:19PM +0530, Arvind Yadav wrote:
> usb_device_id are not supposed to change at runtime. All functions
> working with usb_device_id provided by <linux/usb.h> work with
> const usb_device_id. So mark the non-const structs as const.
>
> Signed-off-by: Arvind Yadav <[email protected]>

Applied, thanks.
-Daniel

> ---
> drivers/gpu/drm/udl/udl_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
> index cd8b017..2877afc 100644
> --- a/drivers/gpu/drm/udl/udl_drv.c
> +++ b/drivers/gpu/drm/udl/udl_drv.c
> @@ -118,7 +118,7 @@ static void udl_usb_disconnect(struct usb_interface *interface)
> * which is compatible with all known USB 2.0 era graphics chips and firmware,
> * but allows DisplayLink to increment those for any future incompatible chips
> */
> -static struct usb_device_id id_table[] = {
> +static const struct usb_device_id id_table[] = {
> {.idVendor = 0x17e9, .bInterfaceClass = 0xff,
> .bInterfaceSubClass = 0x00,
> .bInterfaceProtocol = 0x00,
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2017-08-14 14:49:17

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] watchdog: pcwd_usb: constify usb_device_id

On Sat, Aug 12, 2017 at 02:09:45PM +0530, Arvind Yadav wrote:
> usb_device_id are not supposed to change at runtime. All functions
> working with usb_device_id provided by <linux/usb.h> work with
> const usb_device_id. So mark the non-const structs as const.
>
> Signed-off-by: Arvind Yadav <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

> ---
> drivers/watchdog/pcwd_usb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
> index 5615f40..b9e376c 100644
> --- a/drivers/watchdog/pcwd_usb.c
> +++ b/drivers/watchdog/pcwd_usb.c
> @@ -74,7 +74,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
> #define USB_PCWD_PRODUCT_ID 0x1140
>
> /* table of devices that work with this driver */
> -static struct usb_device_id usb_pcwd_table[] = {
> +static const struct usb_device_id usb_pcwd_table[] = {
> { USB_DEVICE(USB_PCWD_VENDOR_ID, USB_PCWD_PRODUCT_ID) },
> { } /* Terminating entry */
> };
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2017-09-05 13:25:30

by Evgeniy Polyakov

[permalink] [raw]
Subject: Re: [PATCH] w1: ds2490: constify usb_device_id and fix space before '[' error

Hi Arvind

12.08.2017, 11:38, "Arvind Yadav" <[email protected]>:
> usb_device_id are not supposed to change at runtime. All functions
> working with usb_device_id provided by <linux/usb.h> work with
> const usb_device_id. So mark the non-const structs as const.
>
> Fix checkpatch.pl error:
> ERROR: space prohibited before open square bracket '['.
>
> Signed-off-by: Arvind Yadav <[email protected]>

Looks good to me, thank you
kernel-janitors@ please queue this up

Acked-by: Evgeniy Polyakov <[email protected]>

> ---
>  drivers/w1/masters/ds2490.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
> index 46ccb2f..a02da9a 100644
> --- a/drivers/w1/masters/ds2490.c
> +++ b/drivers/w1/masters/ds2490.c
> @@ -1088,7 +1088,7 @@ static void ds_disconnect(struct usb_interface *intf)
>          kfree(dev);
>  }
>
> -static struct usb_device_id ds_id_table [] = {
> +static const struct usb_device_id ds_id_table[] = {
>          { USB_DEVICE(0x04fa, 0x2490) },
>          { },
>  };
> --
> 2.7.4