public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: yurex: remove allocation of coherent buffer for setup-packet buffer
@ 2012-03-28 23:20 Tomoki Sekiyama
  2012-03-29 11:57 ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Tomoki Sekiyama @ 2012-03-28 23:20 UTC (permalink / raw)
  To: gregkh, linux-usb, linux-kernel

Removes allocation of coherent buffer for the control-request setup-packet
buffer from the yurex driver. Using coherent buffers for setup-packet is
obsoleted and does not work with some USB host implementations.

This patch also fixes missing URB_NO_TRANSFER_DMA_MAP flag in urb.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@gmail.com>
---
 drivers/usb/misc/yurex.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
index 897edda..7020146 100644
--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref)
 	usb_put_dev(dev->udev);
 	if (dev->cntl_urb) {
 		usb_kill_urb(dev->cntl_urb);
-		if (dev->cntl_req)
-			usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
-				dev->cntl_req, dev->cntl_urb->setup_dma);
+		kfree(dev->cntl_req);
 		if (dev->cntl_buffer)
 			usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
 				dev->cntl_buffer, dev->cntl_urb->transfer_dma);
@@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
 	}
 
 	/* allocate buffer for control req */
-	dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE,
-					   GFP_KERNEL,
-					   &dev->cntl_urb->setup_dma);
+	dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL);
 	if (!dev->cntl_req) {
 		err("Could not allocate cntl_req");
 		goto error;
@@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
 			 usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr),
 			 dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt,
 			 dev, 1);
-	dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+	dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 	if (usb_submit_urb(dev->urb, GFP_KERNEL)) {
 		retval = -EIO;
 		err("Could not submitting URB");
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] USB: yurex: remove allocation of coherent buffer for setup-packet buffer
  2012-03-28 23:20 [PATCH] USB: yurex: remove allocation of coherent buffer for setup-packet buffer Tomoki Sekiyama
@ 2012-03-29 11:57 ` Sergei Shtylyov
  2012-03-29 12:51   ` Tomoki Sekiyama
  2012-03-29 23:51   ` [PATCH 2/2] USB: yurex: Fix missing URB_NO_TRANSFER_DMA_MAP flag in urb Tomoki Sekiyama
  0 siblings, 2 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2012-03-29 11:57 UTC (permalink / raw)
  To: Tomoki Sekiyama; +Cc: gregkh, linux-usb, linux-kernel

Hello.

On 29-03-2012 3:20, Tomoki Sekiyama wrote:

> Removes allocation of coherent buffer for the control-request setup-packet
> buffer from the yurex driver. Using coherent buffers for setup-packet is
> obsoleted and does not work with some USB host implementations.

> This patch also fixes missing URB_NO_TRANSFER_DMA_MAP flag in urb.

   Looks like the patch should be split into two then as it does two different
things.

> Signed-off-by: Tomoki Sekiyama<tomoki.sekiyama@gmail.com>
> ---
>   drivers/usb/misc/yurex.c |   10 +++-------
>   1 files changed, 3 insertions(+), 7 deletions(-)

> diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
> index 897edda..7020146 100644
> --- a/drivers/usb/misc/yurex.c
> +++ b/drivers/usb/misc/yurex.c
> @@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref)
>   	usb_put_dev(dev->udev);
>   	if (dev->cntl_urb) {
>   		usb_kill_urb(dev->cntl_urb);
> -		if (dev->cntl_req)
> -			usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
> -				dev->cntl_req, dev->cntl_urb->setup_dma);
> +		kfree(dev->cntl_req);
>   		if (dev->cntl_buffer)
>   			usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
>   				dev->cntl_buffer, dev->cntl_urb->transfer_dma);
> @@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
>   	}
> 
>   	/* allocate buffer for control req */
> -	dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE,
> -					   GFP_KERNEL,
> -					&dev->cntl_urb->setup_dma);
> +	dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL);
>   	if (!dev->cntl_req) {
>   		err("Could not allocate cntl_req");
>   		goto error;
> @@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
>   			 usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr),
>   			 dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt,
>   			 dev, 1);
> -	dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
> +	dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
>   	if (usb_submit_urb(dev->urb, GFP_KERNEL)) {
>   		retval = -EIO;
>   		err("Could not submitting URB");

WBR, Sergei

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] USB: yurex: remove allocation of coherent buffer for setup-packet buffer
  2012-03-29 11:57 ` Sergei Shtylyov
