Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68c9c64f authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Revert "HID: fix HID device resource race between HID core and debugging support"



This reverts commit 6fd14535 which is
commit fc43e9c857b7aa55efba9398419b14d9e35dcc7d upstream.

It breaks the current Android ABI, and if needed, can be brought back in
an abi-safe way in the future.

Bug: 161946584
Change-Id: I38d2bef8b98b0a915b74889c2bc49e12c118195a
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 0780b1ab
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -703,22 +703,15 @@ static void hid_close_report(struct hid_device *device)
 * Free a device structure, all reports, and all fields.
 */

void hiddev_free(struct kref *ref)
static void hid_device_release(struct device *dev)
{
	struct hid_device *hid = container_of(ref, struct hid_device, ref);
	struct hid_device *hid = to_hid_device(dev);

	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.
@@ -2496,7 +2489,6 @@ 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);
	kref_init(&hdev->ref);

	return hdev;
}
+0 −3
Original line number Diff line number Diff line
@@ -1082,7 +1082,6 @@ static int hid_debug_events_open(struct inode *inode, struct file *file)
		goto out;
	}
	list->hdev = (struct hid_device *) inode->i_private;
	kref_get(&list->hdev->ref);
	file->private_data = list;
	mutex_init(&list->read_mutex);

@@ -1175,8 +1174,6 @@ static int hid_debug_events_release(struct inode *inode, struct file *file)
	list_del(&list->node);
	spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags);
	kfifo_free(&list->hid_debug_fifo);

	kref_put(&list->hdev->ref, hiddev_free);
	kfree(list);

	return 0;
+0 −3
Original line number Diff line number Diff line
@@ -623,7 +623,6 @@ struct hid_device { /* device report descriptor */
	struct list_head debug_list;
	spinlock_t  debug_list_lock;
	wait_queue_head_t debug_wait;
	struct kref			ref;

	unsigned int id;						/* system unique id */

@@ -631,8 +630,6 @@ struct hid_device { /* device report descriptor */
	ANDROID_KABI_RESERVE(2);
};

void hiddev_free(struct kref *ref);

#define to_hid_device(pdev) \
	container_of(pdev, struct hid_device, dev)