projects
/
platform
/
kernel
/
linux-starfive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
HID: add ALWAYS_POLL quirk for Apple kb
[platform/kernel/linux-starfive.git]
/
drivers
/
hid
/
hid-core.c
diff --git
a/drivers/hid/hid-core.c
b/drivers/hid/hid-core.c
index
8992e3c
..
e018121
100644
(file)
--- a/
drivers/hid/hid-core.c
+++ b/
drivers/hid/hid-core.c
@@
-702,15
+702,22
@@
static void hid_close_report(struct hid_device *device)
* Free a device structure, all reports, and all fields.
*/
* Free a device structure, all reports, and all fields.
*/
-
static void hid_device_release(struct device *dev
)
+
void hiddev_free(struct kref *ref
)
{
{
- struct hid_device *hid =
to_hid_device(dev
);
+ struct hid_device *hid =
container_of(ref, struct hid_device, ref
);
hid_close_report(hid);
kfree(hid->dev_rdesc);
kfree(hid);
}
hid_close_report(hid);
kfree(hid->dev_rdesc);
kfree(hid);
}
+static void hid_device_release(struct device *dev)
+{
+ struct hid_device *hid = to_hid_device(dev);
+
+ kref_put(&hid->ref, hiddev_free);
+}
+
/*
* Fetch a report description item from the data stream. We support long
* items, though they are not used yet.
/*
* Fetch a report description item from the data stream. We support long
* items, though they are not used yet.
@@
-2846,6
+2853,7
@@
struct hid_device *hid_allocate_device(void)
spin_lock_init(&hdev->debug_list_lock);
sema_init(&hdev->driver_input_lock, 1);
mutex_init(&hdev->ll_open_lock);
spin_lock_init(&hdev->debug_list_lock);
sema_init(&hdev->driver_input_lock, 1);
mutex_init(&hdev->ll_open_lock);
+ kref_init(&hdev->ref);
hid_bpf_device_init(hdev);
hid_bpf_device_init(hdev);