diff options
| author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2014-02-10 12:58:46 -0500 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2014-02-17 08:49:22 -0500 |
| commit | 41abfb36005e06276a38fdda9ba4162d2a134c54 (patch) | |
| tree | a7b1c6f4712fefe04c55322be6d9f595905c1ec4 | |
| parent | 4a76d370f0c0508b5d6580d15eae3d40b47d837c (diff) | |
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>
| -rw-r--r-- | drivers/hid/uhid.c | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index 89de2fef46b2..49fbe97ebb16 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c | |||
| @@ -164,27 +164,7 @@ static int uhid_hid_output_raw(struct hid_device *hid, __u8 *buf, size_t count, | |||
| 164 | static int uhid_hid_output_report(struct hid_device *hid, __u8 *buf, | 164 | static int uhid_hid_output_report(struct hid_device *hid, __u8 *buf, |
| 165 | size_t count) | 165 | size_t count) |
| 166 | { | 166 | { |
| 167 | struct uhid_device *uhid = hid->driver_data; | 167 | return uhid_hid_output_raw(hid, buf, count, HID_OUTPUT_REPORT); |
| 168 | unsigned long flags; | ||
| 169 | struct uhid_event *ev; | ||
| 170 | |||
| 171 | if (count < 1 || count > UHID_DATA_MAX) | ||
| 172 | return -EINVAL; | ||
| 173 | |||
| 174 | ev = kzalloc(sizeof(*ev), GFP_KERNEL); | ||
| 175 | if (!ev) | ||
| 176 | return -ENOMEM; | ||
| 177 | |||
| 178 | ev->type = UHID_OUTPUT; | ||
| 179 | ev->u.output.size = count; | ||
| 180 | ev->u.output.rtype = UHID_OUTPUT_REPORT; | ||
| 181 | memcpy(ev->u.output.data, buf, count); | ||
| 182 | |||
| 183 | spin_lock_irqsave(&uhid->qlock, flags); | ||
| 184 | uhid_queue(uhid, ev); | ||
| 185 | spin_unlock_irqrestore(&uhid->qlock, flags); | ||
| 186 | |||
| 187 | return count; | ||
| 188 | } | 168 | } |
| 189 | 169 | ||
| 190 | static struct hid_ll_driver uhid_hid_driver = { | 170 | static struct hid_ll_driver uhid_hid_driver = { |
