|
|
|
Re: How does the driver initialize corresponding with several same devices ? | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Wed, Apr 18, 2012 at 11:16 AM, Li Haifeng <omycle@xxxxxxxxx> wrote: > I make a driver module and built in the kernel. There are three devices use > the same driver on the hardware platform. To use each device, the probe > function of the driver module should be probed. So, the driver module is > registered in the kernel. > > My question is, how times should the probe function of the driver be called > and create nodes in devfs to corresponding with the three devices? > Your driver probe function has to be called only once. You should have in your driver a software representation of each device and register each one with the corresponding subsystem and with the kernel kernel device model to populate /dev with your device nodes. How do you represent your devices internally is up to you, it can be assigned on your module init function as a static array or you can do it dynamically using a linked list. Look at any driver inside drivers/char for reference. Hope it helps, -- Javier Martínez Canillas (+34) 682 39 81 69 Barcelona, Spain _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
[Newbies FAQ] [Linux Kernel Development] [IETF Annouce] [Git] [Networking] [Security] [Bugtraq] [Photo] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux Networking] [Linux RAID] [Linux SCSI] [Linux ACPI]
![]() |
![]() |