From mboxrd@z Thu Jan 1 00:00:00 1970 From: martinez.javier@gmail.com (Javier Martinez Canillas) Date: Wed, 18 Apr 2012 13:01:41 +0200 Subject: How does the driver initialize corresponding with several same devices ? In-Reply-To: References: Message-ID: To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Wed, Apr 18, 2012 at 12:59 PM, Javier Martinez Canillas wrote: > On Wed, Apr 18, 2012 at 11:16 AM, Li Haifeng 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. > Sorry, didn't understand your question. Forget about my answer and sorry for the noise :) Regards, -- Javier Mart?nez Canillas (+34) 682 39 81 69 Barcelona, Spain