In this example code, we will create a dummy platform device and register the device with the kernel. Later on, in the same driver code , we will register the driver and make the kernel invoke the “probe” function for the driver. the sample code is provided below
The dmesg output of loading and unloading of the device driver above is shown below. It can be seen that the kernel invoked the “probe” function after the driver was registered. The device was earlier registered using platform_device_register API. On unregistering the device and driver, the release and remove callbacks were invoked for the device and driver respectively.
Understanding network device drivers in Linux kernel
Pingback: Platform device drivers in the Linux Kernel | Hitch Hiker's Guide to Learning