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

Commit 18a929c3 authored by Raghavendra Rao Ananta's avatar Raghavendra Rao Ananta Committed by Gerrit - the friendly Code Review server
Browse files

HID: uhid: Remove the redundant reference counting for open/close



Currently, the uhid driver manages the reference count for the number
of clients active for this uhid device. However, the reference count
is already managed by the hid-core. As a result, during uhid_open for
example, we never get the UHID_OPEN event in the upper layers as the
reference count is incremented twice for each open(). Hence, let the
reference counting be done only by the hid-core and not by the uhid
driver.

Change-Id: I473239db0f373d9188fc379653cedd305d2a552b
Signed-off-by: default avatarRaghavendra Rao Ananta <rananta@codeaurora.org>
Signed-off-by: default avatarChetan C R <cravin@codeaurora.org>
parent 941a79a4
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -144,26 +144,15 @@ static void uhid_hid_stop(struct hid_device *hid)
static int uhid_hid_open(struct hid_device *hid)
{
	struct uhid_device *uhid = hid->driver_data;
	int retval = 0;

	mutex_lock(&uhid_open_mutex);
	if (!hid->open++) {
		retval = uhid_queue_event(uhid, UHID_OPEN);
		if (retval)
			hid->open--;
	}
	mutex_unlock(&uhid_open_mutex);
	return retval;
	return uhid_queue_event(uhid, UHID_OPEN);
}

static void uhid_hid_close(struct hid_device *hid)
{
	struct uhid_device *uhid = hid->driver_data;

	mutex_lock(&uhid_open_mutex);
	if (!--hid->open)
	uhid_queue_event(uhid, UHID_CLOSE);
	mutex_unlock(&uhid_open_mutex);
}

static int uhid_hid_parse(struct hid_device *hid)