diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/usb-skeleton.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index 768fda9064e9..ef8c877cdd41 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c | |||
@@ -268,6 +268,11 @@ retry: | |||
268 | spin_unlock_irq(&dev->err_lock); | 268 | spin_unlock_irq(&dev->err_lock); |
269 | 269 | ||
270 | if (ongoing_io) { | 270 | if (ongoing_io) { |
271 | /* nonblocking IO shall not wait */ | ||
272 | if (file->f_flags & O_NONBLOCK) { | ||
273 | rv = -EAGAIN; | ||
274 | goto exit; | ||
275 | } | ||
271 | /* | 276 | /* |
272 | * IO may take forever | 277 | * IO may take forever |
273 | * hence wait in an interruptible state | 278 | * hence wait in an interruptible state |
@@ -351,8 +356,9 @@ retry: | |||
351 | rv = skel_do_read_io(dev, count); | 356 | rv = skel_do_read_io(dev, count); |
352 | if (rv < 0) | 357 | if (rv < 0) |
353 | goto exit; | 358 | goto exit; |
354 | else | 359 | else if (!file->f_flags & O_NONBLOCK) |
355 | goto retry; | 360 | goto retry; |
361 | rv = -EAGAIN; | ||
356 | } | 362 | } |
357 | exit: | 363 | exit: |
358 | mutex_unlock(&dev->io_mutex); | 364 | mutex_unlock(&dev->io_mutex); |