@@ -352,7 +352,6 @@ __hid_bpf_hw_check_params(struct hid_bpf_ctx *ctx, __u8 *buf, size_t *buf__sz,
352
352
{
353
353
struct hid_report_enum * report_enum ;
354
354
struct hid_report * report ;
355
- struct hid_device * hdev ;
356
355
u32 report_len ;
357
356
358
357
/* check arguments */
@@ -371,9 +370,7 @@ __hid_bpf_hw_check_params(struct hid_bpf_ctx *ctx, __u8 *buf, size_t *buf__sz,
371
370
if (* buf__sz < 1 )
372
371
return - EINVAL ;
373
372
374
- hdev = (struct hid_device * )ctx -> hid ; /* discard const */
375
-
376
- report_enum = hdev -> report_enum + rtype ;
373
+ report_enum = ctx -> hid -> report_enum + rtype ;
377
374
report = hid_ops -> hid_get_report (report_enum , buf );
378
375
if (!report )
379
376
return - EINVAL ;
@@ -402,7 +399,6 @@ hid_bpf_hw_request(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz,
402
399
enum hid_report_type rtype , enum hid_class_request reqtype )
403
400
{
404
401
struct hid_bpf_ctx_kern * ctx_kern ;
405
- struct hid_device * hdev ;
406
402
size_t size = buf__sz ;
407
403
u8 * dma_data ;
408
404
int ret ;
@@ -429,13 +425,11 @@ hid_bpf_hw_request(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz,
429
425
return - EINVAL ;
430
426
}
431
427
432
- hdev = (struct hid_device * )ctx -> hid ; /* discard const */
433
-
434
428
dma_data = kmemdup (buf , size , GFP_KERNEL );
435
429
if (!dma_data )
436
430
return - ENOMEM ;
437
431
438
- ret = hid_ops -> hid_hw_raw_request (hdev ,
432
+ ret = hid_ops -> hid_hw_raw_request (ctx -> hid ,
439
433
dma_data [0 ],
440
434
dma_data ,
441
435
size ,
@@ -464,7 +458,6 @@ __bpf_kfunc int
464
458
hid_bpf_hw_output_report (struct hid_bpf_ctx * ctx , __u8 * buf , size_t buf__sz )
465
459
{
466
460
struct hid_bpf_ctx_kern * ctx_kern ;
467
- struct hid_device * hdev ;
468
461
size_t size = buf__sz ;
469
462
u8 * dma_data ;
470
463
int ret ;
@@ -478,13 +471,11 @@ hid_bpf_hw_output_report(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz)
478
471
if (ret )
479
472
return ret ;
480
473
481
- hdev = (struct hid_device * )ctx -> hid ; /* discard const */
482
-
483
474
dma_data = kmemdup (buf , size , GFP_KERNEL );
484
475
if (!dma_data )
485
476
return - ENOMEM ;
486
477
487
- ret = hid_ops -> hid_hw_output_report (hdev , dma_data , size , (u64 )(long )ctx , true);
478
+ ret = hid_ops -> hid_hw_output_report (ctx -> hid , dma_data , size , (u64 )(long )ctx , true);
488
479
489
480
kfree (dma_data );
490
481
return ret ;
0 commit comments