]> git.baikalelectronics.ru Git - kernel.git/commit
media: v4l: async: use the v4l2_dev from the root notifier when matching sub-devices
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Wed, 15 Nov 2017 15:43:58 +0000 (10:43 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 30 Nov 2017 09:44:07 +0000 (04:44 -0500)
commitbccd050f52f4da8e5290bd681416449a7aca74fd
tree9b036848e1ec3fc90dda8e945bfc8566d4049acb
parent7629e31f18d4519c5600c220ac1493f8b70616af
media: v4l: async: use the v4l2_dev from the root notifier when matching sub-devices

When matching and registering a sub-device from a sub-notifier use the
v4l2_device from the root parent notifier. Using the v4l2_dev stored in
the sub-notifier itself is incorrect as it might not be set.

This can be demonstrated by unbinding and rebinding the adv748x driver
and observing that it fails to probe due to the check !v4l2_dev in
v4l2_device_register_subdev().

    # echo 4-0070 > /sys/bus/i2c/drivers/adv748x/unbind
    # echo 4-0070 > /sys/bus/i2c/drivers/adv748x/bind
    adv748x 4-0070: chip found @ 0xe0 revision 2143
    adv748x 4-0070: Failed to probe TXA
    adv748x: probe of 4-0070 failed with error -22

Looking at the commit which adds sub-notifiers to V4L2 it looks like
this is the intended behavior of the original commit. With this fix the
adv748x can be re-bound and still function properly.

Fixes: f59ecdc6522ce201 ("media: v4l: async: Allow binding notifiers to sub-devices")
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/v4l2-core/v4l2-async.c