Discussion:
from WHERE platform driver's probe is called?
Sunil Shahu
2014-11-21 13:16:21 UTC
Permalink
Hello,
I am looking into platform driver and devices and understood HOW platform driver's probe is called from kernel doc and following forum.http://comments.gmane.org/gmane.linux.kernel.kernelnewbies/37050

For further information I went through code in platform_driver_register() and got lost. I looked web but could not find substantiation information.

I am still not able to locate from WHERE this probe function is called and WHO calls it?Can someone please point to source code or some other document related to this?
Thanks,Sunil.
Sudip Mukherjee
2014-11-21 13:42:14 UTC
Permalink
Post by Sunil Shahu
Hello,
I am looking into platform driver and devices and understood HOW platform
driver's probe is called from kernel doc and following forum.
http://comments.gmane.org/gmane.linux.kernel.kernelnewbies/37050
For further information I went through code in platform_driver_register()
and got lost. I looked web but could not find substantiation information.
I am still not able to locate from WHERE this probe function is called and
WHO calls it?
Can someone please point to source code or some other document related to
this?
i am also not exactly sure, but i think the individual drivers probe
function is called from platform_drv_probe() of platform.c

thanks
sudip
Post by Sunil Shahu
Thanks,
Sunil.
_______________________________________________
Kernelnewbies mailing list
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Daniel Baluta
2014-11-21 14:06:37 UTC
Permalink
Post by Sunil Shahu
Hello,
I am looking into platform driver and devices and understood HOW platform
driver's probe is called from kernel doc and following forum.
http://comments.gmane.org/gmane.linux.kernel.kernelnewbies/37050
For further information I went through code in platform_driver_register()
and got lost. I looked web but could not find substantiation information.
I am still not able to locate from WHERE this probe function is called and
WHO calls it?
Can someone please point to source code or some other document related to
this?
Does dump_stack() help?

Daniel.
Varka Bhadram
2014-11-21 14:11:15 UTC
Permalink
This link can answer your ques:
http://stackoverflow.com/questions/22722520/who-calls-probe-function-in-driver-code

Thanks.
Post by Sunil Shahu
Hello,
I am looking into platform driver and devices and understood HOW platform
driver's probe is called from kernel doc and following forum.
http://comments.gmane.org/gmane.linux.kernel.kernelnewbies/37050
For further information I went through code in platform_driver_register()
and got lost. I looked web but could not find substantiation information.
I am still not able to locate from WHERE this probe function is called and
WHO calls it?
Can someone please point to source code or some other document related to
this?
Thanks,
Sunil.
_______________________________________________
Kernelnewbies mailing list
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Greg KH
2014-11-21 14:29:04 UTC
Permalink
Post by Sunil Shahu
Hello,
I am looking into platform driver and devices and understood HOW platform
driver's probe is called from kernel doc and following forum.
http://comments.gmane.org/gmane.linux.kernel.kernelnewbies/37050
For further information I went through code in platform_driver_register() and
got lost. I looked web but could not find substantiation information.
I am still not able to locate from WHERE this probe function is called and WHO
calls it?
It all starts by your own driver, you end up calling it yourself,
through the driver core callbacks.
Post by Sunil Shahu
Can someone please point to source code or some other document related to this?
Can you please provide a specific example of what you are wanting to see
the callback chain for? What driver are you asking about? Have you
read the platform code in drivers/base/ ?

thanks,

greg k-h
subin gangadharan
2014-11-22 03:26:51 UTC
Permalink
Hi Sunil,
Post by Sunil Shahu
I am still not able to locate from WHERE this probe function is called and WHO calls it?
I can try to give you a snapshot of the function call trace. But if
you really want to get in depth detail, as Greg said look at the code
driver/base.

driver_register
->bus_add_driver->driver_attach->__driver_attach->driver_probe_device->really_probe->drv->probe

Basically when you register your platform driver, the platform
bus(platform_bus_type) will scan for the matching device. If you look
at the platform_bus_type structure you can find the match function
which does the matching of driver and device. Once it's found the
right device, it will attach the driver to the device.Look at the
function driver_attach. And if you look at the
platform_driver_register function, you can see that
"platform_drv_probe" function is assigned to driver.probe function.
And this probe function will finally call your registered platform
driver probe function.

Hope this helps.
subin gangadharan
2014-12-02 18:33:02 UTC
Permalink
Hi Daniel,
Thanks, dump_stack() is what I needed.
Hi Subin,
Thanks for the snapshot.
Also, I am attaching a graph for what I understood after following
dump_stack().
Please let me know if there is any issue with the flow.
Thanks,
Sunil.
On Saturday, 22 November 2014 9:04 AM, subin gangadharan
Hi Sunil,
Post by Sunil Shahu
I am still not able to locate from WHERE this probe function is called and WHO calls it?
I can try to give you a snapshot of the function call trace. But if
you really want to get in depth detail, as Greg said look at the code
driver/base.
driver_register
->bus_add_driver->driver_attach->__driver_attach->driver_probe_device->really_probe->drv->probe
Basically when you register your platform driver, the platform
bus(platform_bus_type) will scan for the matching device. If you look
at the platform_bus_type structure you can find the match function
which does the matching of driver and device. Once it's found the
right device, it will attach the driver to the device.Look at the
function driver_attach. And if you look at the
platform_driver_register function, you can see that
"platform_drv_probe" function is assigned to driver.probe function.
And this probe function will finally call your registered platform
driver probe function.
Hope this helps.
_______________________________________________
Kernelnewbies mailing list
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Hi Sunil,

Thanks for the nice detailed snap shot.

Subin

Aruna Hewapathirane
2014-11-22 16:40:25 UTC
Permalink
Post by Sunil Shahu
Post by Sunil Shahu
I am looking into platform driver and devices and understood HOW platform
driver's probe is called from kernel doc and >>following forum.
Post by Sunil Shahu
Post by Sunil Shahu
Post by Sunil Shahu
http://comments.gmane.org/gmane.linux.kernel.kernelnewbies/37050
<http://comments.gmane.org/gmane.linux.kernel.kernelnewbies/37050>

I would ask *what* is platform device driver ? and what is the *difference*
between a platform device driver and a normal device driver ?

The answer here explains it extremely well :
http://stackoverflow.com/questions/15610570/what-is-the-difference-between-platform-driver-and-normal-device-driver
Post by Sunil Shahu
Post by Sunil Shahu
For further information I went through code in platform_driver_register()
and got lost. I looked web but could not find
Post by Sunil Shahu
Post by Sunil Shahu
substantiation information.
This will help:
http://code.woboq.org/linux/linux/drivers/base/platform.c.html#platform_driver_probe
Post by Sunil Shahu
Post by Sunil Shahu
I am still not able to locate from WHERE this probe function is called
and WHO calls it?
Post by Sunil Shahu
Post by Sunil Shahu
Can someone please point to source code or some other document related to
this?

Review this article carefully:
https://coherentmusings.wordpress.com/2013/12/13/how-to-write-a-platform-devicedriver-adc-driver-using-wm97xx-codec/

Have fun :)

Aruna
Post by Sunil Shahu
Hello,
I am looking into platform driver and devices and understood HOW platform
driver's probe is called from kernel doc and following forum.
http://comments.gmane.org/gmane.linux.kernel.kernelnewbies/37050
For further information I went through code in platform_driver_register()
and got lost. I looked web but could not find substantiation information.
I am still not able to locate from WHERE this probe function is called and
WHO calls it?
Can someone please point to source code or some other document related to
this?
Thanks,
Sunil.
_______________________________________________
Kernelnewbies mailing list
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Loading...