device/driver binding notification | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
Hi Greg, hi Kay, In the course of finally making the i2c subsystem comply with the Linux 2.6 device driver model, I am facing an issue which affects many v4l drivers. I'm curious if the core device driver code has something to offer to solve it. Basically, a v4l driver creates an i2c bus, instantiates i2c devices on that bus, and needs i2c chip drivers for these devices. In the past, i2c devices were always bound to a driver by the time the v4l driver knew they existed, so they were directly usable. But now that we follow the device driver model, this is no longer the case. The sequence of events is as follows: 1* v4l driver creates i2c bus. 2* v4l driver declares i2c devices in that bus. At this point, the v4l driver can't be used yet. 3* Later on, the drivers for these devices in question are loaded (typically thanks to udev), and they bind to the i2c devices. 4* Now the v4l driver can complete its initialization and users can make use of the device. For now, between steps 2 and 3, I made the v4l driver sleep and repeatedly check whether i2c_client.driver is set or not. It works but it's pretty ugly. I am curious if there's a way to be notified when a driver is finally bound to a given device? That's what I would need. This also raises another question on reference counting. Ideally, the i2c chip drivers shouldn't be allowed to be removed before the v4l driver itself is (without the i2c chip drivers, the v4l drivers cannot work properly.) So I would like to increase the reference count to the i2c chip drivers when they bind to my chips, and decrease it when I quit. Should I just do a try_module_get(i2c_driver.driver.owner) at a random time and just hope for the best? Or is there a cleaner way to express that kind of dependency between drivers? Thanks, -- Jean Delvare -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[Site Home] [Other Archives] [Linux Kernel Newbies] [Linux Kernel Testers] [Linux SH] [Linux Omap] [Linux Kbuild] [Linux Tape] [Linux Input] [Linux Kernel Janitors] [Linux Doc] [Linux Man Pages] [Linux Standards] [Kernel Announce] [Memory] [Netdev] [Git] [Linux PCI] [NUMA] [Netfilter] [Netfilter Devel] [SELinux] [Bugtraq] [Writing Drivers] [Linux Serial] [Linux PPP] [Kernel MM Commits] [Linux Security Module] [Ext4] [Linux BTRFS] [Linux NFS] [Linux Cachefs] [Reiser FS] [Fastboot] [Linux RT Users] [Linux Virtualization] [LVS Devel] [KVM] [KVM PPC] [KVM ia64] [Linux Containers] [Util Linux NG] [Sk Drivers] [Wireless] [Linux Bluetooth] [Ethernet Bridging] [Embedded Linux] [Sparse] [Linux Arch] [Linux ACPI] [Linux IBM ACPI] [Linux OpenGL] [Linux Power Management] [Linux DCCP] [ALSA Devel] [Linux USB] [Large Format Photos] [DVD Store] [Tux] [Gimp] [Yosemite News] [Linux PA RISC] [MIPS Linux] [S390 Linux] [ARM Linux] [ARM Kernel] [Sparc Linux] [Linux Security] [Linux Sound] [Video 4 Linux] [Linux for the blind] [Linux IDE] [Linux RAID] [Linux SCSI] [Linux SMP] [Linux AXP] [Linux Alpha] [Linux M68K] [Linux ia64] [Linux 8086] [Linux x86_64] [Linux Apps] [Linux X.25] [Linux Crypto] [DM Crypt] [LInux Btrace] [Utrace Devel] [Yosemite Photos] [Linux Resources] [Older Kernel Mail]
![]() |
![]() |