mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: Jai Luthra <jai.luthra@ideasonboard.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Tomasz Figa <tfiga@chromium.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Naushir Patuck <naush@raspberrypi.com>,
	Stefan Wahren <wahrenst@gmx.net>,
	Paul Elder <paul.elder@ideasonboard.com>,
	linux-media@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 01/10] media: videobuf2-core: Move type check out of vb2_core_expbuf()
Date: Thu, 5 Nov 2026 13:09:31 +0100	[thread overview]
Message-ID: <b2a906ae-6744-4778-a897-f690f111416a@kernel.org> (raw)
In-Reply-To: <20260917-b4-vchiq-isp-v5-1-2d8870add2c0@ideasonboard.com>

On 9/17/26 10:23, Jai Luthra wrote:
> vb2_core_expbuf() takes the type of the exportbuffer as an argument and
> checks if it matches the type of the vb2 queue. Move that check to the
> caller (vb2_expbuf).
> 
> There is only one other user of this, which is dvb-core, where the check
> was anyway redundant as it passed the vb2 queue type instead. So update
> it too.
> 
> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Link: https://lore.kernel.org/all/20260910150454.GP1892234%40killaraus.ideasonboard.com


Reviewed-by: Hans Verkuil <hverkuil+cisco@kernel.org>

Regards,

	Hans

