Skip to content

Commit 03f8dc1

Browse files
t-8chBenjamin Tissoires
authored andcommitted
HID: uclogic: constify fixed up report descriptor
Now that the HID core can handle const report descriptors, constify them where possible. Signed-off-by: Thomas Weißschuh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent 24b3c51 commit 03f8dc1

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

drivers/hid/hid-uclogic-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ static const __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
5656
struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
5757

5858
if (drvdata->desc_ptr != NULL) {
59-
rdesc = drvdata->desc_ptr;
6059
*rsize = drvdata->desc_size;
60+
return drvdata->desc_ptr;
6161
}
6262
return rdesc;
6363
}

drivers/hid/hid-uclogic-params.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ void uclogic_params_cleanup(struct uclogic_params *params)
681681
* -ENOMEM, if failed to allocate memory.
682682
*/
683683
int uclogic_params_get_desc(const struct uclogic_params *params,
684-
__u8 **pdesc,
684+
const __u8 **pdesc,
685685
unsigned int *psize)
686686
{
687687
int rc = -ENOMEM;
@@ -769,7 +769,7 @@ static void uclogic_params_init_invalid(struct uclogic_params *params)
769769
static int uclogic_params_init_with_opt_desc(struct uclogic_params *params,
770770
struct hid_device *hdev,
771771
unsigned int orig_desc_size,
772-
__u8 *desc_ptr,
772+
const __u8 *desc_ptr,
773773
unsigned int desc_size)
774774
{
775775
__u8 *desc_copy_ptr = NULL;

drivers/hid/hid-uclogic-params.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct uclogic_params_pen {
7979
* Pointer to report descriptor part describing the pen inputs.
8080
* Allocated with kmalloc. NULL if the part is not specified.
8181
*/
82-
__u8 *desc_ptr;
82+
const __u8 *desc_ptr;
8383
/*
8484
* Size of the report descriptor.
8585
* Only valid, if "desc_ptr" is not NULL.
@@ -118,7 +118,7 @@ struct uclogic_params_frame {
118118
* Pointer to report descriptor part describing the frame inputs.
119119
* Allocated with kmalloc. NULL if the part is not specified.
120120
*/
121-
__u8 *desc_ptr;
121+
const __u8 *desc_ptr;
122122
/*
123123
* Size of the report descriptor.
124124
* Only valid, if "desc_ptr" is not NULL.
@@ -212,7 +212,7 @@ struct uclogic_params {
212212
* allocated with kmalloc. NULL if no common part is needed.
213213
* Only valid, if "invalid" is false.
214214
*/
215-
__u8 *desc_ptr;
215+
const __u8 *desc_ptr;
216216
/*
217217
* Size of the common part of the replacement report descriptor.
218218
* Only valid, if "desc_ptr" is valid and not NULL.
@@ -239,7 +239,7 @@ struct uclogic_drvdata {
239239
/* Interface parameters */
240240
struct uclogic_params params;
241241
/* Pointer to the replacement report descriptor. NULL if none. */
242-
__u8 *desc_ptr;
242+
const __u8 *desc_ptr;
243243
/*
244244
* Size of the replacement report descriptor.
245245
* Only valid if desc_ptr is not NULL
@@ -261,7 +261,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
261261

262262
/* Get a replacement report descriptor for a tablet's interface. */
263263
extern int uclogic_params_get_desc(const struct uclogic_params *params,
264-
__u8 **pdesc,
264+
const __u8 **pdesc,
265265
unsigned int *psize);
266266

267267
/* Free resources used by tablet interface's parameters */

drivers/hid/hid-uclogic-rdesc.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <kunit/visibility.h>
2121

2222
/* Fixed WP4030U report descriptor */
23-
__u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
23+
const __u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
2424
0x05, 0x0D, /* Usage Page (Digitizer), */
2525
0x09, 0x01, /* Usage (Digitizer), */
2626
0xA1, 0x01, /* Collection (Application), */
@@ -65,7 +65,7 @@ const size_t uclogic_rdesc_wp4030u_fixed_size =
6565
sizeof(uclogic_rdesc_wp4030u_fixed_arr);
6666

6767
/* Fixed WP5540U report descriptor */
68-
__u8 uclogic_rdesc_wp5540u_fixed_arr[] = {
68+
const __u8 uclogic_rdesc_wp5540u_fixed_arr[] = {
6969
0x05, 0x0D, /* Usage Page (Digitizer), */
7070
0x09, 0x01, /* Usage (Digitizer), */
7171
0xA1, 0x01, /* Collection (Application), */
@@ -142,7 +142,7 @@ const size_t uclogic_rdesc_wp5540u_fixed_size =
142142
sizeof(uclogic_rdesc_wp5540u_fixed_arr);
143143

144144
/* Fixed WP8060U report descriptor */
145-
__u8 uclogic_rdesc_wp8060u_fixed_arr[] = {
145+
const __u8 uclogic_rdesc_wp8060u_fixed_arr[] = {
146146
0x05, 0x0D, /* Usage Page (Digitizer), */
147147
0x09, 0x01, /* Usage (Digitizer), */
148148
0xA1, 0x01, /* Collection (Application), */
@@ -219,7 +219,7 @@ const size_t uclogic_rdesc_wp8060u_fixed_size =
219219
sizeof(uclogic_rdesc_wp8060u_fixed_arr);
220220

221221
/* Fixed WP1062 report descriptor */
222-
__u8 uclogic_rdesc_wp1062_fixed_arr[] = {
222+
const __u8 uclogic_rdesc_wp1062_fixed_arr[] = {
223223
0x05, 0x0D, /* Usage Page (Digitizer), */
224224
0x09, 0x01, /* Usage (Digitizer), */
225225
0xA1, 0x01, /* Collection (Application), */
@@ -267,7 +267,7 @@ const size_t uclogic_rdesc_wp1062_fixed_size =
267267
sizeof(uclogic_rdesc_wp1062_fixed_arr);
268268

269269
/* Fixed PF1209 report descriptor */
270-
__u8 uclogic_rdesc_pf1209_fixed_arr[] = {
270+
const __u8 uclogic_rdesc_pf1209_fixed_arr[] = {
271271
0x05, 0x0D, /* Usage Page (Digitizer), */
272272
0x09, 0x01, /* Usage (Digitizer), */
273273
0xA1, 0x01, /* Collection (Application), */
@@ -344,7 +344,7 @@ const size_t uclogic_rdesc_pf1209_fixed_size =
344344
sizeof(uclogic_rdesc_pf1209_fixed_arr);
345345

346346
/* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
347-
__u8 uclogic_rdesc_twhl850_fixed0_arr[] = {
347+
const __u8 uclogic_rdesc_twhl850_fixed0_arr[] = {
348348
0x05, 0x0D, /* Usage Page (Digitizer), */
349349
0x09, 0x01, /* Usage (Digitizer), */
350350
0xA1, 0x01, /* Collection (Application), */
@@ -390,7 +390,7 @@ const size_t uclogic_rdesc_twhl850_fixed0_size =
390390
sizeof(uclogic_rdesc_twhl850_fixed0_arr);
391391

392392
/* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
393-
__u8 uclogic_rdesc_twhl850_fixed1_arr[] = {
393+
const __u8 uclogic_rdesc_twhl850_fixed1_arr[] = {
394394
0x05, 0x01, /* Usage Page (Desktop), */
395395
0x09, 0x02, /* Usage (Mouse), */
396396
0xA1, 0x01, /* Collection (Application), */
@@ -430,7 +430,7 @@ const size_t uclogic_rdesc_twhl850_fixed1_size =
430430
sizeof(uclogic_rdesc_twhl850_fixed1_arr);
431431

432432
/* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
433-
__u8 uclogic_rdesc_twhl850_fixed2_arr[] = {
433+
const __u8 uclogic_rdesc_twhl850_fixed2_arr[] = {
434434
0x05, 0x01, /* Usage Page (Desktop), */
435435
0x09, 0x06, /* Usage (Keyboard), */
436436
0xA1, 0x01, /* Collection (Application), */
@@ -456,7 +456,7 @@ const size_t uclogic_rdesc_twhl850_fixed2_size =
456456
sizeof(uclogic_rdesc_twhl850_fixed2_arr);
457457

458458
/* Fixed TWHA60 report descriptor, interface 0 (stylus) */
459-
__u8 uclogic_rdesc_twha60_fixed0_arr[] = {
459+
const __u8 uclogic_rdesc_twha60_fixed0_arr[] = {
460460
0x05, 0x0D, /* Usage Page (Digitizer), */
461461
0x09, 0x01, /* Usage (Digitizer), */
462462
0xA1, 0x01, /* Collection (Application), */
@@ -505,7 +505,7 @@ const size_t uclogic_rdesc_twha60_fixed0_size =
505505
sizeof(uclogic_rdesc_twha60_fixed0_arr);
506506

507507
/* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
508-
__u8 uclogic_rdesc_twha60_fixed1_arr[] = {
508+
const __u8 uclogic_rdesc_twha60_fixed1_arr[] = {
509509
0x05, 0x01, /* Usage Page (Desktop), */
510510
0x09, 0x06, /* Usage (Keyboard), */
511511
0xA1, 0x01, /* Collection (Application), */

drivers/hid/hid-uclogic-rdesc.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
#define UCLOGIC_RDESC_WPXXXXU_ORIG_SIZE 212
2424

2525
/* Fixed WP4030U report descriptor */
26-
extern __u8 uclogic_rdesc_wp4030u_fixed_arr[];
26+
extern const __u8 uclogic_rdesc_wp4030u_fixed_arr[];
2727
extern const size_t uclogic_rdesc_wp4030u_fixed_size;
2828

2929
/* Fixed WP5540U report descriptor */
30-
extern __u8 uclogic_rdesc_wp5540u_fixed_arr[];
30+
extern const __u8 uclogic_rdesc_wp5540u_fixed_arr[];
3131
extern const size_t uclogic_rdesc_wp5540u_fixed_size;
3232

3333
/* Fixed WP8060U report descriptor */
34-
extern __u8 uclogic_rdesc_wp8060u_fixed_arr[];
34+
extern const __u8 uclogic_rdesc_wp8060u_fixed_arr[];
3535
extern const size_t uclogic_rdesc_wp8060u_fixed_size;
3636

3737
/* Size of the original descriptor of the new WP5540U tablet */
@@ -41,14 +41,14 @@ extern const size_t uclogic_rdesc_wp8060u_fixed_size;
4141
#define UCLOGIC_RDESC_WP1062_ORIG_SIZE 254
4242

4343
/* Fixed WP1062 report descriptor */
44-
extern __u8 uclogic_rdesc_wp1062_fixed_arr[];
44+
extern const __u8 uclogic_rdesc_wp1062_fixed_arr[];
4545
extern const size_t uclogic_rdesc_wp1062_fixed_size;
4646

4747
/* Size of the original descriptor of PF1209 tablet */
4848
#define UCLOGIC_RDESC_PF1209_ORIG_SIZE 234
4949

5050
/* Fixed PF1209 report descriptor */
51-
extern __u8 uclogic_rdesc_pf1209_fixed_arr[];
51+
extern const __u8 uclogic_rdesc_pf1209_fixed_arr[];
5252
extern const size_t uclogic_rdesc_pf1209_fixed_size;
5353

5454
/* Size of the original descriptors of TWHL850 tablet */
@@ -57,27 +57,27 @@ extern const size_t uclogic_rdesc_pf1209_fixed_size;
5757
#define UCLOGIC_RDESC_TWHL850_ORIG2_SIZE 92
5858

5959
/* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
60-
extern __u8 uclogic_rdesc_twhl850_fixed0_arr[];
60+
extern const __u8 uclogic_rdesc_twhl850_fixed0_arr[];
6161
extern const size_t uclogic_rdesc_twhl850_fixed0_size;
6262

6363
/* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
64-
extern __u8 uclogic_rdesc_twhl850_fixed1_arr[];
64+
extern const __u8 uclogic_rdesc_twhl850_fixed1_arr[];
6565
extern const size_t uclogic_rdesc_twhl850_fixed1_size;
6666

6767
/* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
68-
extern __u8 uclogic_rdesc_twhl850_fixed2_arr[];
68+
extern const __u8 uclogic_rdesc_twhl850_fixed2_arr[];
6969
extern const size_t uclogic_rdesc_twhl850_fixed2_size;
7070

7171
/* Size of the original descriptors of TWHA60 tablet */
7272
#define UCLOGIC_RDESC_TWHA60_ORIG0_SIZE 254
7373
#define UCLOGIC_RDESC_TWHA60_ORIG1_SIZE 139
7474

7575
/* Fixed TWHA60 report descriptor, interface 0 (stylus) */
76-
extern __u8 uclogic_rdesc_twha60_fixed0_arr[];
76+
extern const __u8 uclogic_rdesc_twha60_fixed0_arr[];
7777
extern const size_t uclogic_rdesc_twha60_fixed0_size;
7878

7979
/* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
80-
extern __u8 uclogic_rdesc_twha60_fixed1_arr[];
80+
extern const __u8 uclogic_rdesc_twha60_fixed1_arr[];
8181
extern const size_t uclogic_rdesc_twha60_fixed1_size;
8282

8383
/* Report descriptor template placeholder head */

0 commit comments

Comments
 (0)