Re: [PATCH] imon_raw: respect DMA coherency

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

 



On Thu, May 12, 2022 at 03:03:21PM +0200, Oliver Neukum wrote:
> No buffer can be embedded inside a descriptor, not even a simple be64.
> Use a separate kmalloc()

This patch needs a tiny change from be64_to_cpu() to be64_to_cpup(), I've
tested that change with the hardware.

Applied to my tree:

https://git.linuxtv.org/syoung/media_tree.git/log/?h=for-v5.20a

Thanks,

Sean

> 
> Signed-off-by: Oliver Neukum <oneukum@xxxxxxxx>
> ---
>  drivers/media/rc/imon_raw.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/rc/imon_raw.c b/drivers/media/rc/imon_raw.c
> index d41580f6e4c7..b7a0c0b34378 100644
> --- a/drivers/media/rc/imon_raw.c
> +++ b/drivers/media/rc/imon_raw.c
> @@ -14,7 +14,7 @@ struct imon {
>  	struct device *dev;
>  	struct urb *ir_urb;
>  	struct rc_dev *rcdev;
> -	__be64 ir_buf;
> +	__be64 *ir_buf;
>  	char phys[64];
>  };
>  
> @@ -137,10 +137,16 @@ static int imon_probe(struct usb_interface *intf,
>  	if (!imon->ir_urb)
>  		return -ENOMEM;
>  
> +	imon->ir_buf = kmalloc(sizeof(__be64), GFP_KERNEL);
> +	if (!imon->ir_buf) {
> +		ret = -ENOMEM;
> +		goto free_urb;
> +	}
> +
>  	imon->dev = &intf->dev;
>  	usb_fill_int_urb(imon->ir_urb, udev,
>  			 usb_rcvintpipe(udev, ir_ep->bEndpointAddress),
> -			 &imon->ir_buf, sizeof(imon->ir_buf),
> +			 imon->ir_buf, sizeof(__be64),
>  			 imon_ir_rx, imon, ir_ep->bInterval);
>  
>  	rcdev = devm_rc_allocate_device(&intf->dev, RC_DRIVER_IR_RAW);
> @@ -177,6 +183,7 @@ static int imon_probe(struct usb_interface *intf,
>  
>  free_urb:
>  	usb_free_urb(imon->ir_urb);
> +	kfree(imon->ir_buf);
>  	return ret;
>  }
>  
> @@ -186,6 +193,7 @@ static void imon_disconnect(struct usb_interface *intf)
>  
>  	usb_kill_urb(imon->ir_urb);
>  	usb_free_urb(imon->ir_urb);
> +	kfree(imon->ir_buf);
>  }
>  
>  static const struct usb_device_id imon_table[] = {
> -- 
> 2.35.3



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux