Platform driver abstraction and architecture
Let's get warned before going further. Not all platform devices are handled by platform drivers (or, should I say, pseudo platform drivers). Platform drivers are dedicated to devices not based on conventional buses. I2C devices or SPI devices are platform devices, but rely on I2C or SPI buses, respectively, and not on platform buses. Everything needs to be done manually with the platform driver.
Probing and releasing the platform devices
The platform driver entry point is the probe method, invoked after a match with a platform device has occurred. This probe method has the following prototype:
int pdrv_probe(struct platform_device *pdev)
pdev
corresponds to the platform device that has been instantiated in the traditional way or a fresh one allocated by the platform core because of the associated device tree node having a direct parent with simple-bus
in its compatible property. Platform data and resources, if any, will...