linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4] media: lmedm04: Move interrupt buffer to priv buffer.
@ 2018-11-29 22:30 Malcolm Priestley
  2018-12-04 18:55 ` Sean Young
  0 siblings, 1 reply; 2+ messages in thread
From: Malcolm Priestley @ 2018-11-29 22:30 UTC (permalink / raw)
  To: Linux Media Mailing List

Interrupt is always present throught life time of
there is no dma element move this buffer to private
area of driver.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/media/usb/dvb-usb-v2/lmedm04.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index 8fb53b83c914..7b1aaed259db 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -134,7 +134,7 @@ struct lme2510_state {
 	u8 stream_on;
 	u8 pid_size;
 	u8 pid_off;
-	void *buffer;
+	u8 int_buffer[128];
 	struct urb *lme_urb;
 	u8 usb_buffer[64];
 	/* Frontend original calls */
@@ -408,20 +408,14 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)
 	if (lme_int->lme_urb == NULL)
 			return -ENOMEM;
 
-	lme_int->buffer = usb_alloc_coherent(d->udev, 128, GFP_ATOMIC,
-					&lme_int->lme_urb->transfer_dma);
-
-	if (lme_int->buffer == NULL)
-			return -ENOMEM;
-
 	usb_fill_int_urb(lme_int->lme_urb,
-				d->udev,
-				usb_rcvintpipe(d->udev, 0xa),
-				lme_int->buffer,
-				128,
-				lme2510_int_response,
-				adap,
-				8);
+			 d->udev,
+			 usb_rcvintpipe(d->udev, 0xa),
+			 lme_int->int_buffer,
+			 sizeof(lme_int->int_buffer),
+			 lme2510_int_response,
+			 adap,
+			 8);
 
 	/* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */
 	ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe);
@@ -1245,11 +1239,9 @@ static void lme2510_exit(struct dvb_usb_device *d)
 		lme2510_kill_urb(&adap->stream);
 	}
 
-	if (st->lme_urb != NULL) {
+	if (st->lme_urb) {
 		usb_kill_urb(st->lme_urb);
 		usb_free_urb(st->lme_urb);
-		usb_free_coherent(d->udev, 128, st->buffer,
-				  st->lme_urb->transfer_dma);
 		info("Interrupt Service Stopped");
 	}
 }
-- 
2.19.1

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

* Re: [PATCH 3/4] media: lmedm04: Move interrupt buffer to priv buffer.
  2018-11-29 22:30 [PATCH 3/4] media: lmedm04: Move interrupt buffer to priv buffer Malcolm Priestley
@ 2018-12-04 18:55 ` Sean Young
  0 siblings, 0 replies; 2+ messages in thread
From: Sean Young @ 2018-12-04 18:55 UTC (permalink / raw)
  To: Malcolm Priestley; +Cc: Linux Media Mailing List

On Thu, Nov 29, 2018 at 10:30:15PM +0000, Malcolm Priestley wrote:
> Interrupt is always present throught life time of
> there is no dma element move this buffer to private
> area of driver.
> 
> Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> ---
>  drivers/media/usb/dvb-usb-v2/lmedm04.c | 26 +++++++++-----------------
>  1 file changed, 9 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
> index 8fb53b83c914..7b1aaed259db 100644
> --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
> +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
> @@ -134,7 +134,7 @@ struct lme2510_state {
>  	u8 stream_on;
>  	u8 pid_size;
>  	u8 pid_off;
> -	void *buffer;
> +	u8 int_buffer[128];
>  	struct urb *lme_urb;
>  	u8 usb_buffer[64];
>  	/* Frontend original calls */
> @@ -408,20 +408,14 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)
>  	if (lme_int->lme_urb == NULL)
>  			return -ENOMEM;
>  
> -	lme_int->buffer = usb_alloc_coherent(d->udev, 128, GFP_ATOMIC,
> -					&lme_int->lme_urb->transfer_dma);
> -

The buffer was allocated with usb_alloc_coherent, however now it is
allocated with kmalloc. 

> -	if (lme_int->buffer == NULL)
> -			return -ENOMEM;
> -
>  	usb_fill_int_urb(lme_int->lme_urb,
> -				d->udev,
> -				usb_rcvintpipe(d->udev, 0xa),
> -				lme_int->buffer,
> -				128,
> -				lme2510_int_response,
> -				adap,
> -				8);
> +			 d->udev,
> +			 usb_rcvintpipe(d->udev, 0xa),
> +			 lme_int->int_buffer,
> +			 sizeof(lme_int->int_buffer),
> +			 lme2510_int_response,
> +			 adap,
> +			 8);
>  
>  	/* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */
>  	ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe);

On line 408:
        lme_int->lme_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;

This requires usb_alloc_coherent().

> @@ -1245,11 +1239,9 @@ static void lme2510_exit(struct dvb_usb_device *d)
>  		lme2510_kill_urb(&adap->stream);
>  	}
>  
> -	if (st->lme_urb != NULL) {
> +	if (st->lme_urb) {
>  		usb_kill_urb(st->lme_urb);
>  		usb_free_urb(st->lme_urb);
> -		usb_free_coherent(d->udev, 128, st->buffer,
> -				  st->lme_urb->transfer_dma);
>  		info("Interrupt Service Stopped");
>  	}
>  }
> -- 
> 2.19.1

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

end of thread, other threads:[~2018-12-04 18:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 22:30 [PATCH 3/4] media: lmedm04: Move interrupt buffer to priv buffer Malcolm Priestley
2018-12-04 18:55 ` Sean Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).