[PATCH 6/9] HID: surface-hid: Constify lowlevel HID driver

Thomas Weißschuh posted 9 patches 2 years, 7 months ago
[PATCH 6/9] HID: surface-hid: Constify lowlevel HID driver
Posted by Thomas Weißschuh 2 years, 7 months ago
Since commit 52d225346904 ("HID: Make lowlevel driver structs const")
the lowlevel HID drivers are only exposed as const.

Take advantage of this to constify the underlying structure, too.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/hid/surface-hid/surface_hid_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/surface-hid/surface_hid_core.c b/drivers/hid/surface-hid/surface_hid_core.c
index 87637f813de2..a3e9cceddfac 100644
--- a/drivers/hid/surface-hid/surface_hid_core.c
+++ b/drivers/hid/surface-hid/surface_hid_core.c
@@ -174,7 +174,7 @@ static int surface_hid_raw_request(struct hid_device *hid, unsigned char reportn
 	return -EIO;
 }
 
-static struct hid_ll_driver surface_hid_ll_driver = {
+static const struct hid_ll_driver surface_hid_ll_driver = {
 	.start       = surface_hid_start,
 	.stop        = surface_hid_stop,
 	.open        = surface_hid_open,

-- 
2.39.1

Re: [PATCH 6/9] HID: surface-hid: Constify lowlevel HID driver
Posted by Maximilian Luz 2 years, 7 months ago
On 1/30/23 04:59, Thomas Weißschuh wrote:
> Since commit 52d225346904 ("HID: Make lowlevel driver structs const")
> the lowlevel HID drivers are only exposed as const.
> 
> Take advantage of this to constify the underlying structure, too.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Looks good to me.

Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>

> ---
>   drivers/hid/surface-hid/surface_hid_core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/surface-hid/surface_hid_core.c b/drivers/hid/surface-hid/surface_hid_core.c
> index 87637f813de2..a3e9cceddfac 100644
> --- a/drivers/hid/surface-hid/surface_hid_core.c
> +++ b/drivers/hid/surface-hid/surface_hid_core.c
> @@ -174,7 +174,7 @@ static int surface_hid_raw_request(struct hid_device *hid, unsigned char reportn
>   	return -EIO;
>   }
>   
> -static struct hid_ll_driver surface_hid_ll_driver = {
> +static const struct hid_ll_driver surface_hid_ll_driver = {
>   	.start       = surface_hid_start,
>   	.stop        = surface_hid_stop,
>   	.open        = surface_hid_open,
>