Platform devices
Actually, we should have said pseudo platform device, since this section concerns devices that sit on pseudo platform buses. When you are done with the driver, you will have to feed the kernel with devices needing that driver. A platform device is represented in the kernel as an instance of struct platform_device
, and looks as follows:
struct platform_device { const char *name; u32 id; struct device dev; u32 num_resources; struct resource *resource; };
When it comes to the platform driver, before driver and device match, the name
field of both struct platform_device
and static struct platform_driver.driver.name
must be the same. The num_resources
and struct resource *resource
field will be covered in the next section. Just remember that, since resource
is an array, num_resources
must contain the size of that array.
Resources and platform data
At the opposite end to hot-pluggable devices, the kernel has no idea what devices are present on your system, what...