mfd: Use device_get_match_data() in a bunch of drivers
[linux-2.6-block.git] / drivers / mfd / axp20x.c
index d93189b0230de64532ae2ede7eb115547b8f5f9b..deaa969bab4e1919f5c0033df5afd919fb271c9c 100644 (file)
@@ -22,7 +22,8 @@
 #include <linux/mfd/axp20x.h>
 #include <linux/mfd/core.h>
 #include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/property.h>
 #include <linux/reboot.h>
 #include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
@@ -1131,27 +1132,10 @@ static int axp20x_power_off(struct sys_off_data *data)
 int axp20x_match_device(struct axp20x_dev *axp20x)
 {
        struct device *dev = axp20x->dev;
-       const struct acpi_device_id *acpi_id;
-       const struct of_device_id *of_id;
        const struct mfd_cell *cells_no_irq = NULL;
        int nr_cells_no_irq = 0;
 
-       if (dev->of_node) {
-               of_id = of_match_device(dev->driver->of_match_table, dev);
-               if (!of_id) {
-                       dev_err(dev, "Unable to match OF ID\n");
-                       return -ENODEV;
-               }
-               axp20x->variant = (long)of_id->data;
-       } else {
-               acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
-               if (!acpi_id || !acpi_id->driver_data) {
-                       dev_err(dev, "Unable to match ACPI ID and data\n");
-                       return -ENODEV;
-               }
-               axp20x->variant = (long)acpi_id->driver_data;
-       }
-
+       axp20x->variant = (long)device_get_match_data(dev);
        switch (axp20x->variant) {
        case AXP152_ID:
                axp20x->nr_cells = ARRAY_SIZE(axp152_cells);