diff options
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/device.c | 25 | ||||
-rw-r--r-- | drivers/of/fdt.c | 15 | ||||
-rw-r--r-- | drivers/of/of_i2c.c | 4 | ||||
-rw-r--r-- | drivers/of/of_mdio.c | 6 | ||||
-rw-r--r-- | drivers/of/of_spi.c | 2 | ||||
-rw-r--r-- | drivers/of/platform.c | 13 |
6 files changed, 36 insertions, 29 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c index 224ae6bc67b6..7d18f8e0b013 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c | |||
@@ -10,8 +10,7 @@ | |||
10 | #include <asm/errno.h> | 10 | #include <asm/errno.h> |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * of_match_device - Tell if an of_device structure has a matching | 13 | * of_match_device - Tell if a struct device matches an of_device_id list |
14 | * of_match structure | ||
15 | * @ids: array of of device match structures to search in | 14 | * @ids: array of of device match structures to search in |
16 | * @dev: the of device structure to match against | 15 | * @dev: the of device structure to match against |
17 | * | 16 | * |
@@ -19,11 +18,11 @@ | |||
19 | * system is in its list of supported devices. | 18 | * system is in its list of supported devices. |
20 | */ | 19 | */ |
21 | const struct of_device_id *of_match_device(const struct of_device_id *matches, | 20 | const struct of_device_id *of_match_device(const struct of_device_id *matches, |
22 | const struct of_device *dev) | 21 | const struct device *dev) |
23 | { | 22 | { |
24 | if (!dev->node) | 23 | if (!dev->of_node) |
25 | return NULL; | 24 | return NULL; |
26 | return of_match_node(matches, dev->node); | 25 | return of_match_node(matches, dev->of_node); |
27 | } | 26 | } |
28 | EXPORT_SYMBOL(of_match_device); | 27 | EXPORT_SYMBOL(of_match_device); |
29 | 28 | ||
@@ -54,7 +53,7 @@ static ssize_t devspec_show(struct device *dev, | |||
54 | struct of_device *ofdev; | 53 | struct of_device *ofdev; |
55 | 54 | ||
56 | ofdev = to_of_device(dev); | 55 | ofdev = to_of_device(dev); |
57 | return sprintf(buf, "%s\n", ofdev->node->full_name); | 56 | return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name); |
58 | } | 57 | } |
59 | 58 | ||
60 | static ssize_t name_show(struct device *dev, | 59 | static ssize_t name_show(struct device *dev, |
@@ -63,7 +62,7 @@ static ssize_t name_show(struct device *dev, | |||
63 | struct of_device *ofdev; | 62 | struct of_device *ofdev; |
64 | 63 | ||
65 | ofdev = to_of_device(dev); | 64 | ofdev = to_of_device(dev); |
66 | return sprintf(buf, "%s\n", ofdev->node->name); | 65 | return sprintf(buf, "%s\n", ofdev->dev.of_node->name); |
67 | } | 66 | } |
68 | 67 | ||
69 | static ssize_t modalias_show(struct device *dev, | 68 | static ssize_t modalias_show(struct device *dev, |
@@ -97,14 +96,14 @@ void of_release_dev(struct device *dev) | |||
97 | struct of_device *ofdev; | 96 | struct of_device *ofdev; |
98 | 97 | ||
99 | ofdev = to_of_device(dev); | 98 | ofdev = to_of_device(dev); |
100 | of_node_put(ofdev->node); | 99 | of_node_put(ofdev->dev.of_node); |
101 | kfree(ofdev); | 100 | kfree(ofdev); |
102 | } | 101 | } |
103 | EXPORT_SYMBOL(of_release_dev); | 102 | EXPORT_SYMBOL(of_release_dev); |
104 | 103 | ||
105 | int of_device_register(struct of_device *ofdev) | 104 | int of_device_register(struct of_device *ofdev) |
106 | { | 105 | { |
107 | BUG_ON(ofdev->node == NULL); | 106 | BUG_ON(ofdev->dev.of_node == NULL); |
108 | 107 | ||
109 | device_initialize(&ofdev->dev); | 108 | device_initialize(&ofdev->dev); |
110 | 109 | ||
@@ -112,7 +111,7 @@ int of_device_register(struct of_device *ofdev) | |||
112 | * the parent. If there is no parent defined, set the node | 111 | * the parent. If there is no parent defined, set the node |
113 | * explicitly */ | 112 | * explicitly */ |
114 | if (!ofdev->dev.parent) | 113 | if (!ofdev->dev.parent) |
115 | set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->node)); | 114 | set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->dev.of_node)); |
116 | 115 | ||
117 | return device_add(&ofdev->dev); | 116 | return device_add(&ofdev->dev); |
118 | } | 117 | } |
@@ -132,11 +131,11 @@ ssize_t of_device_get_modalias(struct of_device *ofdev, | |||
132 | ssize_t tsize, csize, repend; | 131 | ssize_t tsize, csize, repend; |
133 | 132 | ||
134 | /* Name & Type */ | 133 | /* Name & Type */ |
135 | csize = snprintf(str, len, "of:N%sT%s", | 134 | csize = snprintf(str, len, "of:N%sT%s", ofdev->dev.of_node->name, |
136 | ofdev->node->name, ofdev->node->type); | 135 | ofdev->dev.of_node->type); |
137 | 136 | ||
138 | /* Get compatible property if any */ | 137 | /* Get compatible property if any */ |
139 | compat = of_get_property(ofdev->node, "compatible", &cplen); | 138 | compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen); |
140 | if (!compat) | 139 | if (!compat) |
141 | return csize; | 140 | return csize; |
142 | 141 | ||
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index dee4fb56b094..b6987bba8556 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -556,6 +556,21 @@ void __init unflatten_device_tree(void) | |||
556 | 556 | ||
557 | pr_debug(" -> unflatten_device_tree()\n"); | 557 | pr_debug(" -> unflatten_device_tree()\n"); |
558 | 558 | ||
559 | if (!initial_boot_params) { | ||
560 | pr_debug("No device tree pointer\n"); | ||
561 | return; | ||
562 | } | ||
563 | |||
564 | pr_debug("Unflattening device tree:\n"); | ||
565 | pr_debug("magic: %08x\n", be32_to_cpu(initial_boot_params->magic)); | ||
566 | pr_debug("size: %08x\n", be32_to_cpu(initial_boot_params->totalsize)); | ||
567 | pr_debug("version: %08x\n", be32_to_cpu(initial_boot_params->version)); | ||
568 | |||
569 | if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) { | ||
570 | pr_err("Invalid device tree blob header\n"); | ||
571 | return; | ||
572 | } | ||
573 | |||
559 | /* First pass, scan for size */ | 574 | /* First pass, scan for size */ |
560 | start = ((unsigned long)initial_boot_params) + | 575 | start = ((unsigned long)initial_boot_params) + |
561 | be32_to_cpu(initial_boot_params->off_dt_struct); | 576 | be32_to_cpu(initial_boot_params->off_dt_struct); |
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c index a3a708e590d0..ab6522c8e4fe 100644 --- a/drivers/of/of_i2c.c +++ b/drivers/of/of_i2c.c | |||
@@ -42,7 +42,7 @@ void of_register_i2c_devices(struct i2c_adapter *adap, | |||
42 | 42 | ||
43 | info.addr = be32_to_cpup(addr); | 43 | info.addr = be32_to_cpup(addr); |
44 | 44 | ||
45 | dev_archdata_set_node(&dev_ad, node); | 45 | info.of_node = node; |
46 | info.archdata = &dev_ad; | 46 | info.archdata = &dev_ad; |
47 | 47 | ||
48 | request_module("%s", info.type); | 48 | request_module("%s", info.type); |
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(of_register_i2c_devices); | |||
68 | 68 | ||
69 | static int of_dev_node_match(struct device *dev, void *data) | 69 | static int of_dev_node_match(struct device *dev, void *data) |
70 | { | 70 | { |
71 | return dev_archdata_get_node(&dev->archdata) == data; | 71 | return dev->of_node == data; |
72 | } | 72 | } |
73 | 73 | ||
74 | /* must call put_device() when done with returned i2c_client device */ | 74 | /* must call put_device() when done with returned i2c_client device */ |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index b4748337223b..42a6715f8e84 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -79,7 +79,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | |||
79 | /* Associate the OF node with the device structure so it | 79 | /* Associate the OF node with the device structure so it |
80 | * can be looked up later */ | 80 | * can be looked up later */ |
81 | of_node_get(child); | 81 | of_node_get(child); |
82 | dev_archdata_set_node(&phy->dev.archdata, child); | 82 | phy->dev.of_node = child; |
83 | 83 | ||
84 | /* All data is now stored in the phy struct; register it */ | 84 | /* All data is now stored in the phy struct; register it */ |
85 | rc = phy_device_register(phy); | 85 | rc = phy_device_register(phy); |
@@ -100,7 +100,7 @@ EXPORT_SYMBOL(of_mdiobus_register); | |||
100 | /* Helper function for of_phy_find_device */ | 100 | /* Helper function for of_phy_find_device */ |
101 | static int of_phy_match(struct device *dev, void *phy_np) | 101 | static int of_phy_match(struct device *dev, void *phy_np) |
102 | { | 102 | { |
103 | return dev_archdata_get_node(&dev->archdata) == phy_np; | 103 | return dev->of_node == phy_np; |
104 | } | 104 | } |
105 | 105 | ||
106 | /** | 106 | /** |
@@ -166,7 +166,7 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, | |||
166 | if (!dev->dev.parent) | 166 | if (!dev->dev.parent) |
167 | return NULL; | 167 | return NULL; |
168 | 168 | ||
169 | net_np = dev_archdata_get_node(&dev->dev.parent->archdata); | 169 | net_np = dev->dev.parent->of_node; |
170 | if (!net_np) | 170 | if (!net_np) |
171 | return NULL; | 171 | return NULL; |
172 | 172 | ||
diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c index f65f48b98448..5fed7e3c7da3 100644 --- a/drivers/of/of_spi.c +++ b/drivers/of/of_spi.c | |||
@@ -79,7 +79,7 @@ void of_register_spi_devices(struct spi_master *master, struct device_node *np) | |||
79 | 79 | ||
80 | /* Store a pointer to the node in the device structure */ | 80 | /* Store a pointer to the node in the device structure */ |
81 | of_node_get(nc); | 81 | of_node_get(nc); |
82 | spi->dev.archdata.of_node = nc; | 82 | spi->dev.of_node = nc; |
83 | 83 | ||
84 | /* Register the new device */ | 84 | /* Register the new device */ |
85 | request_module(spi->modalias); | 85 | request_module(spi->modalias); |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index d58ade170c4b..7dacc1ebe91e 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -21,14 +21,12 @@ extern struct device_attribute of_platform_device_attrs[]; | |||
21 | 21 | ||
22 | static int of_platform_bus_match(struct device *dev, struct device_driver *drv) | 22 | static int of_platform_bus_match(struct device *dev, struct device_driver *drv) |
23 | { | 23 | { |
24 | struct of_device *of_dev = to_of_device(dev); | 24 | const struct of_device_id *matches = drv->of_match_table; |
25 | struct of_platform_driver *of_drv = to_of_platform_driver(drv); | ||
26 | const struct of_device_id *matches = of_drv->match_table; | ||
27 | 25 | ||
28 | if (!matches) | 26 | if (!matches) |
29 | return 0; | 27 | return 0; |
30 | 28 | ||
31 | return of_match_device(matches, of_dev) != NULL; | 29 | return of_match_device(matches, dev) != NULL; |
32 | } | 30 | } |
33 | 31 | ||
34 | static int of_platform_device_probe(struct device *dev) | 32 | static int of_platform_device_probe(struct device *dev) |
@@ -46,7 +44,7 @@ static int of_platform_device_probe(struct device *dev) | |||
46 | 44 | ||
47 | of_dev_get(of_dev); | 45 | of_dev_get(of_dev); |
48 | 46 | ||
49 | match = of_match_device(drv->match_table, of_dev); | 47 | match = of_match_device(drv->driver.of_match_table, dev); |
50 | if (match) | 48 | if (match) |
51 | error = drv->probe(of_dev, match); | 49 | error = drv->probe(of_dev, match); |
52 | if (error) | 50 | if (error) |
@@ -386,11 +384,6 @@ int of_bus_type_init(struct bus_type *bus, const char *name) | |||
386 | 384 | ||
387 | int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus) | 385 | int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus) |
388 | { | 386 | { |
389 | /* initialize common driver fields */ | ||
390 | if (!drv->driver.name) | ||
391 | drv->driver.name = drv->name; | ||
392 | if (!drv->driver.owner) | ||
393 | drv->driver.owner = drv->owner; | ||
394 | drv->driver.bus = bus; | 387 | drv->driver.bus = bus; |
395 | 388 | ||
396 | /* register with core */ | 389 | /* register with core */ |