From: martinez.javier@gmail.com (Javier Martinez Canillas)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How does the driver initialize corresponding with several same devices ?
Date: Wed, 18 Apr 2012 13:01:41 +0200 [thread overview]
Message-ID: <CAAwP0s0ybK7o=3vHHwayY1xn0V45PHTMuAvA2ktuKMaGEoTKbg@mail.gmail.com> (raw)
In-Reply-To: <CAAwP0s0DGMxUZRA9ckNTkE3QuPBtq66G_N=t=2abgNwLvVuo7w@mail.gmail.com>
On Wed, Apr 18, 2012 at 12:59 PM, Javier Martinez Canillas
<martinez.javier@gmail.com> wrote:
> On Wed, Apr 18, 2012 at 11:16 AM, Li Haifeng <omycle@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
prev parent reply other threads:[~2012-04-18 11:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAFNq8R4U-1c4ONn8EDZ7-ZgO2BC0r1JvsBxKsD1MeBzRndJr-w@mail.gmail.com>
[not found] ` <CAFNq8R4dF+QPvPcy5+SSOBketAdzyJfJ6WonX0Z8OHztcvsYvA@mail.gmail.com>
2012-04-18 9:16 ` How does the driver initialize corresponding with several same devices ? Li Haifeng
2012-04-18 10:48 ` Philipp Ittershagen
[not found] ` <CAK7N6vpEL21SUMWk05ODDY+JE4gMDz7A17zfZDnsfU-=Nw6hiA@mail.gmail.com>
2012-04-18 11:07 ` Philipp Ittershagen
2012-04-18 11:11 ` anish singh
2012-04-18 13:38 ` Li Haifeng
2012-04-18 10:59 ` Javier Martinez Canillas
2012-04-18 11:01 ` Javier Martinez Canillas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAAwP0s0ybK7o=3vHHwayY1xn0V45PHTMuAvA2ktuKMaGEoTKbg@mail.gmail.com' \
--to=martinez.javier@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).