Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
[cascardo/linux.git] / drivers / of / device.c
index 4c74e4f..f685e55 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/slab.h>
 
 #include <asm/errno.h>
+#include "of_private.h"
 
 /**
  * of_match_device - Tell if a struct device matches an of_device_id list
@@ -131,6 +132,7 @@ ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)
 void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
        const char *compat;
+       struct alias_prop *app;
        int seen = 0, cplen, sl;
 
        if ((!dev) || (!dev->of_node))
@@ -153,6 +155,17 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
                seen++;
        }
        add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen);
+
+       seen = 0;
+       mutex_lock(&of_aliases_mutex);
+       list_for_each_entry(app, &aliases_lookup, link) {
+               if (dev->of_node == app->np) {
+                       add_uevent_var(env, "OF_ALIAS_%d=%s", seen,
+                                      app->alias);
+                       seen++;
+               }
+       }
+       mutex_unlock(&of_aliases_mutex);
 }
 
 int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env)