Thanks, Anish,<div><br></div><div>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"?</div>
<div><br></div><div>-J<br><br><div class="gmail_quote">On Sun, Feb 6, 2011 at 11:29 PM, anish singh <span dir="ltr"><<a href="mailto:anish198519851985@gmail.com">anish198519851985@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">Hi,<div><br></div><div>I am seeing probe function pointer and know the procedure to register of it for a specific device driver. However, I wonder when it is actually called?</div>
<div><br></div><div>For example, for platform drivers, there is a structure like this:</div>
<div><br></div><div><pre><span></span>struct platform_driver {
int (*probe)(struct platform_device *);
int (*remove)(struct platform_device *);
void (*shutdown)(struct platform_device *);
int (*suspend)(struct platform_device *, pm_message_t state);
int (*suspend_late)(struct platform_device *, pm_message_t state);
int (*resume_early)(struct platform_device *);
int (*resume)(struct platform_device *);
struct device_driver driver;
};
</pre><br>Then, it is registered by </div><pre>int platform_driver_register(struct platform_driver *drv);<br></pre>But, I wonder when actually, those functions (especially, probe) are called. Could you guide me about it, please?</blockquote>
</div></div><div>AFAIK probe is called when your device is recognized by the
platform.Generally registering the device requires the device name and
this device name is compared with the driver name(when you are
registering the driver you would be specifying the driver name,which
should match with the device name).<br>
Once the device gets detected by the kernel it will call the corresponding driver probe for that device. <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div>
<br></div><div>Thanks,</div><div><br></div><font color="#888888"><div>-J.</div>
</font><br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br>
</blockquote></div><br></div>