aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c7
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c7
-rw-r--r--arch/sparc/kernel/pci_sabre.c5
-rw-r--r--arch/sparc/kernel/pci_schizo.c8
-rw-r--r--drivers/atm/fore200e.c7
-rw-r--r--drivers/char/hw_random/n2-drv.c7
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c7
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c14
-rw-r--r--drivers/edac/ppc4xx_edac.c2
-rw-r--r--drivers/i2c/busses/i2c-mpc.c9
-rw-r--r--drivers/mmc/host/sdhci-of-core.c7
-rw-r--r--drivers/mtd/maps/physmap_of.c7
-rw-r--r--drivers/net/can/mscan/mpc5xxx_can.c7
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c9
-rw-r--r--drivers/net/fs_enet/mii-fec.c7
-rw-r--r--drivers/net/sunhme.c7
-rw-r--r--drivers/scsi/qlogicpti.c7
-rw-r--r--drivers/tty/serial/of_serial.c7
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.c7
-rw-r--r--drivers/watchdog/mpc8xxx_wdt.c7
-rw-r--r--include/linux/device.h1
-rw-r--r--include/linux/of_device.h12
22 files changed, 108 insertions, 50 deletions
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 188272934cfb..104faa8aa23c 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -318,17 +318,20 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
318 .end = mpc83xx_suspend_end, 318 .end = mpc83xx_suspend_end,
319}; 319};
320 320
321static struct of_device_id pmc_match[];
321static int pmc_probe(struct platform_device *ofdev) 322static int pmc_probe(struct platform_device *ofdev)
322{ 323{
324 const struct of_device_id *match;
323 struct device_node *np = ofdev->dev.of_node; 325 struct device_node *np = ofdev->dev.of_node;
324 struct resource res; 326 struct resource res;
325 struct pmc_type *type; 327 struct pmc_type *type;
326 int ret = 0; 328 int ret = 0;
327 329
328 if (!ofdev->dev.of_match) 330 match = of_match_device(pmc_match, &ofdev->dev);
331 if (!match)
329 return -EINVAL; 332 return -EINVAL;
330 333
331 type = ofdev->dev.of_match->data; 334 type = match->data;
332 335
333 if (!of_device_is_available(np)) 336 if (!of_device_is_available(np))
334 return -ENODEV; 337 return -ENODEV;
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index d5679dc1e20f..01cd2f089512 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -304,8 +304,10 @@ static int __devinit fsl_msi_setup_hwirq(struct fsl_msi *msi,
304 return 0; 304 return 0;
305} 305}
306 306
307static const struct of_device_id fsl_of_msi_ids[];
307static int __devinit fsl_of_msi_probe(struct platform_device *dev) 308static int __devinit fsl_of_msi_probe(struct platform_device *dev)
308{ 309{
310 const struct of_device_id *match;
309 struct fsl_msi *msi; 311 struct fsl_msi *msi;
310 struct resource res; 312 struct resource res;
311 int err, i, j, irq_index, count; 313 int err, i, j, irq_index, count;
@@ -316,9 +318,10 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev)
316 u32 offset; 318 u32 offset;
317 static const u32 all_avail[] = { 0, NR_MSI_IRQS }; 319 static const u32 all_avail[] = { 0, NR_MSI_IRQS };
318 320
319 if (!dev->dev.of_match) 321 match = of_match_device(fsl_of_msi_ids, &dev->dev);
322 if (!match)
320 return -EINVAL; 323 return -EINVAL;
321 features = dev->dev.of_match->data; 324 features = match->data;
322 325
323 printk(KERN_DEBUG "Setting up Freescale MSI support\n"); 326 printk(KERN_DEBUG "Setting up Freescale MSI support\n");
324 327
diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index 948068a083fc..d1840dbdaa2f 100644
--- a/arch/sparc/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
@@ -452,8 +452,10 @@ static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm,
452 sabre_scan_bus(pbm, &op->dev); 452 sabre_scan_bus(pbm, &op->dev);
453} 453}
454 454
455static const struct of_device_id sabre_match[];
455static int __devinit sabre_probe(struct platform_device *op) 456static int __devinit sabre_probe(struct platform_device *op)
456{ 457{
458 const struct of_device_id *match;
457 const struct linux_prom64_registers *pr_regs; 459 const struct linux_prom64_registers *pr_regs;
458 struct device_node *dp = op->dev.of_node; 460 struct device_node *dp = op->dev.of_node;
459 struct pci_pbm_info *pbm; 461 struct pci_pbm_info *pbm;
@@ -463,7 +465,8 @@ static int __devinit sabre_probe(struct platform_device *op)
463 const u32 *vdma; 465 const u32 *vdma;
464 u64 clear_irq; 466 u64 clear_irq;
465 467
466 hummingbird_p = op->dev.of_match && (op->dev.of_match->data != NULL); 468 match = of_match_device(sabre_match, &op->dev);
469 hummingbird_p = match && (match->data != NULL);
467 if (!hummingbird_p) { 470 if (!hummingbird_p) {
468 struct device_node *cpu_dp; 471 struct device_node *cpu_dp;
469 472
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index fecfcb2063c8..283fbc329a43 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -1458,11 +1458,15 @@ out_err:
1458 return err; 1458 return err;
1459} 1459}
1460 1460
1461static const struct of_device_id schizo_match[];
1461static int __devinit schizo_probe(struct platform_device *op) 1462static int __devinit schizo_probe(struct platform_device *op)
1462{ 1463{
1463 if (!op->dev.of_match) 1464 const struct of_device_id *match;
1465
1466 match = of_match_device(schizo_match, &op->dev);
1467 if (!match)
1464 return -EINVAL; 1468 return -EINVAL;
1465 return __schizo_init(op, (unsigned long) op->dev.of_match->data); 1469 return __schizo_init(op, (unsigned long)match->data);
1466} 1470}
1467 1471
1468/* The ordering of this table is very important. Some Tomatillo 1472/* The ordering of this table is very important. Some Tomatillo
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index bdd2719f3f68..bc9e702186dd 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -2643,16 +2643,19 @@ fore200e_init(struct fore200e* fore200e, struct device *parent)
2643} 2643}
2644 2644
2645#ifdef CONFIG_SBUS 2645#ifdef CONFIG_SBUS
2646static const struct of_device_id fore200e_sba_match[];
2646static int __devinit fore200e_sba_probe(struct platform_device *op) 2647static int __devinit fore200e_sba_probe(struct platform_device *op)
2647{ 2648{
2649 const struct of_device_id *match;
2648 const struct fore200e_bus *bus; 2650 const struct fore200e_bus *bus;
2649 struct fore200e *fore200e; 2651 struct fore200e *fore200e;
2650 static int index = 0; 2652 static int index = 0;
2651 int err; 2653 int err;
2652 2654
2653 if (!op->dev.of_match) 2655 match = of_match_device(fore200e_sba_match, &op->dev);
2656 if (!match)
2654 return -EINVAL; 2657 return -EINVAL;
2655 bus = op->dev.of_match->data; 2658 bus = match->data;
2656 2659
2657 fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL); 2660 fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL);
2658 if (!fore200e) 2661 if (!fore200e)
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c
index 43ac61978d8b..ac6739e085e3 100644
--- a/drivers/char/hw_random/n2-drv.c
+++ b/drivers/char/hw_random/n2-drv.c
@@ -619,15 +619,18 @@ static void __devinit n2rng_driver_version(void)
619 pr_info("%s", version); 619 pr_info("%s", version);
620} 620}
621 621
622static const struct of_device_id n2rng_match[];
622static int __devinit n2rng_probe(struct platform_device *op) 623static int __devinit n2rng_probe(struct platform_device *op)
623{ 624{
625 const struct of_device_id *match;
624 int victoria_falls; 626 int victoria_falls;
625 int err = -ENOMEM; 627 int err = -ENOMEM;
626 struct n2rng *np; 628 struct n2rng *np;
627 629
628 if (!op->dev.of_match) 630 match = of_match_device(n2rng_match, &op->dev);
631 if (!match)
629 return -EINVAL; 632 return -EINVAL;
630 victoria_falls = (op->dev.of_match->data != NULL); 633 victoria_falls = (match->data != NULL);
631 634
632 n2rng_driver_version(); 635 n2rng_driver_version();
633 np = kzalloc(sizeof(*np), GFP_KERNEL); 636 np = kzalloc(sizeof(*np), GFP_KERNEL);
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index cc6c9b2546a3..64c6b8530615 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2554,9 +2554,11 @@ static struct pci_driver ipmi_pci_driver = {
2554}; 2554};
2555#endif /* CONFIG_PCI */ 2555#endif /* CONFIG_PCI */
2556 2556
2557static struct of_device_id ipmi_match[];
2557static int __devinit ipmi_probe(struct platform_device *dev) 2558static int __devinit ipmi_probe(struct platform_device *dev)
2558{ 2559{
2559#ifdef CONFIG_OF 2560#ifdef CONFIG_OF
2561 const struct of_device_id *match;
2560 struct smi_info *info; 2562 struct smi_info *info;
2561 struct resource resource; 2563 struct resource resource;
2562 const __be32 *regsize, *regspacing, *regshift; 2564 const __be32 *regsize, *regspacing, *regshift;
@@ -2566,7 +2568,8 @@ static int __devinit ipmi_probe(struct platform_device *dev)
2566 2568
2567 dev_info(&dev->dev, "probing via device tree\n"); 2569 dev_info(&dev->dev, "probing via device tree\n");
2568 2570
2569 if (!dev->dev.of_match) 2571 match = of_match_device(ipmi_match, &dev->dev);
2572 if (!match)
2570 return -EINVAL; 2573 return -EINVAL;
2571 2574
2572 ret = of_address_to_resource(np, 0, &resource); 2575 ret = of_address_to_resource(np, 0, &resource);
@@ -2601,7 +2604,7 @@ static int __devinit ipmi_probe(struct platform_device *dev)
2601 return -ENOMEM; 2604 return -ENOMEM;
2602 } 2605 }
2603 2606
2604 info->si_type = (enum si_type) dev->dev.of_match->data; 2607 info->si_type = (enum si_type) match->data;
2605 info->addr_source = SI_DEVICETREE; 2608 info->addr_source = SI_DEVICETREE;
2606 info->irq_setup = std_irq_setup; 2609 info->irq_setup = std_irq_setup;
2607 2610
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index d6412c16385f..39ccdeada791 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -715,13 +715,13 @@ static int __devexit hwicap_remove(struct device *dev)
715} 715}
716 716
717#ifdef CONFIG_OF 717#ifdef CONFIG_OF
718static int __devinit hwicap_of_probe(struct platform_device *op) 718static int __devinit hwicap_of_probe(struct platform_device *op,
719 const struct hwicap_driver_config *config)
719{ 720{
720 struct resource res; 721 struct resource res;
721 const unsigned int *id; 722 const unsigned int *id;
722 const char *family; 723 const char *family;
723 int rc; 724 int rc;
724 const struct hwicap_driver_config *config = op->dev.of_match->data;
725 const struct config_registers *regs; 725 const struct config_registers *regs;
726 726
727 727
@@ -751,20 +751,24 @@ static int __devinit hwicap_of_probe(struct platform_device *op)
751 regs); 751 regs);
752} 752}
753#else 753#else
754static inline int hwicap_of_probe(struct platform_device *op) 754static inline int hwicap_of_probe(struct platform_device *op,
755 const struct hwicap_driver_config *config)
755{ 756{
756 return -EINVAL; 757 return -EINVAL;
757} 758}
758#endif /* CONFIG_OF */ 759#endif /* CONFIG_OF */
759 760
761static const struct of_device_id __devinitconst hwicap_of_match[];
760static int __devinit hwicap_drv_probe(struct platform_device *pdev) 762static int __devinit hwicap_drv_probe(struct platform_device *pdev)
761{ 763{
764 const struct of_device_id *match;
762 struct resource *res; 765 struct resource *res;
763 const struct config_registers *regs; 766 const struct config_registers *regs;
764 const char *family; 767 const char *family;
765 768
766 if (pdev->dev.of_match) 769 match = of_match_device(hwicap_of_match, &pdev->dev);
767 return hwicap_of_probe(pdev); 770 if (match)
771 return hwicap_of_probe(pdev, match->data);
768 772
769 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 773 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
770 if (!res) 774 if (!res)
diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c
index c1f0045ceb8e..af8e7b1aa290 100644
--- a/drivers/edac/ppc4xx_edac.c
+++ b/drivers/edac/ppc4xx_edac.c
@@ -1019,7 +1019,7 @@ ppc4xx_edac_mc_init(struct mem_ctl_info *mci,
1019 struct ppc4xx_edac_pdata *pdata = NULL; 1019 struct ppc4xx_edac_pdata *pdata = NULL;
1020 const struct device_node *np = op->dev.of_node; 1020 const struct device_node *np = op->dev.of_node;
1021 1021
1022 if (op->dev.of_match == NULL) 1022 if (of_match_device(ppc4xx_edac_match, &op->dev) == NULL)
1023 return -EINVAL; 1023 return -EINVAL;
1024 1024
1025 /* Initial driver pointers and private data */ 1025 /* Initial driver pointers and private data */
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 75b984c519ac..107397a606b4 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -560,15 +560,18 @@ static struct i2c_adapter mpc_ops = {
560 .timeout = HZ, 560 .timeout = HZ,
561}; 561};
562 562
563static const struct of_device_id mpc_i2c_of_match[];
563static int __devinit fsl_i2c_probe(struct platform_device *op) 564static int __devinit fsl_i2c_probe(struct platform_device *op)
564{ 565{
566 const struct of_device_id *match;
565 struct mpc_i2c *i2c; 567 struct mpc_i2c *i2c;
566 const u32 *prop; 568 const u32 *prop;
567 u32 clock = MPC_I2C_CLOCK_LEGACY; 569 u32 clock = MPC_I2C_CLOCK_LEGACY;
568 int result = 0; 570 int result = 0;
569 int plen; 571 int plen;
570 572
571 if (!op->dev.of_match) 573 match = of_match_device(mpc_i2c_of_match, &op->dev);
574 if (!match)
572 return -EINVAL; 575 return -EINVAL;
573 576
574 i2c = kzalloc(sizeof(*i2c), GFP_KERNEL); 577 i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
@@ -605,8 +608,8 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
605 clock = *prop; 608 clock = *prop;
606 } 609 }
607 610
608 if (op->dev.of_match->data) { 611 if (match->data) {
609 struct mpc_i2c_data *data = op->dev.of_match->data; 612 struct mpc_i2c_data *data = match->data;
610 data->setup(op->dev.of_node, i2c, clock, data->prescaler); 613 data->setup(op->dev.of_node, i2c, clock, data->prescaler);
611 } else { 614 } else {
612 /* Backwards compatibility */ 615 /* Backwards compatibility */
diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
index f9b611fc773e..60e4186a4345 100644
--- a/drivers/mmc/host/sdhci-of-core.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -124,8 +124,10 @@ static bool __devinit sdhci_of_wp_inverted(struct device_node *np)
124#endif 124#endif
125} 125}
126 126
127static const struct of_device_id sdhci_of_match[];
127static int __devinit sdhci_of_probe(struct platform_device *ofdev) 128static int __devinit sdhci_of_probe(struct platform_device *ofdev)
128{ 129{
130 const struct of_device_id *match;
129 struct device_node *np = ofdev->dev.of_node; 131 struct device_node *np = ofdev->dev.of_node;
130 struct sdhci_of_data *sdhci_of_data; 132 struct sdhci_of_data *sdhci_of_data;
131 struct sdhci_host *host; 133 struct sdhci_host *host;
@@ -134,9 +136,10 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev)
134 int size; 136 int size;
135 int ret; 137 int ret;
136 138
137 if (!ofdev->dev.of_match) 139 match = of_match_device(sdhci_of_match, &ofdev->dev);
140 if (!match)
138 return -EINVAL; 141 return -EINVAL;
139 sdhci_of_data = ofdev->dev.of_match->data; 142 sdhci_of_data = match->data;
140 143
141 if (!of_device_is_available(np)) 144 if (!of_device_is_available(np))
142 return -ENODEV; 145 return -ENODEV;
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index bd483f0c57e1..c1d33464aee8 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -214,11 +214,13 @@ static void __devinit of_free_probes(const char **probes)
214} 214}
215#endif 215#endif
216 216
217static struct of_device_id of_flash_match[];
217static int __devinit of_flash_probe(struct platform_device *dev) 218static int __devinit of_flash_probe(struct platform_device *dev)
218{ 219{
219#ifdef CONFIG_MTD_PARTITIONS 220#ifdef CONFIG_MTD_PARTITIONS
220 const char **part_probe_types; 221 const char **part_probe_types;
221#endif 222#endif
223 const struct of_device_id *match;
222 struct device_node *dp = dev->dev.of_node; 224 struct device_node *dp = dev->dev.of_node;
223 struct resource res; 225 struct resource res;
224 struct of_flash *info; 226 struct of_flash *info;
@@ -232,9 +234,10 @@ static int __devinit of_flash_probe(struct platform_device *dev)
232 struct mtd_info **mtd_list = NULL; 234 struct mtd_info **mtd_list = NULL;
233 resource_size_t res_size; 235 resource_size_t res_size;
234 236
235 if (!dev->dev.of_match) 237 match = of_match_device(of_flash_match, &dev->dev);
238 if (!match)
236 return -EINVAL; 239 return -EINVAL;
237 probe_type = dev->dev.of_match->data; 240 probe_type = match->data;
238 241
239 reg_tuple_size = (of_n_addr_cells(dp) + of_n_size_cells(dp)) * sizeof(u32); 242 reg_tuple_size = (of_n_addr_cells(dp) + of_n_size_cells(dp)) * sizeof(u32);
240 243
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index bd1d811c204f..5fedc3375562 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -247,8 +247,10 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
247} 247}
248#endif /* CONFIG_PPC_MPC512x */ 248#endif /* CONFIG_PPC_MPC512x */
249 249
250static struct of_device_id mpc5xxx_can_table[];
250static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev) 251static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev)
251{ 252{
253 const struct of_device_id *match;
252 struct mpc5xxx_can_data *data; 254 struct mpc5xxx_can_data *data;
253 struct device_node *np = ofdev->dev.of_node; 255 struct device_node *np = ofdev->dev.of_node;
254 struct net_device *dev; 256 struct net_device *dev;
@@ -258,9 +260,10 @@ static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev)
258 int irq, mscan_clksrc = 0; 260 int irq, mscan_clksrc = 0;
259 int err = -ENOMEM; 261 int err = -ENOMEM;
260 262
261 if (!ofdev->dev.of_match) 263 match = of_match_device(mpc5xxx_can_table, &ofdev->dev);
264 if (!match)
262 return -EINVAL; 265 return -EINVAL;
263 data = (struct mpc5xxx_can_data *)ofdev->dev.of_match->data; 266 data = match->data;
264 267
265 base = of_iomap(np, 0); 268 base = of_iomap(np, 0);
266 if (!base) { 269 if (!base) {
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 24cb953900dd..5131e61c358c 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -998,8 +998,10 @@ static const struct net_device_ops fs_enet_netdev_ops = {
998#endif 998#endif
999}; 999};
1000 1000
1001static struct of_device_id fs_enet_match[];
1001static int __devinit fs_enet_probe(struct platform_device *ofdev) 1002static int __devinit fs_enet_probe(struct platform_device *ofdev)
1002{ 1003{
1004 const struct of_device_id *match;
1003 struct net_device *ndev; 1005 struct net_device *ndev;
1004 struct fs_enet_private *fep; 1006 struct fs_enet_private *fep;
1005 struct fs_platform_info *fpi; 1007 struct fs_platform_info *fpi;
@@ -1007,14 +1009,15 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev)
1007 const u8 *mac_addr; 1009 const u8 *mac_addr;
1008 int privsize, len, ret = -ENODEV; 1010 int privsize, len, ret = -ENODEV;
1009 1011
1010 if (!ofdev->dev.of_match) 1012 match = of_match_device(fs_enet_match, &ofdev->dev);
1013 if (!match)
1011 return -EINVAL; 1014 return -EINVAL;
1012 1015
1013 fpi = kzalloc(sizeof(*fpi), GFP_KERNEL); 1016 fpi = kzalloc(sizeof(*fpi), GFP_KERNEL);
1014 if (!fpi) 1017 if (!fpi)
1015 return -ENOMEM; 1018 return -ENOMEM;
1016 1019
1017 if (!IS_FEC(ofdev->dev.of_match)) { 1020 if (!IS_FEC(match)) {
1018 data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len); 1021 data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len);
1019 if (!data || len != 4) 1022 if (!data || len != 4)
1020 goto out_free_fpi; 1023 goto out_free_fpi;
@@ -1049,7 +1052,7 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev)
1049 fep->dev = &ofdev->dev; 1052 fep->dev = &ofdev->dev;
1050 fep->ndev = ndev; 1053 fep->ndev = ndev;
1051 fep->fpi = fpi; 1054 fep->fpi = fpi;
1052 fep->ops = ofdev->dev.of_match->data; 1055 fep->ops = match->data;
1053 1056
1054 ret = fep->ops->setup_data(ndev); 1057 ret = fep->ops->setup_data(ndev);
1055 if (ret) 1058 if (ret)
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index 7e840d373ab3..6a2e150e75bb 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -101,17 +101,20 @@ static int fs_enet_fec_mii_reset(struct mii_bus *bus)
101 return 0; 101 return 0;
102} 102}
103 103
104static struct of_device_id fs_enet_mdio_fec_match[];
104static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev) 105static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev)
105{ 106{
107 const struct of_device_id *match;
106 struct resource res; 108 struct resource res;
107 struct mii_bus *new_bus; 109 struct mii_bus *new_bus;
108 struct fec_info *fec; 110 struct fec_info *fec;
109 int (*get_bus_freq)(struct device_node *); 111 int (*get_bus_freq)(struct device_node *);
110 int ret = -ENOMEM, clock, speed; 112 int ret = -ENOMEM, clock, speed;
111 113
112 if (!ofdev->dev.of_match) 114 match = of_match_device(fs_enet_mdio_fec_match, &ofdev->dev);
115 if (!match)
113 return -EINVAL; 116 return -EINVAL;
114 get_bus_freq = ofdev->dev.of_match->data; 117 get_bus_freq = match->data;
115 118
116 new_bus = mdiobus_alloc(); 119 new_bus = mdiobus_alloc();
117 if (!new_bus) 120 if (!new_bus)
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index eb4f59fb01e9..bff2f7999ff0 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -3237,15 +3237,18 @@ static void happy_meal_pci_exit(void)
3237#endif 3237#endif
3238 3238
3239#ifdef CONFIG_SBUS 3239#ifdef CONFIG_SBUS
3240static const struct of_device_id hme_sbus_match[];
3240static int __devinit hme_sbus_probe(struct platform_device *op) 3241static int __devinit hme_sbus_probe(struct platform_device *op)
3241{ 3242{
3243 const struct of_device_id *match;
3242 struct device_node *dp = op->dev.of_node; 3244 struct device_node *dp = op->dev.of_node;
3243 const char *model = of_get_property(dp, "model", NULL); 3245 const char *model = of_get_property(dp, "model", NULL);
3244 int is_qfe; 3246 int is_qfe;
3245 3247
3246 if (!op->dev.of_match) 3248 match = of_match_device(hme_sbus_match, &op->dev);
3249 if (!match)
3247 return -EINVAL; 3250 return -EINVAL;
3248 is_qfe = (op->dev.of_match->data != NULL); 3251 is_qfe = (match->data != NULL);
3249 3252
3250 if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe")) 3253 if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe"))
3251 is_qfe = 1; 3254 is_qfe = 1;
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index e2d45c91b8e8..9689d41c7888 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1292,8 +1292,10 @@ static struct scsi_host_template qpti_template = {
1292 .use_clustering = ENABLE_CLUSTERING, 1292 .use_clustering = ENABLE_CLUSTERING,
1293}; 1293};
1294 1294
1295static const struct of_device_id qpti_match[];
1295static int __devinit qpti_sbus_probe(struct platform_device *op) 1296static int __devinit qpti_sbus_probe(struct platform_device *op)
1296{ 1297{
1298 const struct of_device_id *match;
1297 struct scsi_host_template *tpnt; 1299 struct scsi_host_template *tpnt;
1298 struct device_node *dp = op->dev.of_node; 1300 struct device_node *dp = op->dev.of_node;
1299 struct Scsi_Host *host; 1301 struct Scsi_Host *host;
@@ -1301,9 +1303,10 @@ static int __devinit qpti_sbus_probe(struct platform_device *op)
1301 static int nqptis; 1303 static int nqptis;
1302 const char *fcode; 1304 const char *fcode;
1303 1305
1304 if (!op->dev.of_match) 1306 match = of_match_device(qpti_match, &op->dev);
1307 if (!match)
1305 return -EINVAL; 1308 return -EINVAL;
1306 tpnt = op->dev.of_match->data; 1309 tpnt = match->data;
1307 1310
1308 /* Sometimes Antares cards come up not completely 1311 /* Sometimes Antares cards come up not completely
1309 * setup, and we get a report of a zero IRQ. 1312 * setup, and we get a report of a zero IRQ.
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 0e8eec516df4..c911b2419abb 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -80,14 +80,17 @@ static int __devinit of_platform_serial_setup(struct platform_device *ofdev,
80/* 80/*
81 * Try to register a serial port 81 * Try to register a serial port
82 */ 82 */
83static struct of_device_id of_platform_serial_table[];
83static int __devinit of_platform_serial_probe(struct platform_device *ofdev) 84static int __devinit of_platform_serial_probe(struct platform_device *ofdev)
84{ 85{
86 const struct of_device_id *match;
85 struct of_serial_info *info; 87 struct of_serial_info *info;
86 struct uart_port port; 88 struct uart_port port;
87 int port_type; 89 int port_type;
88 int ret; 90 int ret;
89 91
90 if (!ofdev->dev.of_match) 92 match = of_match_device(of_platform_serial_table, &ofdev->dev);
93 if (!match)
91 return -EINVAL; 94 return -EINVAL;
92 95
93 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL)) 96 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
@@ -97,7 +100,7 @@ static int __devinit of_platform_serial_probe(struct platform_device *ofdev)
97 if (info == NULL) 100 if (info == NULL)
98 return -ENOMEM; 101 return -ENOMEM;
99 102
100 port_type = (unsigned long)ofdev->dev.of_match->data; 103 port_type = (unsigned long)match->data;
101 ret = of_platform_serial_setup(ofdev, port_type, &port); 104 ret = of_platform_serial_setup(ofdev, port_type, &port);
102 if (ret) 105 if (ret)
103 goto out; 106 goto out;
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index 36613b37c504..3a68e09309f7 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -2539,15 +2539,18 @@ static void qe_udc_release(struct device *dev)
2539} 2539}
2540 2540
2541/* Driver probe functions */ 2541/* Driver probe functions */
2542static const struct of_device_id qe_udc_match[];
2542static int __devinit qe_udc_probe(struct platform_device *ofdev) 2543static int __devinit qe_udc_probe(struct platform_device *ofdev)
2543{ 2544{
2545 const struct of_device_id *match;
2544 struct device_node *np = ofdev->dev.of_node; 2546 struct device_node *np = ofdev->dev.of_node;
2545 struct qe_ep *ep; 2547 struct qe_ep *ep;
2546 unsigned int ret = 0; 2548 unsigned int ret = 0;
2547 unsigned int i; 2549 unsigned int i;
2548 const void *prop; 2550 const void *prop;
2549 2551
2550 if (!ofdev->dev.of_match) 2552 match = of_match_device(qe_udc_match, &ofdev->dev);
2553 if (!match)
2551 return -EINVAL; 2554 return -EINVAL;
2552 2555
2553 prop = of_get_property(np, "mode", NULL); 2556 prop = of_get_property(np, "mode", NULL);
@@ -2561,7 +2564,7 @@ static int __devinit qe_udc_probe(struct platform_device *ofdev)
2561 return -ENOMEM; 2564 return -ENOMEM;
2562 } 2565 }
2563 2566
2564 udc_controller->soc_type = (unsigned long)ofdev->dev.of_match->data; 2567 udc_controller->soc_type = (unsigned long)match->data;
2565 udc_controller->usb_regs = of_iomap(np, 0); 2568 udc_controller->usb_regs = of_iomap(np, 0);
2566 if (!udc_controller->usb_regs) { 2569 if (!udc_controller->usb_regs) {
2567 ret = -ENOMEM; 2570 ret = -ENOMEM;
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 528bceb220fd..eed5436ffb51 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -185,17 +185,20 @@ static struct miscdevice mpc8xxx_wdt_miscdev = {
185 .fops = &mpc8xxx_wdt_fops, 185 .fops = &mpc8xxx_wdt_fops,
186}; 186};
187 187
188static const struct of_device_id mpc8xxx_wdt_match[];
188static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev) 189static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev)
189{ 190{
190 int ret; 191 int ret;
192 const struct of_device_id *match;
191 struct device_node *np = ofdev->dev.of_node; 193 struct device_node *np = ofdev->dev.of_node;
192 struct mpc8xxx_wdt_type *wdt_type; 194 struct mpc8xxx_wdt_type *wdt_type;
193 u32 freq = fsl_get_sys_freq(); 195 u32 freq = fsl_get_sys_freq();
194 bool enabled; 196 bool enabled;
195 197
196 if (!ofdev->dev.of_match) 198 match = of_match_device(mpc8xxx_wdt_match, &ofdev->dev);
199 if (!match)
197 return -EINVAL; 200 return -EINVAL;
198 wdt_type = ofdev->dev.of_match->data; 201 wdt_type = match->data;
199 202
200 if (!freq || freq == -1) 203 if (!freq || freq == -1)
201 return -EINVAL; 204 return -EINVAL;
diff --git a/include/linux/device.h b/include/linux/device.h
index ab8dfc095709..d08399db6e2c 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -442,7 +442,6 @@ struct device {
442 struct dev_archdata archdata; 442 struct dev_archdata archdata;
443 443
444 struct device_node *of_node; /* associated device tree node */ 444 struct device_node *of_node; /* associated device tree node */
445 const struct of_device_id *of_match; /* matching of_device_id from driver */
446 445
447 dev_t devt; /* dev_t, creates the sysfs "dev" */ 446 dev_t devt; /* dev_t, creates the sysfs "dev" */
448 447
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index b33d68814a73..ae5638480ef2 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -21,12 +21,7 @@ extern void of_device_make_bus_id(struct device *dev);
21static inline int of_driver_match_device(struct device *dev, 21static inline int of_driver_match_device(struct device *dev,
22 const struct device_driver *drv) 22 const struct device_driver *drv)
23{ 23{
24 const struct of_device_id *match; 24 return of_match_device(drv->of_match_table, dev) != NULL;
25
26 match = of_match_device(drv->of_match_table, dev);
27 if (match)
28 dev->of_match = match;
29 return match != NULL;
30} 25}
31 26
32extern struct platform_device *of_dev_get(struct platform_device *dev); 27extern struct platform_device *of_dev_get(struct platform_device *dev);
@@ -62,6 +57,11 @@ static inline int of_device_uevent(struct device *dev,
62 57
63static inline void of_device_node_put(struct device *dev) { } 58static inline void of_device_node_put(struct device *dev) { }
64 59
60static inline const struct of_device_id *of_match_device(
61 const struct of_device_id *matches, const struct device *dev)
62{
63 return NULL;
64}
65#endif /* CONFIG_OF_DEVICE */ 65#endif /* CONFIG_OF_DEVICE */
66 66
67#endif /* _LINUX_OF_DEVICE_H */ 67#endif /* _LINUX_OF_DEVICE_H */