How does the driver initialize corresponding with several same devices ?

Javier Martinez Canillas martinez.javier at gmail.com
Wed Apr 18 07:01:41 EDT 2012


On Wed, Apr 18, 2012 at 12:59 PM, Javier Martinez Canillas
<martinez.javier at gmail.com> wrote:
> On Wed, Apr 18, 2012 at 11:16 AM, Li Haifeng <omycle at gmail.com> 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



More information about the Kernelnewbies mailing list