Hi Sascha On Tue, 30 Apr 2013, Sascha Hauer wrote: > Hi Guennadi, > > On Fri, Apr 12, 2013 at 05:40:22PM +0200, Guennadi Liakhovetski wrote: > > Currently bridge device drivers register devices for all subdevices > > synchronously, tupically, during their probing. E.g. if an I2C CMOS sensor > > is attached to a video bridge device, the bridge driver will create an I2C > > device and wait for the respective I2C driver to probe. This makes linking > > of devices straight forward, but this approach cannot be used with > > intrinsically asynchronous and unordered device registration systems like > > the Flattened Device Tree. To support such systems this patch adds an > > asynchronous subdevice registration framework to V4L2. To use it respective > > (e.g. I2C) subdevice drivers must register themselves with the framework. > > A bridge driver on the other hand must register notification callbacks, > > that will be called upon various related events. > > > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx> > > --- > > + > > +static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier *notifier, > > + struct v4l2_async_subdev_list *asdl) > > +{ > > + struct v4l2_subdev *sd = v4l2_async_to_subdev(asdl); > > + struct v4l2_async_subdev *asd = NULL; > > + bool (*match)(struct device *, > > + struct v4l2_async_hw_info *); > > + > > + list_for_each_entry (asd, ¬ifier->waiting, list) { > > + struct v4l2_async_hw_info *hw = &asd->hw; > > + > > + /* bus_type has been verified valid before */ > > + switch (hw->bus_type) { > > + case V4L2_ASYNC_BUS_CUSTOM: > > + match = hw->match.custom.match; > > + if (!match) > > + /* Match always */ > > + return asd; > > + break; > > + case V4L2_ASYNC_BUS_PLATFORM: > > + match = match_platform; > > + break; > > + case V4L2_ASYNC_BUS_I2C: > > + match = match_i2c; > > + break; > > + default: > > + /* Cannot happen, unless someone breaks us */ > > + WARN_ON(true); > > + return NULL; > > + } > > + > > + if (match && match(sd->dev, hw)) > > + break; > > + } > > + > > + return asd; > > 'asd' can never be NULL here. You have to explicitly return NULL when > leaving the loop without match. I've already proposed a fix for this and Laurent has proposed a simplified version. Thanks Guennadi > > Sascha > > > -- > Pengutronix e.K. | | > Industrial Linux Solutions | http://www.pengutronix.de/ | > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html