irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END and IRQCHIP_MATCH helper macros
[linux-2.6-microblaze.git] / include / linux / irqchip.h
index 447f228..8e754d8 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <linux/acpi.h>
 #include <linux/of.h>
+#include <linux/platform_device.h>
 
 /*
  * This macro must be used by the different irqchip drivers to declare
  */
 #define IRQCHIP_DECLARE(name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn)
 
+extern int platform_irqchip_probe(struct platform_device *pdev);
+
+#define IRQCHIP_PLATFORM_DRIVER_BEGIN(drv_name) \
+static const struct of_device_id drv_name##_irqchip_match_table[] = {
+
+#define IRQCHIP_MATCH(compat, fn) { .compatible = compat, .data = fn },
+
+#define IRQCHIP_PLATFORM_DRIVER_END(drv_name)                          \
+       {},                                                             \
+};                                                                     \
+MODULE_DEVICE_TABLE(of, drv_name##_irqchip_match_table);               \
+static struct platform_driver drv_name##_driver = {            \
+       .probe  = platform_irqchip_probe,                               \
+       .driver = {                                                     \
+               .name = #drv_name,                                      \
+               .owner = THIS_MODULE,                                   \
+               .of_match_table = drv_name##_irqchip_match_table,       \
+               .suppress_bind_attrs = true,                            \
+       },                                                              \
+};                                                                     \
+builtin_platform_driver(drv_name##_driver)
+
 /*
  * This macro must be used by the different irqchip drivers to declare
  * the association between their version and their initialization function.