Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Sakari Ailus and committed by
Hans Verkuil
8015a49d 8cd35cea

+12 -3
+8 -1
drivers/media/v4l2-core/v4l2-fwnode.c
··· 465 465 enum v4l2_mbus_type mbus_type; 466 466 int rval; 467 467 468 + /* 469 + * Return -EPROBE_DEFER if there's no endpoint -- in case the endpoint's 470 + * origin is a software node, it may be that the endpoint has not been 471 + * instantiated yet, but will be with probing of another driver. This is 472 + * the case with the IPU bridge; once we have no such cases left, return 473 + * another error such as -EINVAL. 474 + */ 468 475 if (!fwnode) 469 - return -EINVAL; 476 + return -EPROBE_DEFER; 470 477 471 478 pr_debug("===== begin parsing endpoint %pfw\n", fwnode); 472 479
+4 -2
include/media/v4l2-fwnode.h
··· 218 218 * 219 219 * Return: %0 on success or a negative error code on failure: 220 220 * %-ENOMEM on memory allocation failure 221 - * %-EINVAL on parsing failure, including @fwnode == NULL 221 + * %-EINVAL on parsing failure 222 222 * %-ENXIO on mismatching bus types 223 + * %-EPROBE_DEFER on NULL @fwnode 223 224 */ 224 225 int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode, 225 226 struct v4l2_fwnode_endpoint *vep); ··· 277 276 * 278 277 * Return: %0 on success or a negative error code on failure: 279 278 * %-ENOMEM on memory allocation failure 280 - * %-EINVAL on parsing failure, including @fwnode == NULL 279 + * %-EINVAL on parsing failure 281 280 * %-ENXIO on mismatching bus types 281 + * %-EPROBE_DEFER on NULL @fwnode 282 282 */ 283 283 int v4l2_fwnode_endpoint_alloc_parse(struct fwnode_handle *fwnode, 284 284 struct v4l2_fwnode_endpoint *vep);