HID: uHID: remove duplicated code
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>
This commit is contained in:
parent
4a76d370f0
commit
41abfb3600
|
@ -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,
|
static int uhid_hid_output_report(struct hid_device *hid, __u8 *buf,
|
||||||
size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
struct uhid_device *uhid = hid->driver_data;
|
return uhid_hid_output_raw(hid, buf, count, HID_OUTPUT_REPORT);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct hid_ll_driver uhid_hid_driver = {
|
static struct hid_ll_driver uhid_hid_driver = {
|
||||||
|
|
Loading…
Reference in New Issue