Skip to content

Commit

Permalink
HID: uHID: remove duplicated code
Browse files Browse the repository at this point in the history
uhid_hid_output_report() can be implemented through a simple call
to uhid_hid_output_raw().

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Benjamin Tissoires authored and Jiri Kosina committed Feb 17, 2014
1 parent 4a76d37 commit 41abfb3
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions drivers/hid/uhid.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,27 +164,7 @@ static int uhid_hid_output_raw(struct hid_device *hid, __u8 *buf, size_t count,
static int uhid_hid_output_report(struct hid_device *hid, __u8 *buf,
size_t count)
{
struct uhid_device *uhid = hid->driver_data;
unsigned long flags;
struct uhid_event *ev;

if (count < 1 || count > UHID_DATA_MAX)
return -EINVAL;

ev = kzalloc(sizeof(*ev), GFP_KERNEL);
if (!ev)
return -ENOMEM;

ev->type = UHID_OUTPUT;
ev->u.output.size = count;
ev->u.output.rtype = UHID_OUTPUT_REPORT;
memcpy(ev->u.output.data, buf, count);

spin_lock_irqsave(&uhid->qlock, flags);
uhid_queue(uhid, ev);
spin_unlock_irqrestore(&uhid->qlock, flags);

return count;
return uhid_hid_output_raw(hid, buf, count, HID_OUTPUT_REPORT);
}

static struct hid_ll_driver uhid_hid_driver = {
Expand Down

0 comments on commit 41abfb3

Please sign in to comment.