media: v4l2-fwnode: Return -EPROBE_DEFER on parsing NULL endpoints
Subsystems (2)
Sakari Ailus
maintainerPATCH v2 1/1 media: v4l2-fwnode: Return -EPROBE_DEFER on parsing NULL endpoints
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.
---
since v1:
- Only check for NULL.
- Fix the condition.
drivers/media/v4l2-core/v4l2-fwnode.c | 2 +- include/media/v4l2-fwnode.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/media/v4l2-core/v4l2-fwnode.c +1 -1
@@ -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);
include/media/v4l2-fwnode.h +4 -2
@@ -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 or error @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 or error @fwnode */ int v4l2_fwnode_endpoint_alloc_parse (struct fwnode_handle *fwnode,struct v4l2_fwnode_endpoint *vep);
Signature · 1 line
2.47.3
Quoted 41 lines · Sakari Ailus
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()andv4l2_fwnode_endpoint_alloc_parse()return -EPROBE_DEFER when an endpoint is NULL.Signed-off-by Sakari Ailus <[email protected]>---
since v1:- Only check for NULL.
- Fix the condition.
drivers/media/v4l2-core/v4l2-fwnode.c | 2 +- include/media/v4l2-fwnode.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/media/v4l2-core/v4l2-fwnode.c +1
-1@@ -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);include/media/v4l2-fwnode.h +0
-0
include/media/v4l2-fwnode.h enum v4l2_fwnode_bus_type { · line 223
Quoted 7 lines
include/media/v4l2-fwnode.h +2
-1@@ -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 or error @fwnode
code only check fwnode is NULL.
Frank
Quoted 17 lines
include/media/v4l2-fwnode.h +2
-2*/ 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 or error @fwnode */ int v4l2_fwnode_endpoint_alloc_parse (struct fwnode_handle *fwnode,struct v4l2_fwnode_endpoint *vep); --2.47.3
Sakari Ailus
maintainerHi Frank,
Thanks for the review.
Quoted 37 lines · Frank Li
Quoted 36 lines · Sakari Ailus
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()andv4l2_fwnode_endpoint_alloc_parse()return -EPROBE_DEFER when an endpoint is NULL.Signed-off-by Sakari Ailus <[email protected]>---
since v1:- Only check for NULL.
- Fix the condition.
drivers/media/v4l2-core/v4l2-fwnode.c | 2 +- include/media/v4l2-fwnode.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/media/v4l2-core/v4l2-fwnode.c +1
-1@@ -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);
Quoted 14 lines
include/media/v4l2-fwnode.h enum v4l2_fwnode_bus_type { · line 223
Quoted 12 lines
include/media/v4l2-fwnode.h +2
-1@@ -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 or error @fwnode code only check fwnode is NULL.
Ah, yes. I'll fix this, too, for v3.
Quoted 17 lines
Frank
Quoted 14 lines
include/media/v4l2-fwnode.h +2
-1*/ 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 or error @fwnode */ int v4l2_fwnode_endpoint_alloc_parse (struct fwnode_handle *fwnode,struct v4l2_fwnode_endpoint *vep);
Signature · 3 lines
Kind regards, Sakari Ailus