Skip to content

Commit

Permalink
media: v4l: async: use the v4l2_dev from the root notifier when match…
Browse files Browse the repository at this point in the history
…ing 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: 2cab00b ("media: v4l: async: Allow binding notifiers to sub-devices")

Signed-off-by: Niklas Söderlund <[email protected]>
Signed-off-by: Sakari Ailus <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
Niklas Söderlund authored and mchehab committed Nov 30, 2017
1 parent 3bf3938 commit 487cc85
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/media/v4l2-core/v4l2-async.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,7 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
if (!asd)
continue;

ret = v4l2_async_match_notify(notifier, notifier->v4l2_dev, sd,
asd);
ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
if (ret)
goto err_unbind;

Expand Down

0 comments on commit 487cc85

Please sign in to comment.