aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-06-08 09:48:12 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-07-05 18:14:28 -0400
commitdd27dcda37f0b1a3b674760fb411abc5c8fe309c (patch)
treef6b582fabc8b4f723f8209102665442fcba53364 /arch/powerpc/kernel
parentd3571c3acfabb6f3a93b517b75d9b30eb7e8692e (diff)
of/device: merge of_device_uevent
Merge common code between powerpc and microblaze Signed-off-by: Grant Likely <grant.likely@secretlab.ca> CC: Michal Simek <monstr@monstr.eu> CC: Wolfram Sang <w.sang@pengutronix.de> CC: Stephen Rothwell <sfr@canb.auug.org.au> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: microblaze-uclinux@itee.uq.edu.au CC: linuxppc-dev@ozlabs.org
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/of_device.c49
1 files changed, 0 insertions, 49 deletions
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index df78e0236a02..db91a9dbafb5 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -82,52 +82,3 @@ struct of_device *of_device_alloc(struct device_node *np,
82 return dev; 82 return dev;
83} 83}
84EXPORT_SYMBOL(of_device_alloc); 84EXPORT_SYMBOL(of_device_alloc);
85
86int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
87{
88 struct of_device *ofdev;
89 const char *compat;
90 int seen = 0, cplen, sl;
91
92 if (!dev)
93 return -ENODEV;
94
95 ofdev = to_of_device(dev);
96
97 if (add_uevent_var(env, "OF_NAME=%s", ofdev->dev.of_node->name))
98 return -ENOMEM;
99
100 if (add_uevent_var(env, "OF_TYPE=%s", ofdev->dev.of_node->type))
101 return -ENOMEM;
102
103 /* Since the compatible field can contain pretty much anything
104 * it's not really legal to split it out with commas. We split it
105 * up using a number of environment variables instead. */
106
107 compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen);
108 while (compat && *compat && cplen > 0) {
109 if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
110 return -ENOMEM;
111
112 sl = strlen (compat) + 1;
113 compat += sl;
114 cplen -= sl;
115 seen++;
116 }
117
118 if (add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen))
119 return -ENOMEM;
120
121 /* modalias is trickier, we add it in 2 steps */
122 if (add_uevent_var(env, "MODALIAS="))
123 return -ENOMEM;
124 sl = of_device_get_modalias(ofdev, &env->buf[env->buflen-1],
125 sizeof(env->buf) - env->buflen);
126 if (sl >= (sizeof(env->buf) - env->buflen))
127 return -ENOMEM;
128 env->buflen += sl;
129
130 return 0;
131}
132EXPORT_SYMBOL(of_device_uevent);
133EXPORT_SYMBOL(of_device_get_modalias);