adutux support for O_NONBLOCK in write path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

does anybody have hardware to test patches for adutux?
This should allow support for O_NONBLOCK in the write path.

	Regards
		Oliver

--

commit c94b4e9e71c86f188be5162ea9d2081573edeed2
Author: Oliver Neukum <oliver@xxxxxxxxxx>
Date:   Wed Sep 9 09:13:22 2009 +0200

    usb:adutux: O_NONBLOCK in read

diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index 2035265..8b38f03 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -499,6 +499,8 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
 				}
 
 				/* we wait for I/O to complete */
+				if (file->f_flags & O_NONBLOCK)
+					goto skip;
 				set_current_state(TASK_INTERRUPTIBLE);
 				add_wait_queue(&dev->read_wait, &wait);
 				spin_lock_irqsave(&dev->buflock, flags);
@@ -526,7 +528,8 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
 		}
 	}
 
-	retval = bytes_read;
+skip:
+	retval = bytes_read ? bytes_read : -EAGAIN;
 	/* if the primary buffer is empty then use it */
 	spin_lock_irqsave(&dev->buflock, flags);
 	if (should_submit && dev->read_urb_finished) {

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux