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.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 12a44b493511..0d8a0644f540 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -26,7 +26,7 @@ const struct of_device_id *of_match_device(const struct of_device_id *matches,
26} 26}
27EXPORT_SYMBOL(of_match_device); 27EXPORT_SYMBOL(of_match_device);
28 28
29struct of_device *of_dev_get(struct of_device *dev) 29struct platform_device *of_dev_get(struct platform_device *dev)
30{ 30{
31 struct device *tmp; 31 struct device *tmp;
32 32
@@ -34,13 +34,13 @@ struct of_device *of_dev_get(struct of_device *dev)
34 return NULL; 34 return NULL;
35 tmp = get_device(&dev->dev); 35 tmp = get_device(&dev->dev);
36 if (tmp) 36 if (tmp)
37 return to_of_device(tmp); 37 return to_platform_device(tmp);
38 else 38 else
39 return NULL; 39 return NULL;
40} 40}
41EXPORT_SYMBOL(of_dev_get); 41EXPORT_SYMBOL(of_dev_get);
42 42
43void of_dev_put(struct of_device *dev) 43void of_dev_put(struct platform_device *dev)
44{ 44{
45 if (dev) 45 if (dev)
46 put_device(&dev->dev); 46 put_device(&dev->dev);
@@ -50,18 +50,18 @@ EXPORT_SYMBOL(of_dev_put);
50static ssize_t devspec_show(struct device *dev, 50static ssize_t devspec_show(struct device *dev,
51 struct device_attribute *attr, char *buf) 51 struct device_attribute *attr, char *buf)
52{ 52{
53 struct of_device *ofdev; 53 struct platform_device *ofdev;
54 54
55 ofdev = to_of_device(dev); 55 ofdev = to_platform_device(dev);
56 return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name); 56 return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
57} 57}
58 58
59static ssize_t name_show(struct device *dev, 59static ssize_t name_show(struct device *dev,
60 struct device_attribute *attr, char *buf) 60 struct device_attribute *attr, char *buf)
61{ 61{
62 struct of_device *ofdev; 62 struct platform_device *ofdev;
63 63
64 ofdev = to_of_device(dev); 64 ofdev = to_platform_device(dev);
65 return sprintf(buf, "%s\n", ofdev->dev.of_node->name); 65 return sprintf(buf, "%s\n", ofdev->dev.of_node->name);
66} 66}
67 67
@@ -90,15 +90,15 @@ struct device_attribute of_platform_device_attrs[] = {
90 */ 90 */
91void of_release_dev(struct device *dev) 91void of_release_dev(struct device *dev)
92{ 92{
93 struct of_device *ofdev; 93 struct platform_device *ofdev;
94 94
95 ofdev = to_of_device(dev); 95 ofdev = to_platform_device(dev);
96 of_node_put(ofdev->dev.of_node); 96 of_node_put(ofdev->dev.of_node);
97 kfree(ofdev); 97 kfree(ofdev);
98} 98}
99EXPORT_SYMBOL(of_release_dev); 99EXPORT_SYMBOL(of_release_dev);
100 100
101int of_device_register(struct of_device *ofdev) 101int of_device_register(struct platform_device *ofdev)
102{ 102{
103 BUG_ON(ofdev->dev.of_node == NULL); 103 BUG_ON(ofdev->dev.of_node == NULL);
104 104
@@ -119,7 +119,7 @@ int of_device_register(struct of_device *ofdev)
119} 119}
120EXPORT_SYMBOL(of_device_register); 120EXPORT_SYMBOL(of_device_register);
121 121
122void of_device_unregister(struct of_device *ofdev) 122void of_device_unregister(struct platform_device *ofdev)
123{ 123{
124 device_unregister(&ofdev->dev); 124 device_unregister(&ofdev->dev);
125} 125}