aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/of/device.c')
-rw-r--r--drivers/of/device.c25
1 files changed, 12 insertions, 13 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 */
21const struct of_device_id *of_match_device(const struct of_device_id *matches, 20const 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}
28EXPORT_SYMBOL(of_match_device); 27EXPORT_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
60static ssize_t name_show(struct device *dev, 59static 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
69static ssize_t modalias_show(struct device *dev, 68static 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}
103EXPORT_SYMBOL(of_release_dev); 102EXPORT_SYMBOL(of_release_dev);
104 103
105int of_device_register(struct of_device *ofdev) 104int 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