summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hidraw.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2014-04-01 13:05:09 -0400
committerJiri Kosina <jkosina@suse.cz>2014-04-01 13:05:09 -0400
commitad295b6d5739ab24880a31be403bbc8fab62e177 (patch)
treecd760a18bcfa6e59b8b63fc71e333ba394b1cd9c /drivers/hid/hidraw.c
parentba04a57b4acd05a764471b2accd02000f6641881 (diff)
parentc3d77fab51f40821de91a744e4b514e9e4e76a7c (diff)
Merge branch 'for-3.15/hid-core-ll-transport-cleanup' into for-linus
Conflicts: drivers/hid/hid-ids.h drivers/hid/hid-sony.c drivers/hid/i2c-hid/i2c-hid.c
Diffstat (limited to 'drivers/hid/hidraw.c')
-rw-r--r--drivers/hid/hidraw.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index ab24ce2eb28f..9c2d7c23f296 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -123,10 +123,6 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer,
123 123
124 dev = hidraw_table[minor]->hid; 124 dev = hidraw_table[minor]->hid;
125 125
126 if (!dev->hid_output_raw_report) {
127 ret = -ENODEV;
128 goto out;
129 }
130 126
131 if (count > HID_MAX_BUFFER_SIZE) { 127 if (count > HID_MAX_BUFFER_SIZE) {
132 hid_warn(dev, "pid %d passed too large report\n", 128 hid_warn(dev, "pid %d passed too large report\n",
@@ -153,7 +149,21 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer,
153 goto out_free; 149 goto out_free;
154 } 150 }
155 151
156 ret = dev->hid_output_raw_report(dev, buf, count, report_type); 152 if ((report_type == HID_OUTPUT_REPORT) &&
153 !(dev->quirks & HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP)) {
154 ret = hid_hw_output_report(dev, buf, count);
155 /*
156 * compatibility with old implementation of USB-HID and I2C-HID:
157 * if the device does not support receiving output reports,
158 * on an interrupt endpoint, fallback to SET_REPORT HID command.
159 */
160 if (ret != -ENOSYS)
161 goto out_free;
162 }
163
164 ret = hid_hw_raw_request(dev, buf[0], buf, count, report_type,
165 HID_REQ_SET_REPORT);
166
157out_free: 167out_free:
158 kfree(buf); 168 kfree(buf);
159out: 169out:
@@ -189,7 +199,7 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
189 199
190 dev = hidraw_table[minor]->hid; 200 dev = hidraw_table[minor]->hid;
191 201
192 if (!dev->hid_get_raw_report) { 202 if (!dev->ll_driver->raw_request) {
193 ret = -ENODEV; 203 ret = -ENODEV;
194 goto out; 204 goto out;
195 } 205 }
@@ -216,14 +226,15 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
216 226
217 /* 227 /*
218 * Read the first byte from the user. This is the report number, 228 * Read the first byte from the user. This is the report number,
219 * which is passed to dev->hid_get_raw_report(). 229 * which is passed to hid_hw_raw_request().
220 */ 230 */
221 if (copy_from_user(&report_number, buffer, 1)) { 231 if (copy_from_user(&report_number, buffer, 1)) {
222 ret = -EFAULT; 232 ret = -EFAULT;
223 goto out_free; 233 goto out_free;
224 } 234 }
225 235
226 ret = dev->hid_get_raw_report(dev, report_number, buf, count, report_type); 236 ret = hid_hw_raw_request(dev, report_number, buf, count, report_type,
237 HID_REQ_GET_REPORT);
227 238
228 if (ret < 0) 239 if (ret < 0)
229 goto out_free; 240 goto out_free;