We currently resolve the video pipeline on ioctl instead of at probe time. In preparation for allowing resolution at probe time, provide a helper function for resolving the video pipeline without calling the ioctl right away.
Signed-off-by: Ahmad Fatoum <a.fat...@barebox.org> --- drivers/video/vpl.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/video/vpl.c b/drivers/video/vpl.c index 6fcba0901165..0b86ef9f7e81 100644 --- a/drivers/video/vpl.c +++ b/drivers/video/vpl.c @@ -53,8 +53,9 @@ struct vpl *of_vpl_get(struct device_node *node, int port) return of_find_vpl(node); } -int vpl_ioctl(struct vpl *vpl, unsigned int port, - unsigned int cmd, void *ptr) +static int vpl_foreach_endpoint(struct vpl *vpl, unsigned int port, + int (*fn)(struct vpl *, unsigned port, void *data), + void *data) { struct device_node *node, *endpoint; int ret; @@ -96,10 +97,30 @@ int vpl_ioctl(struct vpl *vpl, unsigned int port, } pr_debug("%s: looked up %pOF: %pS\n", __func__, remote, remote_vpl->ioctl); - ret = remote_vpl->ioctl(remote_vpl, remote_port_id, cmd, ptr); + ret = fn(remote_vpl, remote_port_id, data); if (ret) return ret; } return 0; } + +struct vpl_ioctl { + unsigned cmd; + void *ptr; +}; + +static int vpl_remote_ioctl(struct vpl *vpl, unsigned port, void *_data) +{ + struct vpl_ioctl *data = _data; + + return vpl->ioctl(vpl, port, data->cmd, data->ptr); +} + +int vpl_ioctl(struct vpl *vpl, unsigned int port, + unsigned int cmd, void *ptr) +{ + struct vpl_ioctl data = { .cmd = cmd, .ptr = ptr }; + + return vpl_foreach_endpoint(vpl, port, vpl_remote_ioctl, &data); +} -- 2.39.5