diff options
-rw-r--r-- | arch/microblaze/include/asm/of_device.h | 3 | ||||
-rw-r--r-- | drivers/macintosh/macio_sysfs.c | 5 | ||||
-rw-r--r-- | drivers/of/device.c | 16 | ||||
-rw-r--r-- | include/linux/of_device.h | 2 |
4 files changed, 8 insertions, 18 deletions
diff --git a/arch/microblaze/include/asm/of_device.h b/arch/microblaze/include/asm/of_device.h index 58e627dc1412..c9be53487434 100644 --- a/arch/microblaze/include/asm/of_device.h +++ b/arch/microblaze/include/asm/of_device.h | |||
@@ -15,9 +15,6 @@ | |||
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/of.h> | 16 | #include <linux/of.h> |
17 | 17 | ||
18 | extern ssize_t of_device_get_modalias(struct of_device *ofdev, | ||
19 | char *str, ssize_t len); | ||
20 | |||
21 | extern struct of_device *of_device_alloc(struct device_node *np, | 18 | extern struct of_device *of_device_alloc(struct device_node *np, |
22 | const char *bus_id, | 19 | const char *bus_id, |
23 | struct device *parent); | 20 | struct device *parent); |
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index 6999ce59fd10..6024038a5b9d 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c | |||
@@ -41,10 +41,7 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf) | |||
41 | static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, | 41 | static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, |
42 | char *buf) | 42 | char *buf) |
43 | { | 43 | { |
44 | struct of_device *ofdev = to_of_device(dev); | 44 | int len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2); |
45 | int len; | ||
46 | |||
47 | len = of_device_get_modalias(ofdev, buf, PAGE_SIZE - 2); | ||
48 | 45 | ||
49 | buf[len] = '\n'; | 46 | buf[len] = '\n'; |
50 | buf[len+1] = 0; | 47 | buf[len+1] = 0; |
diff --git a/drivers/of/device.c b/drivers/of/device.c index 275cc9cee14c..c2a98f5ca80d 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c | |||
@@ -68,10 +68,7 @@ static ssize_t name_show(struct device *dev, | |||
68 | static ssize_t modalias_show(struct device *dev, | 68 | static ssize_t modalias_show(struct device *dev, |
69 | struct device_attribute *attr, char *buf) | 69 | struct device_attribute *attr, char *buf) |
70 | { | 70 | { |
71 | struct of_device *ofdev = to_of_device(dev); | 71 | ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2); |
72 | ssize_t len = 0; | ||
73 | |||
74 | len = of_device_get_modalias(ofdev, buf, PAGE_SIZE - 2); | ||
75 | buf[len] = '\n'; | 72 | buf[len] = '\n'; |
76 | buf[len+1] = 0; | 73 | buf[len+1] = 0; |
77 | return len+1; | 74 | return len+1; |
@@ -123,19 +120,18 @@ void of_device_unregister(struct of_device *ofdev) | |||
123 | } | 120 | } |
124 | EXPORT_SYMBOL(of_device_unregister); | 121 | EXPORT_SYMBOL(of_device_unregister); |
125 | 122 | ||
126 | ssize_t of_device_get_modalias(struct of_device *ofdev, | 123 | ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len) |
127 | char *str, ssize_t len) | ||
128 | { | 124 | { |
129 | const char *compat; | 125 | const char *compat; |
130 | int cplen, i; | 126 | int cplen, i; |
131 | ssize_t tsize, csize, repend; | 127 | ssize_t tsize, csize, repend; |
132 | 128 | ||
133 | /* Name & Type */ | 129 | /* Name & Type */ |
134 | csize = snprintf(str, len, "of:N%sT%s", ofdev->dev.of_node->name, | 130 | csize = snprintf(str, len, "of:N%sT%s", dev->of_node->name, |
135 | ofdev->dev.of_node->type); | 131 | dev->of_node->type); |
136 | 132 | ||
137 | /* Get compatible property if any */ | 133 | /* Get compatible property if any */ |
138 | compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen); | 134 | compat = of_get_property(dev->of_node, "compatible", &cplen); |
139 | if (!compat) | 135 | if (!compat) |
140 | return csize; | 136 | return csize; |
141 | 137 | ||
@@ -210,7 +206,7 @@ int of_device_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
210 | if (add_uevent_var(env, "MODALIAS=")) | 206 | if (add_uevent_var(env, "MODALIAS=")) |
211 | return -ENOMEM; | 207 | return -ENOMEM; |
212 | 208 | ||
213 | sl = of_device_get_modalias(to_of_device(dev), &env->buf[env->buflen-1], | 209 | sl = of_device_get_modalias(dev, &env->buf[env->buflen-1], |
214 | sizeof(env->buf) - env->buflen); | 210 | sizeof(env->buf) - env->buflen); |
215 | if (sl >= (sizeof(env->buf) - env->buflen)) | 211 | if (sl >= (sizeof(env->buf) - env->buflen)) |
216 | return -ENOMEM; | 212 | return -ENOMEM; |
diff --git a/include/linux/of_device.h b/include/linux/of_device.h index da83e734c026..238e92e007e6 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h | |||
@@ -42,7 +42,7 @@ static inline void of_device_free(struct of_device *dev) | |||
42 | of_release_dev(&dev->dev); | 42 | of_release_dev(&dev->dev); |
43 | } | 43 | } |
44 | 44 | ||
45 | extern ssize_t of_device_get_modalias(struct of_device *ofdev, | 45 | extern ssize_t of_device_get_modalias(struct device *dev, |
46 | char *str, ssize_t len); | 46 | char *str, ssize_t len); |
47 | 47 | ||
48 | extern int of_device_uevent(struct device *dev, struct kobj_uevent_env *env); | 48 | extern int of_device_uevent(struct device *dev, struct kobj_uevent_env *env); |