]> www.infradead.org Git - users/dwmw2/linux.git/commit
media: v4l2-device: Link subdevices to their parent devices if available
authorTomasz Figa <tfiga@chromium.org>
Fri, 15 Dec 2017 04:32:21 +0000 (23:32 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 19:02:16 +0000 (20:02 +0100)
commit3cfbad89b2a78cc837075101ea4e42726b59a572
treea73b79a1736060373079b4d6b000e9eea02ce915
parent679aa4ffce0aa0ca965ff599b14b3abfcf220fdc
media: v4l2-device: Link subdevices to their parent devices if available

[ Upstream commit ee494cf377e142f65f202fadf0d859f8e12119fb ]

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@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/v4l2-core/v4l2-device.c