> ---
> Changes in v4:
> - New patch in v4
> ---
>  drivers/media/common/videobuf2/videobuf2-core.c | 9 ++-------
>  drivers/media/common/videobuf2/videobuf2-v4l2.c | 8 ++++++--
>  drivers/media/dvb-core/dvb_vb2.c                | 3 +--
>  include/media/videobuf2-core.h                  | 5 ++---
>  4 files changed, 11 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
> index b0a6084f1757..5e318165659f 100644
> --- a/drivers/media/common/videobuf2/videobuf2-core.c
> +++ b/drivers/media/common/videobuf2/videobuf2-core.c
> @@ -2419,8 +2419,8 @@ static int __find_plane_by_offset(struct vb2_queue *q, unsigned long offset,
>  	return 0;
>  }
>  
> -int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsigned int type,
> -		    struct vb2_buffer *vb, unsigned int plane, unsigned int flags)
> +int vb2_core_expbuf(struct vb2_queue *q, int *fd, struct vb2_buffer *vb,
> +		    unsigned int plane, unsigned int flags)
>  {
>  	struct vb2_plane *vb_plane;
>  	int ret;
> @@ -2441,11 +2441,6 @@ int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsigned int type,
>  		return -EINVAL;
>  	}
>  
> -	if (type != q->type) {
> -		dprintk(q, 1, "invalid buffer type\n");
> -		return -EINVAL;
> -	}
> -
>  	if (plane >= vb->num_planes) {
>  		dprintk(q, 1, "buffer plane out of range\n");
>  		return -EINVAL;
> diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
> index 5a1ee5eb9c0f..aee1a9244a7b 100644
> --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
> +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
> @@ -877,14 +877,18 @@ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb)
>  {
>  	struct vb2_buffer *vb;
>  
> +	if (eb->type != q->type) {
> +		dprintk(q, 1, "invalid buffer type\n");
> +		return -EINVAL;
> +	}
> +
>  	vb = vb2_get_buffer(q, eb->index);
>  	if (!vb) {
>  		dprintk(q, 1, "can't find the requested buffer %u\n", eb->index);
>  		return -EINVAL;
>  	}
>  
> -	return vb2_core_expbuf(q, &eb->fd, eb->type, vb,
> -				eb->plane, eb->flags);
> +	return vb2_core_expbuf(q, &eb->fd, vb, eb->plane, eb->flags);
>  }
>  EXPORT_SYMBOL_GPL(vb2_expbuf);
>  
> diff --git a/drivers/media/dvb-core/dvb_vb2.c b/drivers/media/dvb-core/dvb_vb2.c
> index 672b0efdca21..fe7a6554b30e 100644
> --- a/drivers/media/dvb-core/dvb_vb2.c
> +++ b/drivers/media/dvb-core/dvb_vb2.c
> @@ -357,8 +357,7 @@ int dvb_vb2_expbuf(struct dvb_vb2_ctx *ctx, struct dmx_exportbuffer *exp)
>  		return -EINVAL;
>  	}
>  
> -	ret = vb2_core_expbuf(&ctx->vb_q, &exp->fd, q->type, vb2,
> -			      0, exp->flags);
> +	ret = vb2_core_expbuf(&ctx->vb_q, &exp->fd, vb2, 0, exp->flags);
>  	if (ret) {
>  		dprintk(1, "[%s] index=%d errno=%d\n", ctx->name,
>  			exp->index, ret);
> diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
> index 4b4f4c15c53a..feda638d0064 100644
> --- a/include/media/videobuf2-core.h
> +++ b/include/media/videobuf2-core.h
> @@ -959,7 +959,6 @@ int vb2_core_streamoff(struct vb2_queue *q, unsigned int type);
>   * @q:		pointer to &struct vb2_queue with videobuf2 queue.
>   * @fd:		pointer to the file descriptor associated with DMABUF
>   *		(set by driver).
> - * @type:	buffer type.
>   * @vb:		pointer to struct &vb2_buffer.
>   * @plane:	index of the plane to be exported, 0 for single plane queues
>   * @flags:	file flags for newly created file, as defined at
> @@ -973,8 +972,8 @@ int vb2_core_streamoff(struct vb2_queue *q, unsigned int type);
>   *
>   * Return: returns zero on success; an error code otherwise.
>   */
> -int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsigned int type,
> -		    struct vb2_buffer *vb, unsigned int plane, unsigned int flags);
> +int vb2_core_expbuf(struct vb2_queue *q, int *fd, struct vb2_buffer *vb,
> +		    unsigned int plane, unsigned int flags);
>  
>  /**
>   * vb2_core_queue_init() - initialize a videobuf2 queue
> 


  parent reply	other threads:[~2026-11-05 12:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  8:23 [PATCH v5 00/10] media: Add support for Broadcom/RPi BCM2835 ISP Jai Luthra
2026-09-17  8:23 ` [PATCH v5 01/10] media: videobuf2-core: Move type check out of vb2_core_expbuf() Jai Luthra
2026-10-02 10:56   ` Paul Elder
2026-11-04 11:49   ` Jai Luthra
2026-11-05 12:09   ` Hans Verkuil [this message]
2026-09-17  8:23 ` [PATCH v5 02/10] platform/raspberrypi: vchiq-mmal: Include missing headers Jai Luthra
2026-09-17  8:23 ` [PATCH v5 03/10] platform/raspberrypi: vchiq-mmal: Move headers to include/linux Jai Luthra
2026-09-17  8:23 ` [PATCH v5 04/10] platform/raspberrypi: vchiq-mmal: Support ISP parameters and stats Jai Luthra
2026-09-17  8:23 ` [PATCH v5 05/10] platform/raspberrypi: vchiq-mmal: Support bayer and gray formats Jai Luthra
2026-10-02 10:33   ` Paul Elder
2026-09-17  8:23 ` [PATCH v5 06/10] platform/raspberrypi: vchiq: Add helpers for vchiq driver data Jai Luthra
2026-09-17  8:23 ` [PATCH v5 07/10] media: videobuf2: Allow exporting of a struct dmabuf Jai Luthra
2026-11-05 12:13   ` Hans Verkuil
2026-09-17  8:23 ` [PATCH v5 08/10] media: platform: broadcom: Move unicam driver to subdir Jai Luthra
2026-09-17  8:23 ` [PATCH v5 09/10] media: platform: broadcom: Add bcm2835-isp driver Jai Luthra
2026-10-02 10:52   ` Paul Elder
2026-09-17  8:23 ` [PATCH v5 10/10] platform/raspberrypi: vchiq: Load bcm2835_isp driver from vchiq Jai Luthra
2026-10-05 16:13 ` [PATCH v5 00/10] media: Add support for Broadcom/RPi BCM2835 ISP Dave Stevenson

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=b2a906ae-6744-4778-a897-f690f111416a@kernel.org \
    --to=hverkuil+cisco@kernel.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=jai.luthra@ideasonboard.com \
    --cc=kernel-list@raspberrypi.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=naush@raspberrypi.com \
    --cc=paul.elder@ideasonboard.com \
    --cc=tfiga@chromium.org \
    --cc=wahrenst@gmx.net \
    /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

all inboxes | Powered by JetHome®