public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/1] media: v4l2-fwnode: Return -EPROBE_DEFER on parsing NULL endpoints
@ 2026-03-06 16:20 Sakari Ailus
  2026-03-06 22:05 ` Frank Li
  0 siblings, 1 reply; 2+ messages in thread
From: Sakari Ailus @ 2026-03-06 16:20 UTC (permalink / raw)
  To: linux-media
  Cc: jacopo.mondi, niklas.soderlund+renesas, antti.laakso, Frank Li

In general drivers get their firmware graph endpoints from system
firmware, but on some systems this information is conveyed to drivers via
software nodes. The software nodes may be instantiated only after the
drivers are first probed, requiring drivers to explicitly issue
-EPROBE_DEFER when endpoints aren't found.

Instead of doing this in all (or at least most) drivers, make v4l2-fwnode
endpoint parsing functions v4l2_fwnode_endpoint_parse() and
v4l2_fwnode_endpoint_alloc_parse() return -EPROBE_DEFER when an endpoint
is NULL.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
since v2:

- Fix documentation

 drivers/media/v4l2-core/v4l2-fwnode.c | 2 +-
 include/media/v4l2-fwnode.h           | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
index 03daa8c4ff7a..36b0495351cb 100644
--- a/drivers/media/v4l2-core/v4l2-fwnode.c
+++ b/drivers/media/v4l2-core/v4l2-fwnode.c
@@ -466,7 +466,7 @@ static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
 	int rval;
 
 	if (!fwnode)
-		return -EINVAL;
+		return -EPROBE_DEFER;
 
 	pr_debug("===== begin parsing endpoint %pfw\n", fwnode);
 
diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h
index cd82e70ccbaa..d7abbd76a421 100644
--- a/include/media/v4l2-fwnode.h
+++ b/include/media/v4l2-fwnode.h
@@ -218,8 +218,9 @@ enum v4l2_fwnode_bus_type {
  *
  * Return: %0 on success or a negative error code on failure:
  *	   %-ENOMEM on memory allocation failure
- *	   %-EINVAL on parsing failure, including @fwnode == NULL
+ *	   %-EINVAL on parsing failure
  *	   %-ENXIO on mismatching bus types
+ *	   %-EPROBE_DEFER on NULL @fwnode
  */
 int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
 			       struct v4l2_fwnode_endpoint *vep);
@@ -276,8 +277,9 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep);
  *
  * Return: %0 on success or a negative error code on failure:
  *	   %-ENOMEM on memory allocation failure
- *	   %-EINVAL on parsing failure, including @fwnode == NULL
+ *	   %-EINVAL on parsing failure
  *	   %-ENXIO on mismatching bus types
+ *	   %-EPROBE_DEFER on NULL @fwnode
  */
 int v4l2_fwnode_endpoint_alloc_parse(struct fwnode_handle *fwnode,
 				     struct v4l2_fwnode_endpoint *vep);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3 1/1] media: v4l2-fwnode: Return -EPROBE_DEFER on parsing NULL endpoints
  2026-03-06 16:20 [PATCH v3 1/1] media: v4l2-fwnode: Return -EPROBE_DEFER on parsing NULL endpoints Sakari Ailus
@ 2026-03-06 22:05 ` Frank Li
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Li @ 2026-03-06 22:05 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: linux-media, jacopo.mondi, niklas.soderlund+renesas, antti.laakso

On Fri, Mar 06, 2026 at 06:20:09PM +0200, Sakari Ailus wrote:
> In general drivers get their firmware graph endpoints from system
> firmware, but on some systems this information is conveyed to drivers via
> software nodes. The software nodes may be instantiated only after the
> drivers are first probed, requiring drivers to explicitly issue
> -EPROBE_DEFER when endpoints aren't found.
>
> Instead of doing this in all (or at least most) drivers, make v4l2-fwnode
> endpoint parsing functions v4l2_fwnode_endpoint_parse() and
> v4l2_fwnode_endpoint_alloc_parse() return -EPROBE_DEFER when an endpoint
> is NULL.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> since v2:
>
> - Fix documentation
>
>  drivers/media/v4l2-core/v4l2-fwnode.c | 2 +-
>  include/media/v4l2-fwnode.h           | 6 ++++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
> index 03daa8c4ff7a..36b0495351cb 100644
> --- a/drivers/media/v4l2-core/v4l2-fwnode.c
> +++ b/drivers/media/v4l2-core/v4l2-fwnode.c
> @@ -466,7 +466,7 @@ static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
>  	int rval;
>
>  	if (!fwnode)
> -		return -EINVAL;
> +		return -EPROBE_DEFER;
>
>  	pr_debug("===== begin parsing endpoint %pfw\n", fwnode);
>
> diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h
> index cd82e70ccbaa..d7abbd76a421 100644
> --- a/include/media/v4l2-fwnode.h
> +++ b/include/media/v4l2-fwnode.h
> @@ -218,8 +218,9 @@ enum v4l2_fwnode_bus_type {
>   *
>   * Return: %0 on success or a negative error code on failure:
>   *	   %-ENOMEM on memory allocation failure
> - *	   %-EINVAL on parsing failure, including @fwnode == NULL
> + *	   %-EINVAL on parsing failure
>   *	   %-ENXIO on mismatching bus types
> + *	   %-EPROBE_DEFER on NULL @fwnode
>   */
>  int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
>  			       struct v4l2_fwnode_endpoint *vep);
> @@ -276,8 +277,9 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep);
>   *
>   * Return: %0 on success or a negative error code on failure:
>   *	   %-ENOMEM on memory allocation failure
> - *	   %-EINVAL on parsing failure, including @fwnode == NULL
> + *	   %-EINVAL on parsing failure
>   *	   %-ENXIO on mismatching bus types
> + *	   %-EPROBE_DEFER on NULL @fwnode
>   */
>  int v4l2_fwnode_endpoint_alloc_parse(struct fwnode_handle *fwnode,
>  				     struct v4l2_fwnode_endpoint *vep);
> --
> 2.47.3
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-06 22:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06 16:20 [PATCH v3 1/1] media: v4l2-fwnode: Return -EPROBE_DEFER on parsing NULL endpoints Sakari Ailus
2026-03-06 22:05 ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox