Hans Verkuil wrote: >> The first time we run we could definitely do a 4l2_i2c_new_subdev*, but what if I rmmod the driver >> and insmod it again? When we do the do an open, then v4l2_i2c_new_subdev* would fail because the >> device is only on the bus and probed. So I would have to look for it anyway. Or am I wrong? I found >> this like the only generic way(?) > > Not sure I understand you. When you call v4l2_device_unregister any registered > i2c devices will be automatically unloaded from the i2c bus. So when you do a > new modprobe, then it is as if you did it for the first time. > > This should work. If not, then let me know and we can look at it. Thanks for the explanation! It should work, I will update accordingly. > >>> Is there a reason why you want to load them only on first use? It is customary >>> to load them when this driver is loaded. Exceptions to that may be if the i2c >>> device needs to load a firmware: this can be slow over i2c and so should be >>> postponed until the i2c driver is needed for the first time. >> The main reason is actually that this is a platform device which might come available before the I2C >> bus in the system. So we postpone the use of the bus until needed, because we know for sure it's >> available at that point. > > The i2c busses are always initialized first. That's a change that went in a few > kernel releases ago. Ok, in this case the I2C bus sits on top of a MFD device which might be installed late to reduce bootup time. Bootup time is actually also a reason to keep this code in open rather than in probe. --Richard -- 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