Thank you so much with the nice example code. Now, I could understand.

Thanks!

J.

On Sun, Feb 6, 2011 at 11:51 PM, Alexandre Courbot <gnurou@gmail.com> wrote:
> 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.