linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] v4l: async: use the v4l2_dev from the root notifier when matching sub-devices
@ 2017-11-15 15:43 Niklas Söderlund
  0 siblings, 0 replies; only message in thread
From: Niklas Söderlund @ 2017-11-15 15:43 UTC (permalink / raw)
  To: Sakari Ailus, linux-media, Laurent Pinchart
  Cc: linux-renesas-soc, Niklas Söderlund

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. Whit this fix the
adv748x can be re-bound and still function properly.

Fixes: 2cab00bb076b9f0e ("media: v4l: async: Allow binding notifiers to sub-devices")
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/v4l2-core/v4l2-async.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index a7c3464976f24361..e5acfab470a5ee6b 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -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;
 
-- 
2.15.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-15 15:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-15 15:43 [PATCH] v4l: async: use the v4l2_dev from the root notifier when matching sub-devices Niklas Söderlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).