Linux Media Controller development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, tomi.valkeinen@ideasonboard.com,
	bingbu.cao@intel.com, hongju.wang@intel.com, hverkuil@xs4all.nl,
	Andrey Konovalov <andrey.konovalov@linaro.org>,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Dmitry Perchanov <dmitry.perchanov@intel.com>,
	"Ng, Khai Wen" <khai.wen.ng@intel.com>
Subject: Re: [PATCH v4 21/23] media: uapi: Allow a larger number of routes than there's room for
Date: Tue, 26 Sep 2023 00:32:02 +0300	[thread overview]
Message-ID: <20230925213202.GA12446@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230922142239.259425-22-sakari.ailus@linux.intel.com>

Hi Sakari,

Thank you for the patch.

On Fri, Sep 22, 2023 at 05:22:37PM +0300, Sakari Ailus wrote:
> On VIDIOC_SUBDEV_[GS]_ROUTING, only return as many routes back to the user
> as there's room. Do not consider it an error if more routes existed.
> Simply inform the user there are more routes.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  .../userspace-api/media/v4l/vidioc-subdev-g-routing.rst   | 4 ----
>  drivers/media/v4l2-core/v4l2-subdev.c                     | 8 ++------
>  2 files changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst b/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst
> index ced53ea5f23c..99d3c15fd759 100644
> --- a/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst
> +++ b/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst
> @@ -145,10 +145,6 @@ On success 0 is returned, on error -1 and the ``errno`` variable is set
>  appropriately. The generic error codes are described at the
>  :ref:`Generic Error Codes <gen-errors>` chapter.
>  
> -ENOSPC
> -   The application provided ``num_routes`` is not big enough to contain
> -   all the available routes the subdevice exposes.
> -
>  EINVAL
>     The sink or source pad identifiers reference a non-existing pad, or reference
>     pads of different types (ie. the sink_pad identifiers refers to a source pad).
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index 1bcc96cde6da..7871ec8a66d1 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -956,14 +956,10 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
>  
>  		krouting = &state->routing;
>  
> -		if (routing->len_routes < krouting->num_routes) {
> -			routing->num_routes = krouting->num_routes;
> -			return -ENOSPC;
> -		}
> -
>  		memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
>  		       krouting->routes,
> -		       krouting->num_routes * sizeof(*krouting->routes));
> +		       min(krouting->num_routes, krouting->len_routes) *

This should be

		       min(krouting->num_routes, routing->len_routes) *

> +		       sizeof(*krouting->routes));
>  		routing->num_routes = krouting->num_routes;
>  
>  		return 0;

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2023-09-25 21:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 14:22 [PATCH v4 00/20] Generic line based metadata support, internal pads Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 01/23] media: mc: Add INTERNAL pad flag Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 02/23] media: uapi: Add generic serial metadata mbus formats Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 03/23] media: uapi: Document which mbus format fields are valid for metadata Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 04/23] media: uapi: Add generic 8-bit metadata format definitions Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 05/23] media: v4l: Support line-based metadata capture Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 06/23] media: uapi: ccs: Add media bus code for MIPI CCS embedded data Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 07/23] media: Documentation: ccs: Document routing Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 08/23] media: Documentation: Additional streams generally don't harm capture Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 09/23] media: Documentation: Document embedded data guidelines for camera sensors Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 10/23] media: Documentation: v4l: Document source routes Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 11/23] media: Documentation: Document S_ROUTING behaviour Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 12/23] media: v4l: subdev: Add helpers for format, crop and compose pointers Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 13/23] media: ccs: Move ccs_validate_csi_data_format up Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 14/23] media: ccs: Support frame descriptors Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 15/23] media: ccs: Add support for embedded data stream Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 16/23] media: Add MIPI CSI-2 generic long packet type definition Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 17/23] media: v4l: subdev: Move G_ROUTING handling below S_ROUTING Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 18/23] media: v4l: subdev: Copy argument back to user also for S_ROUTING Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 19/23] media: v4l: subdev: Add len_routes field to struct v4l2_subdev_routing Sakari Ailus
2023-09-25 21:01   ` Laurent Pinchart
2023-09-25 21:34     ` Laurent Pinchart
2023-09-26  5:56       ` Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 20/23] media: v4l: subdev: Return routes set using S_ROUTING Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 21/23] media: uapi: Allow a larger number of routes than there's room for Sakari Ailus
2023-09-25 21:32   ` Laurent Pinchart [this message]
2023-09-26  5:56     ` Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 22/23] media: v4l: subdev: Add trivial set_routing support Sakari Ailus
2023-09-22 14:22 ` [PATCH v4 23/23] media: uapi: v4l: subdev: Enable streams API Sakari Ailus

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=20230925213202.GA12446@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=andrey.konovalov@linaro.org \
    --cc=bingbu.cao@intel.com \
    --cc=dmitry.perchanov@intel.com \
    --cc=hongju.wang@intel.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=khai.wen.ng@intel.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    /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