summaryrefslogtreecommitdiffstats
path: root/drivers/hid/uhid.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-07-29 17:14:19 +0200
committerJiri Kosina <jkosina@suse.cz>2014-08-25 03:28:06 -0500
commit8cad5b017178bd7fa56d5039478d46964bcd94f7 (patch)
treeb032db8dbcabe50cc61d23f36f3bdb80c7959678 /drivers/hid/uhid.c
parent25be7fe2be879a96920cc74809e1bff1b0ae0bac (diff)
downloadblackbird-op-linux-8cad5b017178bd7fa56d5039478d46964bcd94f7.tar.gz
blackbird-op-linux-8cad5b017178bd7fa56d5039478d46964bcd94f7.zip
HID: uhid: turn report_id into u32
All accesses to @report_id are protected by @qlock. No need to use an atomic. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/uhid.c')
-rw-r--r--drivers/hid/uhid.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
index 5dee8bd60745..db4e119cb088 100644
--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -44,10 +44,11 @@ struct uhid_device {
__u8 tail;
struct uhid_event *outq[UHID_BUFSIZE];
+ /* blocking GET_REPORT support; state changes protected by qlock */
struct mutex report_lock;
wait_queue_head_t report_wait;
atomic_t report_done;
- atomic_t report_id;
+ u32 report_id;
struct uhid_event report_buf;
};
@@ -163,7 +164,7 @@ static int uhid_hid_get_raw(struct hid_device *hid, unsigned char rnum,
spin_lock_irqsave(&uhid->qlock, flags);
ev->type = UHID_FEATURE;
- ev->u.feature.id = atomic_inc_return(&uhid->report_id);
+ ev->u.feature.id = ++uhid->report_id;
ev->u.feature.rnum = rnum;
ev->u.feature.rtype = report_type;
@@ -497,7 +498,7 @@ static int uhid_dev_feature_answer(struct uhid_device *uhid,
spin_lock_irqsave(&uhid->qlock, flags);
/* id for old report; drop it silently */
- if (atomic_read(&uhid->report_id) != ev->u.feature_answer.id)
+ if (uhid->report_id != ev->u.feature_answer.id)
goto unlock;
if (atomic_read(&uhid->report_done))
goto unlock;
OpenPOWER on IntegriCloud