RE: [PATCH]USB: usb-skeleton: add retry for nonblocking read

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

 



Sorry, I find some tabs are still missed even I sent out as plain txt by outlook. Please ignore this again, I will try to resolve this before submit it.
----------------------------------------
> From: unicorn_wang@xxxxxxxxxxx
> To: linux-usb@xxxxxxxxxxxxxxx
> CC: oneukum@xxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx; unicorn_wang@xxxxxxxxxxx
> Subject: [PATCH]USB: usb-skeleton: add retry for nonblocking read
> Date: Thu, 18 Jul 2013 13:09:20 +0000
>
> From: Chen Wang unicorn_wang@xxxxxxxxxxx
>
> Updated skel_read() in usb-skeleton.c. When there is no data in the buffer, we would allow retry for both blocking and nonblocking cases. Original logic gives retry only for blocking case. Actually we can also allow retry for nonblocking case. This will reuse the existing retry logic and handle the return of -EAGAIN in one place. Also if the data to be read is short and can be retrieved in quick time, we can also give a chance for nonblocking case and may catch the data and copy it back to userspace in one read() call too.
>
> Signed-off-by: Chen Wang unicorn_wang@xxxxxxxxxxx
> ---
> --- linux-3.11-rc1/drivers/usb/usb-skeleton.c.orig 2013-07-18 19:35:23.559780152 +0800
> +++ linux-3.11-rc1/drivers/usb/usb-skeleton.c 2013-07-18 19:38:11.546779516 +0800
> @@ -325,9 +325,8 @@ retry:
> rv = skel_do_read_io(dev, count);
> if (rv < 0)
> goto exit;
> - else if (!(file->f_flags & O_NONBLOCK))
> + else
> goto retry;
> - rv = -EAGAIN;
> }
> exit:
> mutex_unlock(&dev->io_mutex); 		 	   		  ?韬{.n?????%??檩??w?{.n???{炳???骅w*jg????????G??⒏⒎?:+v????????????"??????




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

  Powered by Linux