]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
HID: waltop: constify fixed up report descriptor
authorThomas Weißschuh <linux@weissschuh.net>
Wed, 28 Aug 2024 07:33:31 +0000 (09:33 +0200)
committerBenjamin Tissoires <bentiss@kernel.org>
Thu, 5 Sep 2024 14:20:57 +0000 (16:20 +0200)
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-12-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
drivers/hid/hid-waltop.c

index 137a682ef5fbe5a7e3610c016a4011e607f1d5bb..be34be27d4d512a7935cfa27a22053e9edfc51d4 100644 (file)
@@ -43,7 +43,7 @@
 #define SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE   222
 
 /* Fixed Slim Tablet 5.8 inch descriptor */
-static __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
+static const __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x02,         /*  Usage (Pen),                        */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -94,7 +94,7 @@ static __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
 #define SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE  269
 
 /* Fixed Slim Tablet 12.1 inch descriptor */
-static __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
+static const __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x02,         /*  Usage (Pen),                        */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -145,7 +145,7 @@ static __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
 #define Q_PAD_RDESC_ORIG_SIZE  241
 
 /* Fixed Q Pad descriptor */
-static __u8 q_pad_rdesc_fixed[] = {
+static const __u8 q_pad_rdesc_fixed[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x02,         /*  Usage (Pen),                        */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -198,7 +198,7 @@ static __u8 q_pad_rdesc_fixed[] = {
 /*
  * Fixed report descriptor for tablet with PID 0038.
  */
-static __u8 pid_0038_rdesc_fixed[] = {
+static const __u8 pid_0038_rdesc_fixed[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x02,         /*  Usage (Pen),                        */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -249,7 +249,7 @@ static __u8 pid_0038_rdesc_fixed[] = {
 #define MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE 300
 
 /* Fixed Media Tablet 10.6 inch descriptor */
-static __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
+static const __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x02,         /*  Usage (Pen),                        */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -362,7 +362,7 @@ static __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
 #define MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE 309
 
 /* Fixed Media Tablet 14.1 inch descriptor */
-static __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
+static const __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x02,         /*  Usage (Pen),                        */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -473,7 +473,7 @@ static __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
 #define SIRIUS_BATTERY_FREE_TABLET_RDESC_ORIG_SIZE     335
 
 /* Fixed Sirius Battery Free Tablet descriptor */
-static __u8 sirius_battery_free_tablet_rdesc_fixed[] = {
+static const __u8 sirius_battery_free_tablet_rdesc_fixed[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x02,         /*  Usage (Pen),                        */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -605,44 +605,44 @@ static const __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc,
        switch (hdev->product) {
        case USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH:
                if (*rsize == SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE) {
-                       rdesc = slim_tablet_5_8_inch_rdesc_fixed;
                        *rsize = sizeof(slim_tablet_5_8_inch_rdesc_fixed);
+                       return slim_tablet_5_8_inch_rdesc_fixed;
                }
                break;
        case USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH:
                if (*rsize == SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE) {
-                       rdesc = slim_tablet_12_1_inch_rdesc_fixed;
                        *rsize = sizeof(slim_tablet_12_1_inch_rdesc_fixed);
+                       return slim_tablet_12_1_inch_rdesc_fixed;
                }
                break;
        case USB_DEVICE_ID_WALTOP_Q_PAD:
                if (*rsize == Q_PAD_RDESC_ORIG_SIZE) {
-                       rdesc = q_pad_rdesc_fixed;
                        *rsize = sizeof(q_pad_rdesc_fixed);
+                       return q_pad_rdesc_fixed;
                }
                break;
        case USB_DEVICE_ID_WALTOP_PID_0038:
                if (*rsize == PID_0038_RDESC_ORIG_SIZE) {
-                       rdesc = pid_0038_rdesc_fixed;
                        *rsize = sizeof(pid_0038_rdesc_fixed);
+                       return pid_0038_rdesc_fixed;
                }
                break;
        case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH:
                if (*rsize == MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE) {
-                       rdesc = media_tablet_10_6_inch_rdesc_fixed;
                        *rsize = sizeof(media_tablet_10_6_inch_rdesc_fixed);
+                       return media_tablet_10_6_inch_rdesc_fixed;
                }
                break;
        case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH:
                if (*rsize == MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE) {
-                       rdesc = media_tablet_14_1_inch_rdesc_fixed;
                        *rsize = sizeof(media_tablet_14_1_inch_rdesc_fixed);
+                       return media_tablet_14_1_inch_rdesc_fixed;
                }
                break;
        case USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET:
                if (*rsize == SIRIUS_BATTERY_FREE_TABLET_RDESC_ORIG_SIZE) {
-                       rdesc = sirius_battery_free_tablet_rdesc_fixed;
                        *rsize = sizeof(sirius_battery_free_tablet_rdesc_fixed);
+                       return sirius_battery_free_tablet_rdesc_fixed;
                }
                break;
        }