Lines Matching defs:hdev
49 dispatch_hid_bpf_device_event(struct hid_device *hdev, enum hid_report_type type, u8 *data,
54 .hid = hdev,
56 .allocated_size = hdev->bpf.allocated_data,
59 .data = hdev->bpf.device_data,
67 if (!hdev->bpf.device_data)
70 memset(ctx_kern.data, 0, hdev->bpf.allocated_data);
73 ret = hid_bpf_prog_run(hdev, HID_BPF_PROG_TYPE_DEVICE_EVENT, &ctx_kern);
108 u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *size)
113 .hid = hdev,
125 ret = hid_bpf_prog_run(hdev, HID_BPF_PROG_TYPE_RDESC_FIXUP, &ctx_kern);
186 struct hid_device *hdev = to_hid_device(dev);
188 return hdev->id == *(int *)id;
191 static int __hid_bpf_allocate_data(struct hid_device *hdev, u8 **data, u32 *size)
199 struct hid_report_enum *report_enum = hdev->report_enum + i;
227 static int hid_bpf_allocate_event_data(struct hid_device *hdev)
229 /* hdev->bpf.device_data is already allocated, abort */
230 if (hdev->bpf.device_data)
233 return __hid_bpf_allocate_data(hdev, &hdev->bpf.device_data, &hdev->bpf.allocated_data);
236 int hid_bpf_reconnect(struct hid_device *hdev)
238 if (!test_and_set_bit(ffs(HID_STAT_REPROBED), &hdev->status))
239 return device_reprobe(&hdev->dev);
244 static int do_hid_bpf_attach_prog(struct hid_device *hdev, int prog_fd, struct bpf_prog *prog,
257 err = hid_bpf_allocate_event_data(hdev);
262 fd = __hid_bpf_attach_prog(hdev, prog_type, prog_fd, prog, flags);
267 err = hid_bpf_reconnect(hdev);
292 struct hid_device *hdev;
307 hdev = to_hid_device(dev);
319 fd = do_hid_bpf_attach_prog(hdev, prog_fd, prog, flags);
344 struct hid_device *hdev;
355 hdev = to_hid_device(dev);
363 ctx_kern->ctx.hid = hdev;
404 struct hid_device *hdev;
439 hdev = (struct hid_device *)ctx->hid; /* discard const */
441 report_enum = hdev->report_enum + rtype;
455 ret = hid_bpf_ops->hid_hw_raw_request(hdev,
494 int hid_bpf_connect_device(struct hid_device *hdev)
499 prog_list = rcu_dereference(hdev->bpf.progs[HID_BPF_PROG_TYPE_DEVICE_EVENT]);
506 return hid_bpf_allocate_event_data(hdev);
510 void hid_bpf_disconnect_device(struct hid_device *hdev)
512 kfree(hdev->bpf.device_data);
513 hdev->bpf.device_data = NULL;
514 hdev->bpf.allocated_data = 0;
518 void hid_bpf_destroy_device(struct hid_device *hdev)
520 if (!hdev)
524 hdev->bpf.destroyed = true;
526 __hid_bpf_destroy_device(hdev);
530 void hid_bpf_device_init(struct hid_device *hdev)
532 spin_lock_init(&hdev->bpf.progs_lock);