How does the driver initialize corresponding with several same devices ?

anish singh anish198519851985 at gmail.com
Wed Apr 18 07:11:19 EDT 2012


On Wed, Apr 18, 2012 at 4:37 PM, Philipp Ittershagen
<p.ittershagen at googlemail.com> wrote:
> On Wed, Apr 18, 2012 at 04:32:12PM +0530, anish singh wrote:
>> On Wed, Apr 18, 2012 at 4:18 PM, Philipp Ittershagen
>> <p.ittershagen at googlemail.com> wrote:
>> > On Wed, Apr 18, 2012 at 05:16:01PM +0800, 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?
>> >
>> > It depends on what your architecture supports. If you have support for device
>> > tree, your entry in the device tree will make the subsystem call your probe
>> > function for each device it finds. You can then check the `compatible` entry
>> > of the device node and your driver is then able to register itself to the
>> > kernel subsystem.
>> Without device tree what would be your answer as i guess device
>> tree has come recently in picture but not sure.
>
> Let me rephrase your question and see if I understand it correctly. You have a
> probe function which already gets called for each device in your platform and
> you want to know how to make each device accessible in userspace (using i.e.
> devfs nodes) ?
I think he wants to know how will he differentiate different devices as probe of
the driver will be called three times for all the devices.Right?
>
> Greetings,
>
>  Philipp



More information about the Kernelnewbies mailing list