From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Jai Luthra <jai.luthra@ideasonboard.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Tomasz Figa <tfiga@chromium.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Hans Verkuil <hans@jjverkuil.nl>,
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,
Hans Verkuil <hverkuil+cisco@kernel.org>
Subject: Re: [PATCH v7 1/5] media: videobuf2-core: Move type check out of vb2_core_expbuf()
Date: Thu, 19 Nov 2026 12:46:47 +0100 [thread overview]
Message-ID: <84e33f9f-6af3-4416-baeb-118874858edb@samsung.com> (raw)
In-Reply-To: <20261118-b4-vchiq-isp-v7-1-b8c81d193abf@ideasonboard.com>
On 18.11.2026 19:08, 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.
>
> 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>
> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> Tested-by: Paul Elder <paul.elder@ideasonboard.com>
> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> 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
>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
next prev parent reply other threads:[~2026-11-19 11:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 18:08 [PATCH v7 0/5] media: Add support for Broadcom/RPi BCM2835 ISP Jai Luthra
2026-11-18 18:08 ` [PATCH v7 1/5] media: videobuf2-core: Move type check out of vb2_core_expbuf() Jai Luthra
2026-11-19 11:46 ` Marek Szyprowski [this message]
2026-11-18 18:08 ` [PATCH v7 2/5] media: videobuf2: Allow exporting of a struct dmabuf Jai Luthra
2026-11-19 11:48 ` Marek Szyprowski
2026-11-18 18:08 ` [PATCH v7 3/5] media: platform: broadcom: Move unicam driver to subdir Jai Luthra
2026-11-18 18:08 ` [PATCH v7 4/5] media: platform: broadcom: Add bcm2835-isp driver Jai Luthra
2026-11-19 12:55 ` Laurent Pinchart
2026-11-18 18:08 ` [PATCH v7 5/5] platform/raspberrypi: vchiq: Load bcm2835_isp driver from vchiq Jai Luthra
2026-11-19 12:11 ` [PATCH v7 0/5] media: Add support for Broadcom/RPi BCM2835 ISP Sakari Ailus
2026-11-19 13:00 ` Laurent Pinchart
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=84e33f9f-6af3-4416-baeb-118874858edb@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=florian.fainelli@broadcom.com \
--cc=hans@jjverkuil.nl \
--cc=hverkuil+cisco@kernel.org \
--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=mchehab@kernel.org \
--cc=naush@raspberrypi.com \
--cc=paul.elder@ideasonboard.com \
--cc=sakari.ailus@linux.intel.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®