Re: [PATCH 06/13] media: platform: video-mux: Register a subdev notifier
Hi Steve, I love your patch! Yet something to improve: [auto build test ERROR on linuxtv-media/master] [also build test ERROR on v4.16-rc2 next-20180222] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Steve-Longerbeam/media-imx-Switch-to-subdev-notifiers/20180223-120401 base: git://linuxtv.org/media_tree.git master config: i386-randconfig-n0-201807 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): drivers/media//platform/video-mux.c: In function 'video_mux_async_register': >> drivers/media//platform/video-mux.c:215:10: error: implicit declaration of >> function 'kcalloc'; did you mean 'd_alloc'? >> [-Werror=implicit-function-declaration] ports = kcalloc(num_pads - 1, sizeof(*ports), GFP_KERNEL); ^~~ d_alloc >> drivers/media//platform/video-mux.c:215:8: warning: assignment makes pointer >> from integer without a cast [-Wint-conversion] ports = kcalloc(num_pads - 1, sizeof(*ports), GFP_KERNEL); ^ >> drivers/media//platform/video-mux.c:225:2: error: implicit declaration of >> function 'kfree'; did you mean 'vfree'? >> [-Werror=implicit-function-declaration] kfree(ports); ^ vfree cc1: some warnings being treated as errors vim +215 drivers/media//platform/video-mux.c 208 209 static int video_mux_async_register(struct video_mux *vmux, 210 unsigned int num_pads) 211 { 212 unsigned int i, *ports; 213 int ret; 214 > 215 ports = kcalloc(num_pads - 1, sizeof(*ports), GFP_KERNEL); 216 if (!ports) 217 return -ENOMEM; 218 for (i = 0; i < num_pads - 1; i++) 219 ports[i] = i; 220 221 ret = v4l2_async_register_fwnode_subdev( 222 >subdev, sizeof(struct v4l2_async_subdev), 223 ports, num_pads - 1, video_mux_parse_endpoint); 224 > 225 kfree(ports); 226 return ret; 227 } 228 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
[PATCH 06/13] media: platform: video-mux: Register a subdev notifier
Parse neighbor remote devices on the video muxes input ports, add them to a subdev notifier, and register the subdev notifier for the video mux, by calling v4l2_async_register_fwnode_subdev(). Signed-off-by: Steve Longerbeam--- drivers/media/platform/video-mux.c | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/video-mux.c b/drivers/media/platform/video-mux.c index ee89ad7..7996bd4 100644 --- a/drivers/media/platform/video-mux.c +++ b/drivers/media/platform/video-mux.c @@ -23,6 +23,7 @@ #include #include #include +#include #include struct video_mux { @@ -193,6 +194,38 @@ static const struct v4l2_subdev_ops video_mux_subdev_ops = { .video = _mux_subdev_video_ops, }; +static int video_mux_parse_endpoint(struct device *dev, + struct v4l2_fwnode_endpoint *vep, + struct v4l2_async_subdev *asd) +{ + /* +* it's not an error if remote is missing on a video-mux +* input port, return -ENOTCONN to skip this endpoint with +* no error. +*/ + return fwnode_device_is_available(asd->match.fwnode) ? 0 : -ENOTCONN; +} + +static int video_mux_async_register(struct video_mux *vmux, + unsigned int num_pads) +{ + unsigned int i, *ports; + int ret; + + ports = kcalloc(num_pads - 1, sizeof(*ports), GFP_KERNEL); + if (!ports) + return -ENOMEM; + for (i = 0; i < num_pads - 1; i++) + ports[i] = i; + + ret = v4l2_async_register_fwnode_subdev( + >subdev, sizeof(struct v4l2_async_subdev), + ports, num_pads - 1, video_mux_parse_endpoint); + + kfree(ports); + return ret; +} + static int video_mux_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -258,7 +291,7 @@ static int video_mux_probe(struct platform_device *pdev) vmux->subdev.entity.ops = _mux_ops; - return v4l2_async_register_subdev(>subdev); + return video_mux_async_register(vmux, num_pads); } static int video_mux_remove(struct platform_device *pdev) -- 2.7.4