diff options
-rw-r--r-- | drivers/staging/rspiusb/rspiusb.c | 59 |
1 files changed, 8 insertions, 51 deletions
diff --git a/drivers/staging/rspiusb/rspiusb.c b/drivers/staging/rspiusb/rspiusb.c index 685ab3f33861..090bf41ebcd2 100644 --- a/drivers/staging/rspiusb/rspiusb.c +++ b/drivers/staging/rspiusb/rspiusb.c | |||
@@ -252,38 +252,6 @@ static int pixis_io(struct ioctl_struct *ctrl, struct device_extension *pdx, | |||
252 | return ctrl->numbytes; | 252 | return ctrl->numbytes; |
253 | } | 253 | } |
254 | 254 | ||
255 | static int pixis_io2(struct ioctl_struct *ctrl, struct device_extension *pdx, | ||
256 | struct ioctl_struct *arg) | ||
257 | { | ||
258 | unsigned char *uBuf; | ||
259 | int numbytes; | ||
260 | int i; | ||
261 | |||
262 | uBuf = kmalloc(ctrl->numbytes, GFP_KERNEL); | ||
263 | if (!uBuf) { | ||
264 | dbg("Alloc for uBuf failed"); | ||
265 | return 0; | ||
266 | } | ||
267 | numbytes = (int) ctrl->numbytes; | ||
268 | /* dbg( "numbytes to read = %d", numbytes ); */ | ||
269 | if (copy_from_user(uBuf, ctrl->pData, numbytes)) | ||
270 | dbg("copying ctrl->pData to dummyBuf failed"); | ||
271 | |||
272 | i = usb_bulk_msg(pdx->udev, pdx->hEP[ctrl->endpoint], | ||
273 | uBuf, numbytes, &numbytes, HZ * 10); | ||
274 | if (i) { | ||
275 | dbg("Blocking ReadI/O Failed with status %d", i); | ||
276 | kfree(uBuf); | ||
277 | return -1; | ||
278 | } | ||
279 | ctrl->numbytes = numbytes; | ||
280 | memcpy(ctrl->pData, uBuf, numbytes); | ||
281 | if (copy_to_user(arg, ctrl, sizeof(struct ioctl_struct))) | ||
282 | dbg("copy_to_user failed in IORB"); | ||
283 | kfree(uBuf); | ||
284 | return ctrl->numbytes; | ||
285 | } | ||
286 | |||
287 | static int pixel_data(struct ioctl_struct *ctrl, struct device_extension *pdx) | 255 | static int pixel_data(struct ioctl_struct *ctrl, struct device_extension *pdx) |
288 | { | 256 | { |
289 | int i; | 257 | int i; |
@@ -398,27 +366,16 @@ static int piusb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
398 | sizeof(struct ioctl_struct))) | 366 | sizeof(struct ioctl_struct))) |
399 | dev_err(&pdx->udev->dev, "copy_from_user failed\n"); | 367 | dev_err(&pdx->udev->dev, "copy_from_user failed\n"); |
400 | 368 | ||
401 | switch (ctrl.endpoint) { | 369 | if (((0 == ctrl.endpoint) && (PIXIS_PID == pdx->iama)) || |
402 | case 0: /* ST133 Pixel Data or PIXIS IO */ | 370 | (1 == ctrl.endpoint) || /* ST133IO */ |
403 | if (pdx->iama == PIXIS_PID) { | 371 | (4 == ctrl.endpoint)) /* PIXIS IO */ |
404 | return pixis_io(&ctrl, pdx, | 372 | return pixis_io(&ctrl, pdx, |
405 | (struct ioctl_struct *)arg); | 373 | (struct ioctl_struct *)arg); |
406 | } | 374 | else if ((0 == ctrl.endpoint) || /* ST133 Pixel Data */ |
407 | /* ST133 Pixel Data */ | 375 | (2 == ctrl.endpoint) || /* PIXIS Ping */ |
408 | /* fall through */ | 376 | (3 == ctrl.endpoint)) /* PIXIS Pong */ |
409 | case 2: /* PIXIS Ping */ | ||
410 | /* fall through */ | ||
411 | case 3: /* PIXIS Pong */ | ||
412 | return pixel_data(&ctrl, pdx); | 377 | return pixel_data(&ctrl, pdx); |
413 | 378 | ||
414 | case 1: /* ST133IO */ | ||
415 | /* fall through */ | ||
416 | case 4: /* PIXIS IO */ | ||
417 | return pixis_io2(&ctrl, pdx, | ||
418 | (struct ioctl_struct *)arg); | ||
419 | default: | ||
420 | break; | ||
421 | } | ||
422 | break; | 379 | break; |
423 | 380 | ||
424 | case PIUSB_WHATCAMERA: | 381 | case PIUSB_WHATCAMERA: |