diff options
Diffstat (limited to 'drivers/of/device.c')
-rw-r--r-- | drivers/of/device.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c index 62b4b32ac887..4c74e4fc5a51 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c | |||
@@ -128,39 +128,41 @@ ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len) | |||
128 | /** | 128 | /** |
129 | * of_device_uevent - Display OF related uevent information | 129 | * of_device_uevent - Display OF related uevent information |
130 | */ | 130 | */ |
131 | int of_device_uevent(struct device *dev, struct kobj_uevent_env *env) | 131 | void of_device_uevent(struct device *dev, struct kobj_uevent_env *env) |
132 | { | 132 | { |
133 | const char *compat; | 133 | const char *compat; |
134 | int seen = 0, cplen, sl; | 134 | int seen = 0, cplen, sl; |
135 | 135 | ||
136 | if ((!dev) || (!dev->of_node)) | 136 | if ((!dev) || (!dev->of_node)) |
137 | return -ENODEV; | 137 | return; |
138 | |||
139 | if (add_uevent_var(env, "OF_NAME=%s", dev->of_node->name)) | ||
140 | return -ENOMEM; | ||
141 | 138 | ||
142 | if (add_uevent_var(env, "OF_TYPE=%s", dev->of_node->type)) | 139 | add_uevent_var(env, "OF_NAME=%s", dev->of_node->name); |
143 | return -ENOMEM; | 140 | add_uevent_var(env, "OF_FULLNAME=%s", dev->of_node->full_name); |
141 | if (dev->of_node->type && strcmp("<NULL>", dev->of_node->type) != 0) | ||
142 | add_uevent_var(env, "OF_TYPE=%s", dev->of_node->type); | ||
144 | 143 | ||
145 | /* Since the compatible field can contain pretty much anything | 144 | /* Since the compatible field can contain pretty much anything |
146 | * it's not really legal to split it out with commas. We split it | 145 | * it's not really legal to split it out with commas. We split it |
147 | * up using a number of environment variables instead. */ | 146 | * up using a number of environment variables instead. */ |
148 | |||
149 | compat = of_get_property(dev->of_node, "compatible", &cplen); | 147 | compat = of_get_property(dev->of_node, "compatible", &cplen); |
150 | while (compat && *compat && cplen > 0) { | 148 | while (compat && *compat && cplen > 0) { |
151 | if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat)) | 149 | add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat); |
152 | return -ENOMEM; | ||
153 | |||
154 | sl = strlen(compat) + 1; | 150 | sl = strlen(compat) + 1; |
155 | compat += sl; | 151 | compat += sl; |
156 | cplen -= sl; | 152 | cplen -= sl; |
157 | seen++; | 153 | seen++; |
158 | } | 154 | } |
155 | add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen); | ||
156 | } | ||
159 | 157 | ||
160 | if (add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen)) | 158 | int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env) |
161 | return -ENOMEM; | 159 | { |
160 | int sl; | ||
161 | |||
162 | if ((!dev) || (!dev->of_node)) | ||
163 | return -ENODEV; | ||
162 | 164 | ||
163 | /* modalias is trickier, we add it in 2 steps */ | 165 | /* Devicetree modalias is tricky, we add it in 2 steps */ |
164 | if (add_uevent_var(env, "MODALIAS=")) | 166 | if (add_uevent_var(env, "MODALIAS=")) |
165 | return -ENOMEM; | 167 | return -ENOMEM; |
166 | 168 | ||