Linux Media Controller development
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org,
	Philipp Zabel <p.zabel@pengutronix.de>,
	kernel@pengutronix.de, linux-imx@nxp.com
Subject: Re: [PATCH v1 3/6] media: imx-pxp: Pass pixel format value to find_format()
Date: Thu, 12 Jan 2023 14:59:45 +0100	[thread overview]
Message-ID: <20230112135945.GO24101@pengutronix.de> (raw)
In-Reply-To: <20230106133227.13685-4-laurent.pinchart@ideasonboard.com>

On Fri, 06 Jan 2023 15:32:24 +0200, Laurent Pinchart wrote:
> The find_format() function looks up format information for a given pixel
> format. It takes a v4l2_format pointer, but only uses the contained
> pixel format value. To prepare it for being used by callers that don't
> have v4l2_format, modify it to take the pixel format value directly.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>

> ---
>  drivers/media/platform/nxp/imx-pxp.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c
> index 132065c8b8b4..fd4c055c01eb 100644
> --- a/drivers/media/platform/nxp/imx-pxp.c
> +++ b/drivers/media/platform/nxp/imx-pxp.c
> @@ -176,14 +176,14 @@ enum {
>  	V4L2_M2M_DST = 1,
>  };
>  
> -static struct pxp_fmt *find_format(struct v4l2_format *f)
> +static struct pxp_fmt *find_format(unsigned int pixelformat)
>  {
>  	struct pxp_fmt *fmt;
>  	unsigned int k;
>  
>  	for (k = 0; k < NUM_FORMATS; k++) {
>  		fmt = &formats[k];
> -		if (fmt->fourcc == f->fmt.pix.pixelformat)
> +		if (fmt->fourcc == pixelformat)
>  			break;
>  	}
>  
> @@ -1268,10 +1268,10 @@ static int pxp_try_fmt_vid_cap(struct file *file, void *priv,
>  	struct pxp_fmt *fmt;
>  	struct pxp_ctx *ctx = file2ctx(file);
>  
> -	fmt = find_format(f);
> +	fmt = find_format(f->fmt.pix.pixelformat);
>  	if (!fmt) {
>  		f->fmt.pix.pixelformat = formats[0].fourcc;
> -		fmt = find_format(f);
> +		fmt = find_format(f->fmt.pix.pixelformat);
>  	}
>  	if (!(fmt->types & MEM2MEM_CAPTURE)) {
>  		v4l2_err(&ctx->dev->v4l2_dev,
> @@ -1296,10 +1296,10 @@ static int pxp_try_fmt_vid_out(struct file *file, void *priv,
>  	struct pxp_fmt *fmt;
>  	struct pxp_ctx *ctx = file2ctx(file);
>  
> -	fmt = find_format(f);
> +	fmt = find_format(f->fmt.pix.pixelformat);
>  	if (!fmt) {
>  		f->fmt.pix.pixelformat = formats[0].fourcc;
> -		fmt = find_format(f);
> +		fmt = find_format(f->fmt.pix.pixelformat);
>  	}
>  	if (!(fmt->types & MEM2MEM_OUTPUT)) {
>  		v4l2_err(&ctx->dev->v4l2_dev,
> @@ -1332,7 +1332,7 @@ static int pxp_s_fmt(struct pxp_ctx *ctx, struct v4l2_format *f)
>  		return -EBUSY;
>  	}
>  
> -	q_data->fmt		= find_format(f);
> +	q_data->fmt		= find_format(f->fmt.pix.pixelformat);
>  	q_data->width		= f->fmt.pix.width;
>  	q_data->height		= f->fmt.pix.height;
>  	q_data->bytesperline	= f->fmt.pix.bytesperline;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> 

  reply	other threads:[~2023-01-12 14:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 13:32 [PATCH v1 0/6] media: imx-pxp: Miscellaneous enhancements Laurent Pinchart
2023-01-06 13:32 ` [PATCH v1 1/6] media: imx-pxp: Sort headers alphabetically Laurent Pinchart
2023-01-12 13:54   ` Michael Tretter
2023-01-06 13:32 ` [PATCH v1 2/6] media: imx-pxp: Add media controller support Laurent Pinchart
2023-01-12 13:58   ` Michael Tretter
2023-01-12 16:59     ` Laurent Pinchart
2023-01-06 13:32 ` [PATCH v1 3/6] media: imx-pxp: Pass pixel format value to find_format() Laurent Pinchart
2023-01-12 13:59   ` Michael Tretter [this message]
2023-01-06 13:32 ` [PATCH v1 4/6] media: imx-pxp: Implement frame size enumeration Laurent Pinchart
2023-01-12 14:11   ` Michael Tretter
2023-01-06 13:32 ` [PATCH v1 5/6] media: imx-pxp: Introduce pxp_read() and pxp_write() wrappers Laurent Pinchart
2023-01-06 14:50   ` Alexander Stein
2023-01-06 18:44     ` Laurent Pinchart
2023-01-12 14:14       ` Michael Tretter
2023-01-12 14:16   ` Michael Tretter
2023-01-06 13:32 ` [PATCH v1 6/6] media: imx-pxp: Use non-threaded IRQ Laurent Pinchart
2023-01-12 14:27   ` Michael Tretter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230112135945.GO24101@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-media@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox