When "probe" is called?

Alexandre Courbot gnurou at gmail.com
Mon Feb 7 02:51:27 EST 2011


> However, could you point me out where the kernel actually detects the
> device? Is it keep polling with the driver's name which was given at compile
> time? Or Is there other mechanism to detect the device? Basically, how the
> kernel detects those devices, which calls "probe"?

Platform devices represent devices that are usually integrated into a
given chip and therefore are always there. The platform-specific
initialization code statically initializes such arrays of platform
devices and then registers them in a row using platform_register.
Therefore there is no need for sophisticated probing. Instead, the
string contained in platform_device.name is compared
platform_driver.driver.name and a match is assumed if they are equal.
Have a look at the attached example file that defines and registers a
dummy platform driver for a dummy platform device. If you change the
string, the probe function will not be called anymore.

Other buses have more sophisticated detection/probing methods. For
more information about platform devices, including the places where
these functions are called, see drivers/base/platform.c. Reading
Documentation/driver-model/platform.txt is also a good idea.

Alex.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drivertest.c
Type: text/x-csrc
Size: 1167 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110207/eed40103/attachment-0001.bin 


More information about the Kernelnewbies mailing list