Using uio_pdrv for platform devices

In many cases, UIO drivers for platform devices can be handled in a generic way. In the same place where you define your struct platform_device, you simply also implement your interrupt handler and fill your struct uio_info. A pointer to this struct uio_info is then used as platform_data for your platform device.

You also need to set up an array of struct resource containing addresses and sizes of your memory mappings. This information is passed to the driver using the .resource and .num_resources elements of struct platform_device.

You now have to set the .name element of struct platform_device to "uio_pdrv" to use the generic UIO platform device driver. This driver will fill the mem[] array according to the resources given, and register the device.

The advantage of this approach is that you only have to edit a file you need to edit anyway. You do not have to create an extra driver.