Re: [RFC PATCH] media: v4l2-device: Link subdevices to their parent devices if available

From: Sakari Ailus
Date: Fri Dec 15 2017 - 04:14:55 EST


On Fri, Dec 15, 2017 at 01:32:21PM +0900, Tomasz Figa wrote:
> Currently v4l2_device_register_subdev_nodes() does not initialize the
> dev_parent field of the video_device structs it creates for subdevices
> being registered. This leads to __video_register_device() falling back
> to the parent device of associated v4l2_device struct, which often does
> not match the physical device the subdevice is registered for.
>
> Due to the problem above, the links between real devices and v4l-subdev
> nodes cannot be obtained from sysfs, which might be confusing for the
> userspace trying to identify the hardware.
>
> Fix this by initializing the dev_parent field of the video_device struct
> with the value of dev field of the v4l2_subdev struct. In case of
> subdevices without a parent struct device, the field will be NULL and the
> old behavior will be preserved by the semantics of
> __video_register_device().
>
> Signed-off-by: Tomasz Figa <tfiga@xxxxxxxxxxxx>

Acked-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>

--
Sakari Ailus
sakari.ailus@xxxxxxxxxxxxxxx