@ 2012-03-29 12:51   ` Tomoki Sekiyama
  2012-03-29 23:51     ` [PATCH 1/2] USB: yurex: Remove " Tomoki Sekiyama
  2012-03-29 23:51   ` [PATCH 2/2] USB: yurex: Fix missing URB_NO_TRANSFER_DMA_MAP flag in urb Tomoki Sekiyama
  1 sibling, 1 reply; 5+ messages in thread
From: Tomoki Sekiyama @ 2012-03-29 12:51 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: gregkh, linux-usb, linux-kernel

Hello,

2012年3月29日20:57 Sergei Shtylyov <sshtylyov@mvista.com>:
> Hello.
>
> On 29-03-2012 3:20, Tomoki Sekiyama wrote:
>
>> Removes allocation of coherent buffer for the control-request setup-packet
>> buffer from the yurex driver. Using coherent buffers for setup-packet is
>> obsoleted and does not work with some USB host implementations.
>
>> This patch also fixes missing URB_NO_TRANSFER_DMA_MAP flag in urb.
>
>   Looks like the patch should be split into two then as it does two different
> things.
>
> WBR, Sergei

OK, I will split this patch into two pieces and re-send them.

Thank you,

Tomoki Sekiyama

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] USB: yurex: Remove allocation of coherent buffer for setup-packet buffer
  2012-03-29 12:51   ` Tomoki Sekiyama
@ 2012-03-29 23:51     ` Tomoki Sekiyama
  0 siblings, 0 replies; 5+ messages in thread
From: Tomoki Sekiyama @ 2012-03-29 23:51 UTC (permalink / raw)
  To: Sergei Shtylyov, gregkh, linux-usb, linux-kernel

Removes allocation of coherent buffer for the control-request setup-packet
buffer from the yurex driver. Using coherent buffers for setup-packet is
obsolete and does not work with some USB host implementations.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@gmail.com>
---
 drivers/usb/misc/yurex.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
index 897edda..a4a76fc 100644
--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref)
 	usb_put_dev(dev->udev);
 	if (dev->cntl_urb) {
 		usb_kill_urb(dev->cntl_urb);
-		if (dev->cntl_req)
-			usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
-				dev->cntl_req, dev->cntl_urb->setup_dma);
+		kfree(dev->cntl_req);
 		if (dev->cntl_buffer)
 			usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
 				dev->cntl_buffer, dev->cntl_urb->transfer_dma);
@@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
 	}
 
 	/* allocate buffer for control req */
-	dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE,
-					   GFP_KERNEL,
-					   &dev->cntl_urb->setup_dma);
+	dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL);
 	if (!dev->cntl_req) {
 		err("Could not allocate cntl_req");
 		goto error;
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] USB: yurex: Fix missing URB_NO_TRANSFER_DMA_MAP flag in urb
  2012-03-29 11:57 ` Sergei Shtylyov
  2012-03-29 12:51   ` Tomoki Sekiyama
@ 2012-03-29 23:51   ` Tomoki Sekiyama
  1 sibling, 0 replies; 5+ messages in thread
From: Tomoki Sekiyama @ 2012-03-29 23:51 UTC (permalink / raw)
  To: Sergei Shtylyov, gregkh, linux-usb, linux-kernel

Current probing code is setting URB_NO_TRANSFER_DMA_MAP flag into a wrong urb
structure, and this causes BUG_ON with some USB host implementations.
This patch fixes the issue.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@gmail.com>
---
 drivers/usb/misc/yurex.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
index a4a76fc..7020146 100644
--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -282,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
 			 usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr),
 			 dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt,
 			 dev, 1);
-	dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+	dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 	if (usb_submit_urb(dev->urb, GFP_KERNEL)) {
 		retval = -EIO;
 		err("Could not submitting URB");
-- 1.7.7.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-29 23:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-28 23:20 [PATCH] USB: yurex: remove allocation of coherent buffer for setup-packet buffer Tomoki Sekiyama
2012-03-29 11:57 ` Sergei Shtylyov
2012-03-29 12:51   ` Tomoki Sekiyama
2012-03-29 23:51     ` [PATCH 1/2] USB: yurex: Remove " Tomoki Sekiyama
2012-03-29 23:51   ` [PATCH 2/2] USB: yurex: Fix missing URB_NO_TRANSFER_DMA_MAP flag in urb Tomoki Sekiyama

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox