aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ppc/syslib/of_device.c15
-rw-r--r--arch/ppc64/kernel/of_device.c15
-rw-r--r--drivers/i2c/busses/i2c-keywest.c7
-rw-r--r--drivers/ide/ppc/pmac.c12
-rw-r--r--drivers/macintosh/macio_asic.c4
-rw-r--r--drivers/macintosh/mediabay.c7
-rw-r--r--drivers/macintosh/therm_pm72.c9
-rw-r--r--drivers/macintosh/therm_windtunnel.c6
-rw-r--r--drivers/net/bmac.c7
-rw-r--r--drivers/net/mace.c6
-rw-r--r--drivers/net/wireless/airport.c8
-rw-r--r--drivers/scsi/mac53c94.c7
-rw-r--r--drivers/scsi/mesh.c8
-rw-r--r--drivers/serial/pmac_zilog.c9
-rw-r--r--drivers/video/platinumfb.c6
-rw-r--r--include/asm-ppc/macio.h5
-rw-r--r--include/asm-ppc/of_device.h20
-rw-r--r--include/linux/mod_devicetable.h11
-rw-r--r--scripts/mod/file2alias.c22
19 files changed, 91 insertions, 93 deletions
diff --git a/arch/ppc/syslib/of_device.c b/arch/ppc/syslib/of_device.c
index 49c0e34e2d6b..1eb4f726ca9f 100644
--- a/arch/ppc/syslib/of_device.c
+++ b/arch/ppc/syslib/of_device.c
@@ -3,6 +3,7 @@
3#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/mod_devicetable.h>
6#include <asm/errno.h> 7#include <asm/errno.h>
7#include <asm/of_device.h> 8#include <asm/of_device.h>
8 9
@@ -15,20 +16,20 @@
15 * Used by a driver to check whether an of_device present in the 16 * Used by a driver to check whether an of_device present in the
16 * system is in its list of supported devices. 17 * system is in its list of supported devices.
17 */ 18 */
18const struct of_match * of_match_device(const struct of_match *matches, 19const struct of_device_id * of_match_device(const struct of_device_id *matches,
19 const struct of_device *dev) 20 const struct of_device *dev)
20{ 21{
21 if (!dev->node) 22 if (!dev->node)
22 return NULL; 23 return NULL;
23 while (matches->name || matches->type || matches->compatible) { 24 while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
24 int match = 1; 25 int match = 1;
25 if (matches->name && matches->name != OF_ANY_MATCH) 26 if (matches->name[0])
26 match &= dev->node->name 27 match &= dev->node->name
27 && !strcmp(matches->name, dev->node->name); 28 && !strcmp(matches->name, dev->node->name);
28 if (matches->type && matches->type != OF_ANY_MATCH) 29 if (matches->type[0])
29 match &= dev->node->type 30 match &= dev->node->type
30 && !strcmp(matches->type, dev->node->type); 31 && !strcmp(matches->type, dev->node->type);
31 if (matches->compatible && matches->compatible != OF_ANY_MATCH) 32 if (matches->compatible[0])
32 match &= device_is_compatible(dev->node, 33 match &= device_is_compatible(dev->node,
33 matches->compatible); 34 matches->compatible);
34 if (match) 35 if (match)
@@ -42,7 +43,7 @@ static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
42{ 43{
43 struct of_device * of_dev = to_of_device(dev); 44 struct of_device * of_dev = to_of_device(dev);
44 struct of_platform_driver * of_drv = to_of_platform_driver(drv); 45 struct of_platform_driver * of_drv = to_of_platform_driver(drv);
45 const struct of_match * matches = of_drv->match_table; 46 const struct of_device_id * matches = of_drv->match_table;
46 47
47 if (!matches) 48 if (!matches)
48 return 0; 49 return 0;
@@ -75,7 +76,7 @@ static int of_device_probe(struct device *dev)
75 int error = -ENODEV; 76 int error = -ENODEV;
76 struct of_platform_driver *drv; 77 struct of_platform_driver *drv;
77 struct of_device *of_dev; 78 struct of_device *of_dev;
78 const struct of_match *match; 79 const struct of_device_id *match;
79 80
80 drv = to_of_platform_driver(dev->driver); 81 drv = to_of_platform_driver(dev->driver);
81 of_dev = to_of_device(dev); 82 of_dev = to_of_device(dev);
diff --git a/arch/ppc64/kernel/of_device.c b/arch/ppc64/kernel/of_device.c
index 66bd5ab7c25a..b80e81984ba8 100644
--- a/arch/ppc64/kernel/of_device.c
+++ b/arch/ppc64/kernel/of_device.c
@@ -3,6 +3,7 @@
3#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/mod_devicetable.h>
6#include <asm/errno.h> 7#include <asm/errno.h>
7#include <asm/of_device.h> 8#include <asm/of_device.h>
8 9
@@ -15,20 +16,20 @@
15 * Used by a driver to check whether an of_device present in the 16 * Used by a driver to check whether an of_device present in the
16 * system is in its list of supported devices. 17 * system is in its list of supported devices.
17 */ 18 */
18const struct of_match * of_match_device(const struct of_match *matches, 19const struct of_device_id *of_match_device(const struct of_device_id *matches,
19 const struct of_device *dev) 20 const struct of_device *dev)
20{ 21{
21 if (!dev->node) 22 if (!dev->node)
22 return NULL; 23 return NULL;
23 while (matches->name || matches->type || matches->compatible) { 24 while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
24 int match = 1; 25 int match = 1;
25 if (matches->name && matches->name != OF_ANY_MATCH) 26 if (matches->name[0])
26 match &= dev->node->name 27 match &= dev->node->name
27 && !strcmp(matches->name, dev->node->name); 28 && !strcmp(matches->name, dev->node->name);
28 if (matches->type && matches->type != OF_ANY_MATCH) 29 if (matches->type[0])
29 match &= dev->node->type 30 match &= dev->node->type
30 && !strcmp(matches->type, dev->node->type); 31 && !strcmp(matches->type, dev->node->type);
31 if (matches->compatible && matches->compatible != OF_ANY_MATCH) 32 if (matches->compatible[0])
32 match &= device_is_compatible(dev->node, 33 match &= device_is_compatible(dev->node,
33 matches->compatible); 34 matches->compatible);
34 if (match) 35 if (match)
@@ -42,7 +43,7 @@ static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
42{ 43{
43 struct of_device * of_dev = to_of_device(dev); 44 struct of_device * of_dev = to_of_device(dev);
44 struct of_platform_driver * of_drv = to_of_platform_driver(drv); 45 struct of_platform_driver * of_drv = to_of_platform_driver(drv);
45 const struct of_match * matches = of_drv->match_table; 46 const struct of_device_id * matches = of_drv->match_table;
46 47
47 if (!matches) 48 if (!matches)
48 return 0; 49 return 0;
@@ -75,7 +76,7 @@ static int of_device_probe(struct device *dev)
75 int error = -ENODEV; 76 int error = -ENODEV;
76 struct of_platform_driver *drv; 77 struct of_platform_driver *drv;
77 struct of_device *of_dev; 78 struct of_device *of_dev;
78 const struct of_match *match; 79 const struct of_device_id *match;
79 80
80 drv = to_of_platform_driver(dev->driver); 81 drv = to_of_platform_driver(dev->driver);
81 of_dev = to_of_device(dev); 82 of_dev = to_of_device(dev);
diff --git a/drivers/i2c/busses/i2c-keywest.c b/drivers/i2c/busses/i2c-keywest.c
index 363e545fc01f..94ae808314f7 100644
--- a/drivers/i2c/busses/i2c-keywest.c
+++ b/drivers/i2c/busses/i2c-keywest.c
@@ -698,7 +698,7 @@ dispose_iface(struct device *dev)
698} 698}
699 699
700static int 700static int
701create_iface_macio(struct macio_dev* dev, const struct of_match *match) 701create_iface_macio(struct macio_dev* dev, const struct of_device_id *match)
702{ 702{
703 return create_iface(dev->ofdev.node, &dev->ofdev.dev); 703 return create_iface(dev->ofdev.node, &dev->ofdev.dev);
704} 704}
@@ -710,7 +710,7 @@ dispose_iface_macio(struct macio_dev* dev)
710} 710}
711 711
712static int 712static int
713create_iface_of_platform(struct of_device* dev, const struct of_match *match) 713create_iface_of_platform(struct of_device* dev, const struct of_device_id *match)
714{ 714{
715 return create_iface(dev->node, &dev->dev); 715 return create_iface(dev->node, &dev->dev);
716} 716}
@@ -721,10 +721,9 @@ dispose_iface_of_platform(struct of_device* dev)
721 return dispose_iface(&dev->dev); 721 return dispose_iface(&dev->dev);
722} 722}
723 723
724static struct of_match i2c_keywest_match[] = 724static struct of_device_id i2c_keywest_match[] =
725{ 725{
726 { 726 {
727 .name = OF_ANY_MATCH,
728 .type = "i2c", 727 .type = "i2c",
729 .compatible = "keywest" 728 .compatible = "keywest"
730 }, 729 },
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 818380b5fd27..be0fcc8f4b15 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1419,7 +1419,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1419 * Attach to a macio probed interface 1419 * Attach to a macio probed interface
1420 */ 1420 */
1421static int __devinit 1421static int __devinit
1422pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_match *match) 1422pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1423{ 1423{
1424 void __iomem *base; 1424 void __iomem *base;
1425 unsigned long regbase; 1425 unsigned long regbase;
@@ -1637,27 +1637,19 @@ pmac_ide_pci_resume(struct pci_dev *pdev)
1637 return rc; 1637 return rc;
1638} 1638}
1639 1639
1640static struct of_match pmac_ide_macio_match[] = 1640static struct of_device_id pmac_ide_macio_match[] =
1641{ 1641{
1642 { 1642 {
1643 .name = "IDE", 1643 .name = "IDE",
1644 .type = OF_ANY_MATCH,
1645 .compatible = OF_ANY_MATCH
1646 }, 1644 },
1647 { 1645 {
1648 .name = "ATA", 1646 .name = "ATA",
1649 .type = OF_ANY_MATCH,
1650 .compatible = OF_ANY_MATCH
1651 }, 1647 },
1652 { 1648 {
1653 .name = OF_ANY_MATCH,
1654 .type = "ide", 1649 .type = "ide",
1655 .compatible = OF_ANY_MATCH
1656 }, 1650 },
1657 { 1651 {
1658 .name = OF_ANY_MATCH,
1659 .type = "ata", 1652 .type = "ata",
1660 .compatible = OF_ANY_MATCH
1661 }, 1653 },
1662 {}, 1654 {},
1663}; 1655};
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index d0bda7e3e6aa..37b18ee08a2d 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -33,7 +33,7 @@ static int macio_bus_match(struct device *dev, struct device_driver *drv)
33{ 33{
34 struct macio_dev * macio_dev = to_macio_device(dev); 34 struct macio_dev * macio_dev = to_macio_device(dev);
35 struct macio_driver * macio_drv = to_macio_driver(drv); 35 struct macio_driver * macio_drv = to_macio_driver(drv);
36 const struct of_match * matches = macio_drv->match_table; 36 const struct of_device_id * matches = macio_drv->match_table;
37 37
38 if (!matches) 38 if (!matches)
39 return 0; 39 return 0;
@@ -66,7 +66,7 @@ static int macio_device_probe(struct device *dev)
66 int error = -ENODEV; 66 int error = -ENODEV;
67 struct macio_driver *drv; 67 struct macio_driver *drv;
68 struct macio_dev *macio_dev; 68 struct macio_dev *macio_dev;
69 const struct of_match *match; 69 const struct of_device_id *match;
70 70
71 drv = to_macio_driver(dev->driver); 71 drv = to_macio_driver(dev->driver);
72 macio_dev = to_macio_device(dev); 72 macio_dev = to_macio_device(dev);
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index 4be709e13eec..7c16c25fc5d4 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -642,7 +642,7 @@ static int __pmac media_bay_task(void *x)
642 } 642 }
643} 643}
644 644
645static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_match *match) 645static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_device_id *match)
646{ 646{
647 struct media_bay_info* bay; 647 struct media_bay_info* bay;
648 u32 __iomem *regbase; 648 u32 __iomem *regbase;
@@ -797,23 +797,20 @@ static struct mb_ops keylargo_mb_ops __pmacdata = {
797 * Therefore we do it all by polling the media bay once each tick. 797 * Therefore we do it all by polling the media bay once each tick.
798 */ 798 */
799 799
800static struct of_match media_bay_match[] = 800static struct of_device_id media_bay_match[] =
801{ 801{
802 { 802 {
803 .name = "media-bay", 803 .name = "media-bay",
804 .type = OF_ANY_MATCH,
805 .compatible = "keylargo-media-bay", 804 .compatible = "keylargo-media-bay",
806 .data = &keylargo_mb_ops, 805 .data = &keylargo_mb_ops,
807 }, 806 },
808 { 807 {
809 .name = "media-bay", 808 .name = "media-bay",
810 .type = OF_ANY_MATCH,
811 .compatible = "heathrow-media-bay", 809 .compatible = "heathrow-media-bay",
812 .data = &heathrow_mb_ops, 810 .data = &heathrow_mb_ops,
813 }, 811 },
814 { 812 {
815 .name = "media-bay", 813 .name = "media-bay",
816 .type = OF_ANY_MATCH,
817 .compatible = "ohare-media-bay", 814 .compatible = "ohare-media-bay",
818 .data = &ohare_mb_ops, 815 .data = &ohare_mb_ops,
819 }, 816 },
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index feb4e2413858..703e31973314 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -120,6 +120,7 @@
120#include <asm/system.h> 120#include <asm/system.h>
121#include <asm/sections.h> 121#include <asm/sections.h>
122#include <asm/of_device.h> 122#include <asm/of_device.h>
123#include <asm/macio.h>
123 124
124#include "therm_pm72.h" 125#include "therm_pm72.h"
125 126
@@ -1986,7 +1987,7 @@ static void fcu_lookup_fans(struct device_node *fcu_node)
1986 } 1987 }
1987} 1988}
1988 1989
1989static int fcu_of_probe(struct of_device* dev, const struct of_match *match) 1990static int fcu_of_probe(struct of_device* dev, const struct of_device_id *match)
1990{ 1991{
1991 int rc; 1992 int rc;
1992 1993
@@ -2009,12 +2010,10 @@ static int fcu_of_remove(struct of_device* dev)
2009 return 0; 2010 return 0;
2010} 2011}
2011 2012
2012static struct of_match fcu_of_match[] = 2013static struct of_device_id fcu_match[] =
2013{ 2014{
2014 { 2015 {
2015 .name = OF_ANY_MATCH,
2016 .type = "fcu", 2016 .type = "fcu",
2017 .compatible = OF_ANY_MATCH
2018 }, 2017 },
2019 {}, 2018 {},
2020}; 2019};
@@ -2022,7 +2021,7 @@ static struct of_match fcu_of_match[] =
2022static struct of_platform_driver fcu_of_platform_driver = 2021static struct of_platform_driver fcu_of_platform_driver =
2023{ 2022{
2024 .name = "temperature", 2023 .name = "temperature",
2025 .match_table = fcu_of_match, 2024 .match_table = fcu_match,
2026 .probe = fcu_of_probe, 2025 .probe = fcu_of_probe,
2027 .remove = fcu_of_remove 2026 .remove = fcu_of_remove
2028}; 2027};
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index 61400f04015e..cbb72eb0426d 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -43,6 +43,7 @@
43#include <asm/system.h> 43#include <asm/system.h>
44#include <asm/sections.h> 44#include <asm/sections.h>
45#include <asm/of_device.h> 45#include <asm/of_device.h>
46#include <asm/macio.h>
46 47
47#define LOG_TEMP 0 /* continously log temperature */ 48#define LOG_TEMP 0 /* continously log temperature */
48 49
@@ -450,7 +451,7 @@ do_probe( struct i2c_adapter *adapter, int addr, int kind )
450/************************************************************************/ 451/************************************************************************/
451 452
452static int 453static int
453therm_of_probe( struct of_device *dev, const struct of_match *match ) 454therm_of_probe( struct of_device *dev, const struct of_device_id *match )
454{ 455{
455 return i2c_add_driver( &g4fan_driver ); 456 return i2c_add_driver( &g4fan_driver );
456} 457}
@@ -461,9 +462,8 @@ therm_of_remove( struct of_device *dev )
461 return i2c_del_driver( &g4fan_driver ); 462 return i2c_del_driver( &g4fan_driver );
462} 463}
463 464
464static struct of_match therm_of_match[] = {{ 465static struct of_device_id therm_of_match[] = {{
465 .name = "fan", 466 .name = "fan",
466 .type = OF_ANY_MATCH,
467 .compatible = "adm1030" 467 .compatible = "adm1030"
468 }, {} 468 }, {}
469}; 469};
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index 00e5257b176f..8dc657fc8afb 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -1261,7 +1261,7 @@ static void bmac_reset_and_enable(struct net_device *dev)
1261 spin_unlock_irqrestore(&bp->lock, flags); 1261 spin_unlock_irqrestore(&bp->lock, flags);
1262} 1262}
1263 1263
1264static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_match *match) 1264static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_id *match)
1265{ 1265{
1266 int j, rev, ret; 1266 int j, rev, ret;
1267 struct bmac_data *bp; 1267 struct bmac_data *bp;
@@ -1645,16 +1645,13 @@ static int __devexit bmac_remove(struct macio_dev *mdev)
1645 return 0; 1645 return 0;
1646} 1646}
1647 1647
1648static struct of_match bmac_match[] = 1648static struct of_device_id bmac_match[] =
1649{ 1649{
1650 { 1650 {
1651 .name = "bmac", 1651 .name = "bmac",
1652 .type = OF_ANY_MATCH,
1653 .compatible = OF_ANY_MATCH,
1654 .data = (void *)0, 1652 .data = (void *)0,
1655 }, 1653 },
1656 { 1654 {
1657 .name = OF_ANY_MATCH,
1658 .type = "network", 1655 .type = "network",
1659 .compatible = "bmac+", 1656 .compatible = "bmac+",
1660 .data = (void *)1, 1657 .data = (void *)1,
diff --git a/drivers/net/mace.c b/drivers/net/mace.c
index 6ed2d7dbd44c..81d0a26e4f41 100644
--- a/drivers/net/mace.c
+++ b/drivers/net/mace.c
@@ -109,7 +109,7 @@ bitrev(int b)
109} 109}
110 110
111 111
112static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *match) 112static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_id *match)
113{ 113{
114 struct device_node *mace = macio_get_of_node(mdev); 114 struct device_node *mace = macio_get_of_node(mdev);
115 struct net_device *dev; 115 struct net_device *dev;
@@ -1009,12 +1009,10 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id, struct pt_regs *regs)
1009 return IRQ_HANDLED; 1009 return IRQ_HANDLED;
1010} 1010}
1011 1011
1012static struct of_match mace_match[] = 1012static struct of_device_id mace_match[] =
1013{ 1013{
1014 { 1014 {
1015 .name = "mace", 1015 .name = "mace",
1016 .type = OF_ANY_MATCH,
1017 .compatible = OF_ANY_MATCH
1018 }, 1016 },
1019 {}, 1017 {},
1020}; 1018};
diff --git a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c
index b4f4bd7956a2..9d496703c465 100644
--- a/drivers/net/wireless/airport.c
+++ b/drivers/net/wireless/airport.c
@@ -184,7 +184,7 @@ static int airport_hard_reset(struct orinoco_private *priv)
184} 184}
185 185
186static int 186static int
187airport_attach(struct macio_dev *mdev, const struct of_match *match) 187airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
188{ 188{
189 struct orinoco_private *priv; 189 struct orinoco_private *priv;
190 struct net_device *dev; 190 struct net_device *dev;
@@ -266,16 +266,16 @@ MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
266MODULE_DESCRIPTION("Driver for the Apple Airport wireless card."); 266MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
267MODULE_LICENSE("Dual MPL/GPL"); 267MODULE_LICENSE("Dual MPL/GPL");
268 268
269static struct of_match airport_match[] = 269static struct of_device_id airport_match[] =
270{ 270{
271 { 271 {
272 .name = "radio", 272 .name = "radio",
273 .type = OF_ANY_MATCH,
274 .compatible = OF_ANY_MATCH
275 }, 273 },
276 {}, 274 {},
277}; 275};
278 276
277MODULE_DEVICE_TABLE (of, airport_match);
278
279static struct macio_driver airport_driver = 279static struct macio_driver airport_driver =
280{ 280{
281 .name = DRIVER_NAME, 281 .name = DRIVER_NAME,
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c
index edd47d1f0b17..932dcf0366eb 100644
--- a/drivers/scsi/mac53c94.c
+++ b/drivers/scsi/mac53c94.c
@@ -424,7 +424,7 @@ static struct scsi_host_template mac53c94_template = {
424 .use_clustering = DISABLE_CLUSTERING, 424 .use_clustering = DISABLE_CLUSTERING,
425}; 425};
426 426
427static int mac53c94_probe(struct macio_dev *mdev, const struct of_match *match) 427static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *match)
428{ 428{
429 struct device_node *node = macio_get_of_node(mdev); 429 struct device_node *node = macio_get_of_node(mdev);
430 struct pci_dev *pdev = macio_get_pci_dev(mdev); 430 struct pci_dev *pdev = macio_get_pci_dev(mdev);
@@ -544,15 +544,14 @@ static int mac53c94_remove(struct macio_dev *mdev)
544} 544}
545 545
546 546
547static struct of_match mac53c94_match[] = 547static struct of_device_id mac53c94_match[] =
548{ 548{
549 { 549 {
550 .name = "53c94", 550 .name = "53c94",
551 .type = OF_ANY_MATCH,
552 .compatible = OF_ANY_MATCH
553 }, 551 },
554 {}, 552 {},
555}; 553};
554MODULE_DEVICE_TABLE (of, mac53c94_match);
556 555
557static struct macio_driver mac53c94_driver = 556static struct macio_driver mac53c94_driver =
558{ 557{
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index b05737ae5eff..ff1933298da6 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -1847,7 +1847,7 @@ static struct scsi_host_template mesh_template = {
1847 .use_clustering = DISABLE_CLUSTERING, 1847 .use_clustering = DISABLE_CLUSTERING,
1848}; 1848};
1849 1849
1850static int mesh_probe(struct macio_dev *mdev, const struct of_match *match) 1850static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match)
1851{ 1851{
1852 struct device_node *mesh = macio_get_of_node(mdev); 1852 struct device_node *mesh = macio_get_of_node(mdev);
1853 struct pci_dev* pdev = macio_get_pci_dev(mdev); 1853 struct pci_dev* pdev = macio_get_pci_dev(mdev);
@@ -2012,20 +2012,18 @@ static int mesh_remove(struct macio_dev *mdev)
2012} 2012}
2013 2013
2014 2014
2015static struct of_match mesh_match[] = 2015static struct of_device_id mesh_match[] =
2016{ 2016{
2017 { 2017 {
2018 .name = "mesh", 2018 .name = "mesh",
2019 .type = OF_ANY_MATCH,
2020 .compatible = OF_ANY_MATCH
2021 }, 2019 },
2022 { 2020 {
2023 .name = OF_ANY_MATCH,
2024 .type = "scsi", 2021 .type = "scsi",
2025 .compatible = "chrp,mesh0" 2022 .compatible = "chrp,mesh0"
2026 }, 2023 },
2027 {}, 2024 {},
2028}; 2025};
2026MODULE_DEVICE_TABLE (of, mesh_match);
2029 2027
2030static struct macio_driver mesh_driver = 2028static struct macio_driver mesh_driver =
2031{ 2029{
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 1c9f71617123..7db2f37532cf 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -1545,7 +1545,7 @@ static void pmz_dispose_port(struct uart_pmac_port *uap)
1545/* 1545/*
1546 * Called upon match with an escc node in the devive-tree. 1546 * Called upon match with an escc node in the devive-tree.
1547 */ 1547 */
1548static int pmz_attach(struct macio_dev *mdev, const struct of_match *match) 1548static int pmz_attach(struct macio_dev *mdev, const struct of_device_id *match)
1549{ 1549{
1550 int i; 1550 int i;
1551 1551
@@ -1850,20 +1850,17 @@ err_out:
1850 return rc; 1850 return rc;
1851} 1851}
1852 1852
1853static struct of_match pmz_match[] = 1853static struct of_device_id pmz_match[] =
1854{ 1854{
1855 { 1855 {
1856 .name = "ch-a", 1856 .name = "ch-a",
1857 .type = OF_ANY_MATCH,
1858 .compatible = OF_ANY_MATCH
1859 }, 1857 },
1860 { 1858 {
1861 .name = "ch-b", 1859 .name = "ch-b",
1862 .type = OF_ANY_MATCH,
1863 .compatible = OF_ANY_MATCH
1864 }, 1860 },
1865 {}, 1861 {},
1866}; 1862};
1863MODULE_DEVICE_TABLE (of, pmz_match);
1867 1864
1868static struct macio_driver pmz_driver = 1865static struct macio_driver pmz_driver =
1869{ 1866{
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
index 3dd1de1539d2..b00887e9851c 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -523,7 +523,7 @@ int __init platinumfb_setup(char *options)
523#define invalidate_cache(addr) 523#define invalidate_cache(addr)
524#endif 524#endif
525 525
526static int __devinit platinumfb_probe(struct of_device* odev, const struct of_match *match) 526static int __devinit platinumfb_probe(struct of_device* odev, const struct of_device_id *match)
527{ 527{
528 struct device_node *dp = odev->node; 528 struct device_node *dp = odev->node;
529 struct fb_info *info; 529 struct fb_info *info;
@@ -647,12 +647,10 @@ static int __devexit platinumfb_remove(struct of_device* odev)
647 return 0; 647 return 0;
648} 648}
649 649
650static struct of_match platinumfb_match[] = 650static struct of_device_id platinumfb_match[] =
651{ 651{
652 { 652 {
653 .name = "platinum", 653 .name = "platinum",
654 .type = OF_ANY_MATCH,
655 .compatible = OF_ANY_MATCH,
656 }, 654 },
657 {}, 655 {},
658}; 656};
diff --git a/include/asm-ppc/macio.h b/include/asm-ppc/macio.h
index 2cafc9978607..a481b772d154 100644
--- a/include/asm-ppc/macio.h
+++ b/include/asm-ppc/macio.h
@@ -1,6 +1,7 @@
1#ifndef __MACIO_ASIC_H__ 1#ifndef __MACIO_ASIC_H__
2#define __MACIO_ASIC_H__ 2#define __MACIO_ASIC_H__
3 3
4#include <linux/mod_devicetable.h>
4#include <asm/of_device.h> 5#include <asm/of_device.h>
5 6
6extern struct bus_type macio_bus_type; 7extern struct bus_type macio_bus_type;
@@ -120,10 +121,10 @@ static inline struct pci_dev *macio_get_pci_dev(struct macio_dev *mdev)
120struct macio_driver 121struct macio_driver
121{ 122{
122 char *name; 123 char *name;
123 struct of_match *match_table; 124 struct of_device_id *match_table;
124 struct module *owner; 125 struct module *owner;
125 126
126 int (*probe)(struct macio_dev* dev, const struct of_match *match); 127 int (*probe)(struct macio_dev* dev, const struct of_device_id *match);
127 int (*remove)(struct macio_dev* dev); 128 int (*remove)(struct macio_dev* dev);
128 129
129 int (*suspend)(struct macio_dev* dev, pm_message_t state); 130 int (*suspend)(struct macio_dev* dev, pm_message_t state);
diff --git a/include/asm-ppc/of_device.h b/include/asm-ppc/of_device.h
index 7229735a7c18..4b264cfd3998 100644
--- a/include/asm-ppc/of_device.h
+++ b/include/asm-ppc/of_device.h
@@ -24,20 +24,8 @@ struct of_device
24}; 24};
25#define to_of_device(d) container_of(d, struct of_device, dev) 25#define to_of_device(d) container_of(d, struct of_device, dev)
26 26
27/* 27extern const struct of_device_id *of_match_device(
28 * Struct used for matching a device 28 const struct of_device_id *matches, const struct of_device *dev);
29 */
30struct of_match
31{
32 char *name;
33 char *type;
34 char *compatible;
35 void *data;
36};
37#define OF_ANY_MATCH ((char *)-1L)
38
39extern const struct of_match *of_match_device(
40 const struct of_match *matches, const struct of_device *dev);
41 29
42extern struct of_device *of_dev_get(struct of_device *dev); 30extern struct of_device *of_dev_get(struct of_device *dev);
43extern void of_dev_put(struct of_device *dev); 31extern void of_dev_put(struct of_device *dev);
@@ -49,10 +37,10 @@ extern void of_dev_put(struct of_device *dev);
49struct of_platform_driver 37struct of_platform_driver
50{ 38{
51 char *name; 39 char *name;
52 struct of_match *match_table; 40 struct of_device_id *match_table;
53 struct module *owner; 41 struct module *owner;
54 42
55 int (*probe)(struct of_device* dev, const struct of_match *match); 43 int (*probe)(struct of_device* dev, const struct of_device_id *match);
56 int (*remove)(struct of_device* dev); 44 int (*remove)(struct of_device* dev);
57 45
58 int (*suspend)(struct of_device* dev, pm_message_t state); 46 int (*suspend)(struct of_device* dev, pm_message_t state);
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 9b6d05172ed4..dce53ac1625d 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -174,6 +174,17 @@ struct serio_device_id {
174 __u8 proto; 174 __u8 proto;
175}; 175};
176 176
177/*
178 * Struct used for matching a device
179 */
180struct of_device_id
181{
182 char name[32];
183 char type[32];
184 char compatible[128];
185 void *data;
186};
187
177 188
178/* PCMCIA */ 189/* PCMCIA */
179 190
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 908bff6d1eef..5180405c1a84 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -25,6 +25,8 @@ typedef Elf64_Addr kernel_ulong_t;
25#include <stdint.h> 25#include <stdint.h>
26#endif 26#endif
27 27
28#include <ctype.h>
29
28typedef uint32_t __u32; 30typedef uint32_t __u32;
29typedef uint16_t __u16; 31typedef uint16_t __u16;
30typedef unsigned char __u8; 32typedef unsigned char __u8;
@@ -323,6 +325,22 @@ static int do_pcmcia_entry(const char *filename,
323 325
324 326
325 327
328static int do_of_entry (const char *filename, struct of_device_id *of, char *alias)
329{
330 char *tmp;
331 sprintf (alias, "of:N%sT%sC%s",
332 of->name[0] ? of->name : "*",
333 of->type[0] ? of->type : "*",
334 of->compatible[0] ? of->compatible : "*");
335
336 /* Replace all whitespace with underscores */
337 for (tmp = alias; tmp && *tmp; tmp++)
338 if (isspace (*tmp))
339 *tmp = '_';
340
341 return 1;
342}
343
326/* Ignore any prefix, eg. v850 prepends _ */ 344/* Ignore any prefix, eg. v850 prepends _ */
327static inline int sym_is(const char *symbol, const char *name) 345static inline int sym_is(const char *symbol, const char *name)
328{ 346{
@@ -401,6 +419,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
401 else if (sym_is(symname, "__mod_pcmcia_device_table")) 419 else if (sym_is(symname, "__mod_pcmcia_device_table"))
402 do_table(symval, sym->st_size, sizeof(struct pcmcia_device_id), 420 do_table(symval, sym->st_size, sizeof(struct pcmcia_device_id),
403 do_pcmcia_entry, mod); 421 do_pcmcia_entry, mod);
422 else if (sym_is(symname, "__mod_of_device_table"))
423 do_table(symval, sym->st_size, sizeof(struct of_device_id),
424 do_of_entry, mod);
425
404} 426}
405 427
406/* Now add out buffered information to the generated C source */ 428/* Now add out buffered information to the generated C source */