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);
148 struct hid_device *hdev = to_hid_device(dev);
150 return hdev->id == *(int *)id;
153 static int __hid_bpf_allocate_data(struct hid_device *hdev, u8 **data, u32 *size)
161 struct hid_report_enum *report_enum = hdev->report_enum + i;
189 static int hid_bpf_allocate_event_data(struct hid_device *hdev)
191 /* hdev->bpf.device_data is already allocated, abort */
192 if (hdev->bpf.device_data)
195 return __hid_bpf_allocate_data(hdev, &hdev->bpf.device_data, &hdev->bpf.allocated_data);
198 int hid_bpf_reconnect(struct hid_device *hdev)
200 if (!test_and_set_bit(ffs(HID_STAT_REPROBED), &hdev->status))
201 return device_reprobe(&hdev->dev);
206 static int do_hid_bpf_attach_prog(struct hid_device *hdev, int prog_fd, struct bpf_prog *prog,
219 err = hid_bpf_allocate_event_data(hdev);
224 fd = __hid_bpf_attach_prog(hdev, prog_type, prog_fd, prog, flags);
229 err = hid_bpf_reconnect(hdev);
282 struct hid_device *hdev;
297 hdev = to_hid_device(dev);
309 fd = do_hid_bpf_attach_prog(hdev, prog_fd, prog, flags);
334 struct hid_device *hdev;
345 hdev = to_hid_device(dev);
353 ctx_kern->ctx.hid = hdev;
385 struct hid_device *hdev;
404 hdev = (struct hid_device *)ctx->hid; /* discard const */
406 report_enum = hdev->report_enum + rtype;
434 struct hid_device *hdev;
456 hdev = (struct hid_device *)ctx->hid; /* discard const */
462 ret = hid_bpf_ops->hid_hw_raw_request(hdev,
488 struct hid_device *hdev;
498 hdev = (struct hid_device *)ctx->hid; /* discard const */
504 ret = hid_bpf_ops->hid_hw_output_report(hdev,
526 struct hid_device *hdev;
535 hdev = (struct hid_device *)ctx->hid; /* discard const */
537 return hid_bpf_ops->hid_input_report(hdev, type, buf, size, 0);
586 int hid_bpf_connect_device(struct hid_device *hdev)
591 prog_list = rcu_dereference(hdev->bpf.progs[HID_BPF_PROG_TYPE_DEVICE_EVENT]);
598 return hid_bpf_allocate_event_data(hdev);
602 void hid_bpf_disconnect_device(struct hid_device *hdev)
604 kfree(hdev->bpf.device_data);
605 hdev->bpf.device_data = NULL;
606 hdev->bpf.allocated_data = 0;
610 void hid_bpf_destroy_device(struct hid_device *hdev)
612 if (!hdev)
616 hdev->bpf.destroyed = true;
618 __hid_bpf_destroy_device(hdev);
622 void hid_bpf_device_init(struct hid_device *hdev)
624 spin_lock_init(&hdev->bpf.progs_lock);