diff mbox series

[1/8] usb: gadget: uvc: use fourcc printk helper

Message ID 20230323-uvc-gadget-cleanup-v1-1-e41f0c5d9d8e@pengutronix.de
State New
Headers show
Series usb: gadget: uvc: fix errors reported by v4l2-compliance | expand

Commit Message

Michael Tretter March 23, 2023, 11:41 a.m. UTC
There is a format helper for printing fourcc codes. Use that one instead
of manually formatting the pixelformat for printing.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 drivers/usb/gadget/function/uvc_v4l2.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Daniel Scally March 24, 2023, 7:44 a.m. UTC | #1
Morning Michael

On 23/03/2023 11:41, Michael Tretter wrote:
> There is a format helper for printing fourcc codes. Use that one instead
> of manually formatting the pixelformat for printing.
>
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---


Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>

>   drivers/usb/gadget/function/uvc_v4l2.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c
> index 3f0a9795c0d4..13c7ba06f994 100644
> --- a/drivers/usb/gadget/function/uvc_v4l2.c
> +++ b/drivers/usb/gadget/function/uvc_v4l2.c
> @@ -240,16 +240,13 @@ uvc_v4l2_try_format(struct file *file, void *fh, struct v4l2_format *fmt)
>   	struct uvc_video *video = &uvc->video;
>   	struct uvcg_format *uformat;
>   	struct uvcg_frame *uframe;
> -	u8 *fcc;
>   
>   	if (fmt->type != video->queue.queue.type)
>   		return -EINVAL;
>   
> -	fcc = (u8 *)&fmt->fmt.pix.pixelformat;
> -	uvcg_dbg(&uvc->func, "Trying format 0x%08x (%c%c%c%c): %ux%u\n",
> -		fmt->fmt.pix.pixelformat,
> -		fcc[0], fcc[1], fcc[2], fcc[3],
> -		fmt->fmt.pix.width, fmt->fmt.pix.height);
> +	uvcg_dbg(&uvc->func, "Trying format %p4cc: %ux%u\n",
> +		 &fmt->fmt.pix.pixelformat,
> +		 fmt->fmt.pix.width, fmt->fmt.pix.height);
>   
>   	uformat = find_format_by_pix(uvc, fmt->fmt.pix.pixelformat);
>   	if (!uformat)
>
Laurent Pinchart March 24, 2023, 9:21 a.m. UTC | #2
Hi Michael,

Thank you for the patch.

On Thu, Mar 23, 2023 at 12:41:09PM +0100, Michael Tretter wrote:
> There is a format helper for printing fourcc codes. Use that one instead
> of manually formatting the pixelformat for printing.
> 
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/usb/gadget/function/uvc_v4l2.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c
> index 3f0a9795c0d4..13c7ba06f994 100644
> --- a/drivers/usb/gadget/function/uvc_v4l2.c
> +++ b/drivers/usb/gadget/function/uvc_v4l2.c
> @@ -240,16 +240,13 @@ uvc_v4l2_try_format(struct file *file, void *fh, struct v4l2_format *fmt)
>  	struct uvc_video *video = &uvc->video;
>  	struct uvcg_format *uformat;
>  	struct uvcg_frame *uframe;
> -	u8 *fcc;
>  
>  	if (fmt->type != video->queue.queue.type)
>  		return -EINVAL;
>  
> -	fcc = (u8 *)&fmt->fmt.pix.pixelformat;
> -	uvcg_dbg(&uvc->func, "Trying format 0x%08x (%c%c%c%c): %ux%u\n",
> -		fmt->fmt.pix.pixelformat,
> -		fcc[0], fcc[1], fcc[2], fcc[3],
> -		fmt->fmt.pix.width, fmt->fmt.pix.height);
> +	uvcg_dbg(&uvc->func, "Trying format %p4cc: %ux%u\n",
> +		 &fmt->fmt.pix.pixelformat,
> +		 fmt->fmt.pix.width, fmt->fmt.pix.height);
>  
>  	uformat = find_format_by_pix(uvc, fmt->fmt.pix.pixelformat);
>  	if (!uformat)
diff mbox series

Patch

diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c
index 3f0a9795c0d4..13c7ba06f994 100644
--- a/drivers/usb/gadget/function/uvc_v4l2.c
+++ b/drivers/usb/gadget/function/uvc_v4l2.c
@@ -240,16 +240,13 @@  uvc_v4l2_try_format(struct file *file, void *fh, struct v4l2_format *fmt)
 	struct uvc_video *video = &uvc->video;
 	struct uvcg_format *uformat;
 	struct uvcg_frame *uframe;
-	u8 *fcc;
 
 	if (fmt->type != video->queue.queue.type)
 		return -EINVAL;
 
-	fcc = (u8 *)&fmt->fmt.pix.pixelformat;
-	uvcg_dbg(&uvc->func, "Trying format 0x%08x (%c%c%c%c): %ux%u\n",
-		fmt->fmt.pix.pixelformat,
-		fcc[0], fcc[1], fcc[2], fcc[3],
-		fmt->fmt.pix.width, fmt->fmt.pix.height);
+	uvcg_dbg(&uvc->func, "Trying format %p4cc: %ux%u\n",
+		 &fmt->fmt.pix.pixelformat,
+		 fmt->fmt.pix.width, fmt->fmt.pix.height);
 
 	uformat = find_format_by_pix(uvc, fmt->fmt.pix.pixelformat);
 	if (!uformat)