On Tue, Feb 14, 2012 at 07:05:48PM -0300, Ezequiel García wrote: > Hi, > > I noticed that after registering a video driver with > "video_register_device" the "open" function gets called. > The registration is like: > > peasycap->video_device.fops = &v4l2_fops; > peasycap->video_device.minor = -1; > peasycap->video_device.release = (void *)(&videodev_release); > > video_set_drvdata(&(peasycap->video_device), (void *)peasycap); > > First question: who calls it and why does it open the device? Userspace probably. > Second question. This is a common kernel interface, driver fills a > "fops" struct and then registers. > This means I need to be *always* prepared to get a call on "open" (or > other file operation) > immediately after driver registration? Yes, whenever you pass a structure of pointers off somewhere, you must be prepared for any of them to be called at any time, including even before that function call registering the pointers returns. thanks, greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies