]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
HID: uclogic: constify fixed up report descriptor
authorThomas Weißschuh <linux@weissschuh.net>
Wed, 28 Aug 2024 07:33:33 +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-14-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
drivers/hid/hid-uclogic-core.c
drivers/hid/hid-uclogic-params.c
drivers/hid/hid-uclogic-params.h
drivers/hid/hid-uclogic-rdesc.c
drivers/hid/hid-uclogic-rdesc.h

index f6a1572b372830c837e42a71d41f83a2ab7be345..d8008933c052f5c9b5df9dadc5bce353f3c5b948 100644 (file)
@@ -56,8 +56,8 @@ static const __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
        struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
 
        if (drvdata->desc_ptr != NULL) {
-               rdesc = drvdata->desc_ptr;
                *rsize = drvdata->desc_size;
+               return drvdata->desc_ptr;
        }
        return rdesc;
 }
index 5bab006ec165bbd24c0eb3c3c02c81a9e3af75ae..87fd4eb76c70b779ef376cb44194ba2c82ec1f8b 100644 (file)
@@ -681,7 +681,7 @@ void uclogic_params_cleanup(struct uclogic_params *params)
  *     -ENOMEM, if failed to allocate memory.
  */
 int uclogic_params_get_desc(const struct uclogic_params *params,
-                               __u8 **pdesc,
+                               const __u8 **pdesc,
                                unsigned int *psize)
 {
        int rc = -ENOMEM;
@@ -769,7 +769,7 @@ static void uclogic_params_init_invalid(struct uclogic_params *params)
 static int uclogic_params_init_with_opt_desc(struct uclogic_params *params,
                                             struct hid_device *hdev,
                                             unsigned int orig_desc_size,
-                                            __u8 *desc_ptr,
+                                            const __u8 *desc_ptr,
                                             unsigned int desc_size)
 {
        __u8 *desc_copy_ptr = NULL;
index d6ffadb2f601568a17b826aa3406b49713dfcb1e..35ff062d09b50abf8244ab3566dcc350e8b427af 100644 (file)
@@ -79,7 +79,7 @@ struct uclogic_params_pen {
         * Pointer to report descriptor part describing the pen inputs.
         * Allocated with kmalloc. NULL if the part is not specified.
         */
-       __u8 *desc_ptr;
+       const __u8 *desc_ptr;
        /*
         * Size of the report descriptor.
         * Only valid, if "desc_ptr" is not NULL.
@@ -118,7 +118,7 @@ struct uclogic_params_frame {
         * Pointer to report descriptor part describing the frame inputs.
         * Allocated with kmalloc. NULL if the part is not specified.
         */
-       __u8 *desc_ptr;
+       const __u8 *desc_ptr;
        /*
         * Size of the report descriptor.
         * Only valid, if "desc_ptr" is not NULL.
@@ -212,7 +212,7 @@ struct uclogic_params {
         * allocated with kmalloc. NULL if no common part is needed.
         * Only valid, if "invalid" is false.
         */
-       __u8 *desc_ptr;
+       const __u8 *desc_ptr;
        /*
         * Size of the common part of the replacement report descriptor.
         * Only valid, if "desc_ptr" is valid and not NULL.
@@ -239,7 +239,7 @@ struct uclogic_drvdata {
        /* Interface parameters */
        struct uclogic_params params;
        /* Pointer to the replacement report descriptor. NULL if none. */
-       __u8 *desc_ptr;
+       const __u8 *desc_ptr;
        /*
         * Size of the replacement report descriptor.
         * Only valid if desc_ptr is not NULL
@@ -261,7 +261,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
 
 /* Get a replacement report descriptor for a tablet's interface. */
 extern int uclogic_params_get_desc(const struct uclogic_params *params,
-                                       __u8 **pdesc,
+                                       const __u8 **pdesc,
                                        unsigned int *psize);
 
 /* Free resources used by tablet interface's parameters */
index acfa591ab52f17ec7ae76bffc785104628133e27..964d17e08f269ba908194b7d5631db67dd1d3da7 100644 (file)
@@ -20,7 +20,7 @@
 #include <kunit/visibility.h>
 
 /* Fixed WP4030U report descriptor */
-__u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x01,         /*  Usage (Digitizer),                  */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -65,7 +65,7 @@ const size_t uclogic_rdesc_wp4030u_fixed_size =
                        sizeof(uclogic_rdesc_wp4030u_fixed_arr);
 
 /* Fixed WP5540U report descriptor */
-__u8 uclogic_rdesc_wp5540u_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp5540u_fixed_arr[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x01,         /*  Usage (Digitizer),                  */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -142,7 +142,7 @@ const size_t uclogic_rdesc_wp5540u_fixed_size =
                        sizeof(uclogic_rdesc_wp5540u_fixed_arr);
 
 /* Fixed WP8060U report descriptor */
-__u8 uclogic_rdesc_wp8060u_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp8060u_fixed_arr[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x01,         /*  Usage (Digitizer),                  */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -219,7 +219,7 @@ const size_t uclogic_rdesc_wp8060u_fixed_size =
                        sizeof(uclogic_rdesc_wp8060u_fixed_arr);
 
 /* Fixed WP1062 report descriptor */
-__u8 uclogic_rdesc_wp1062_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp1062_fixed_arr[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x01,         /*  Usage (Digitizer),                  */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -267,7 +267,7 @@ const size_t uclogic_rdesc_wp1062_fixed_size =
                        sizeof(uclogic_rdesc_wp1062_fixed_arr);
 
 /* Fixed PF1209 report descriptor */
-__u8 uclogic_rdesc_pf1209_fixed_arr[] = {
+const __u8 uclogic_rdesc_pf1209_fixed_arr[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x01,         /*  Usage (Digitizer),                  */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -344,7 +344,7 @@ const size_t uclogic_rdesc_pf1209_fixed_size =
                        sizeof(uclogic_rdesc_pf1209_fixed_arr);
 
 /* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
-__u8 uclogic_rdesc_twhl850_fixed0_arr[] = {
+const __u8 uclogic_rdesc_twhl850_fixed0_arr[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x01,         /*  Usage (Digitizer),                  */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -390,7 +390,7 @@ const size_t uclogic_rdesc_twhl850_fixed0_size =
                        sizeof(uclogic_rdesc_twhl850_fixed0_arr);
 
 /* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
-__u8 uclogic_rdesc_twhl850_fixed1_arr[] = {
+const __u8 uclogic_rdesc_twhl850_fixed1_arr[] = {
        0x05, 0x01,         /*  Usage Page (Desktop),               */
        0x09, 0x02,         /*  Usage (Mouse),                      */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -430,7 +430,7 @@ const size_t uclogic_rdesc_twhl850_fixed1_size =
                        sizeof(uclogic_rdesc_twhl850_fixed1_arr);
 
 /* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
-__u8 uclogic_rdesc_twhl850_fixed2_arr[] = {
+const __u8 uclogic_rdesc_twhl850_fixed2_arr[] = {
        0x05, 0x01,         /*  Usage Page (Desktop),               */
        0x09, 0x06,         /*  Usage (Keyboard),                   */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -456,7 +456,7 @@ const size_t uclogic_rdesc_twhl850_fixed2_size =
                        sizeof(uclogic_rdesc_twhl850_fixed2_arr);
 
 /* Fixed TWHA60 report descriptor, interface 0 (stylus) */
-__u8 uclogic_rdesc_twha60_fixed0_arr[] = {
+const __u8 uclogic_rdesc_twha60_fixed0_arr[] = {
        0x05, 0x0D,         /*  Usage Page (Digitizer),             */
        0x09, 0x01,         /*  Usage (Digitizer),                  */
        0xA1, 0x01,         /*  Collection (Application),           */
@@ -505,7 +505,7 @@ const size_t uclogic_rdesc_twha60_fixed0_size =
                        sizeof(uclogic_rdesc_twha60_fixed0_arr);
 
 /* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
-__u8 uclogic_rdesc_twha60_fixed1_arr[] = {
+const __u8 uclogic_rdesc_twha60_fixed1_arr[] = {
        0x05, 0x01, /*  Usage Page (Desktop),       */
        0x09, 0x06, /*  Usage (Keyboard),           */
        0xA1, 0x01, /*  Collection (Application),   */
index 906d068f50a95e54a9ae592d384f77ff9544ec7e..3878a0e8c464140c0946e37ddbac376f071ef13f 100644 (file)
 #define UCLOGIC_RDESC_WPXXXXU_ORIG_SIZE                212
 
 /* Fixed WP4030U report descriptor */
-extern __u8 uclogic_rdesc_wp4030u_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp4030u_fixed_arr[];
 extern const size_t uclogic_rdesc_wp4030u_fixed_size;
 
 /* Fixed WP5540U report descriptor */
-extern __u8 uclogic_rdesc_wp5540u_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp5540u_fixed_arr[];
 extern const size_t uclogic_rdesc_wp5540u_fixed_size;
 
 /* Fixed WP8060U report descriptor */
-extern __u8 uclogic_rdesc_wp8060u_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp8060u_fixed_arr[];
 extern const size_t uclogic_rdesc_wp8060u_fixed_size;
 
 /* Size of the original descriptor of the new WP5540U tablet */
@@ -41,14 +41,14 @@ extern const size_t uclogic_rdesc_wp8060u_fixed_size;
 #define UCLOGIC_RDESC_WP1062_ORIG_SIZE         254
 
 /* Fixed WP1062 report descriptor */
-extern __u8 uclogic_rdesc_wp1062_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp1062_fixed_arr[];
 extern const size_t uclogic_rdesc_wp1062_fixed_size;
 
 /* Size of the original descriptor of PF1209 tablet */
 #define UCLOGIC_RDESC_PF1209_ORIG_SIZE         234
 
 /* Fixed PF1209 report descriptor */
-extern __u8 uclogic_rdesc_pf1209_fixed_arr[];
+extern const __u8 uclogic_rdesc_pf1209_fixed_arr[];
 extern const size_t uclogic_rdesc_pf1209_fixed_size;
 
 /* Size of the original descriptors of TWHL850 tablet */
@@ -57,15 +57,15 @@ extern const size_t uclogic_rdesc_pf1209_fixed_size;
 #define UCLOGIC_RDESC_TWHL850_ORIG2_SIZE       92
 
 /* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
-extern __u8 uclogic_rdesc_twhl850_fixed0_arr[];
+extern const __u8 uclogic_rdesc_twhl850_fixed0_arr[];
 extern const size_t uclogic_rdesc_twhl850_fixed0_size;
 
 /* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
-extern __u8 uclogic_rdesc_twhl850_fixed1_arr[];
+extern const __u8 uclogic_rdesc_twhl850_fixed1_arr[];
 extern const size_t uclogic_rdesc_twhl850_fixed1_size;
 
 /* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
-extern __u8 uclogic_rdesc_twhl850_fixed2_arr[];
+extern const __u8 uclogic_rdesc_twhl850_fixed2_arr[];
 extern const size_t uclogic_rdesc_twhl850_fixed2_size;
 
 /* Size of the original descriptors of TWHA60 tablet */
@@ -73,11 +73,11 @@ extern const size_t uclogic_rdesc_twhl850_fixed2_size;
 #define UCLOGIC_RDESC_TWHA60_ORIG1_SIZE                139
 
 /* Fixed TWHA60 report descriptor, interface 0 (stylus) */
-extern __u8 uclogic_rdesc_twha60_fixed0_arr[];
+extern const __u8 uclogic_rdesc_twha60_fixed0_arr[];
 extern const size_t uclogic_rdesc_twha60_fixed0_size;
 
 /* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
-extern __u8 uclogic_rdesc_twha60_fixed1_arr[];
+extern const __u8 uclogic_rdesc_twha60_fixed1_arr[];
 extern const size_t uclogic_rdesc_twha60_fixed1_size;
 
 /* Report descriptor template placeholder head */