aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/macio_asic.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-30 11:10:12 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-30 11:10:12 -0400
commit24a77daf3d80bddcece044e6dc3675e427eef3f3 (patch)
tree2c5e0b0bea394d6fe62c5d5857c252e83e48ac48 /drivers/macintosh/macio_asic.c
parente389f9aec689209724105ae80a6c91fd2e747bc9 (diff)
parentf900e9777fc9b65140cb9570438597bc8fae56ab (diff)
Merge branch 'for-2.6.22' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'for-2.6.22' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (255 commits) [POWERPC] Remove dev_dbg redefinition in drivers/ps3/vuart.c [POWERPC] remove kernel module option for booke wdt [POWERPC] Avoid putting cpu node twice [POWERPC] Spinlock initializer cleanup [POWERPC] ppc4xx_sgdma needs dma-mapping.h [POWERPC] arch/powerpc/sysdev/timer.c build fix [POWERPC] get_property cleanups [POWERPC] Remove the unused HTDMSOUND driver [POWERPC] cell: cbe_cpufreq cleanup and crash fix [POWERPC] Declare enable_kernel_spe in a header [POWERPC] Add dt_xlate_addr() to bootwrapper [POWERPC] bootwrapper: CONFIG_ -> CONFIG_DEVICE_TREE [POWERPC] Don't define a custom bd_t for Xilixn Virtex based boards. [POWERPC] Add sane defaults for Xilinx EDK generated xparameters files [POWERPC] Add uartlite boot console driver for the zImage wrapper [POWERPC] Stop using ppc_sys for Xilinx Virtex boards [POWERPC] New registration for common Xilinx Virtex ppc405 platform devices [POWERPC] Merge common virtex header files [POWERPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform [POWERPC] Clean up cpufreq Kconfig dependencies ...
Diffstat (limited to 'drivers/macintosh/macio_asic.c')
-rw-r--r--drivers/macintosh/macio_asic.c100
1 files changed, 2 insertions, 98 deletions
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index d56216067549..c96b7fe882a4 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -134,108 +134,12 @@ static int macio_device_resume(struct device * dev)
134 return 0; 134 return 0;
135} 135}
136 136
137static int macio_uevent(struct device *dev, char **envp, int num_envp,
138 char *buffer, int buffer_size)
139{
140 struct macio_dev * macio_dev;
141 struct of_device * of;
142 char *scratch;
143 const char *compat, *compat2;
144
145 int i = 0;
146 int length, cplen, cplen2, seen = 0;
147
148 if (!dev)
149 return -ENODEV;
150
151 macio_dev = to_macio_device(dev);
152 if (!macio_dev)
153 return -ENODEV;
154
155 of = &macio_dev->ofdev;
156
157 /* stuff we want to pass to /sbin/hotplug */
158 envp[i++] = scratch = buffer;
159 length = scnprintf (scratch, buffer_size, "OF_NAME=%s", of->node->name);
160 ++length;
161 buffer_size -= length;
162 if ((buffer_size <= 0) || (i >= num_envp))
163 return -ENOMEM;
164 scratch += length;
165
166 envp[i++] = scratch;
167 length = scnprintf (scratch, buffer_size, "OF_TYPE=%s", of->node->type);
168 ++length;
169 buffer_size -= length;
170 if ((buffer_size <= 0) || (i >= num_envp))
171 return -ENOMEM;
172 scratch += length;
173
174 /* Since the compatible field can contain pretty much anything
175 * it's not really legal to split it out with commas. We split it
176 * up using a number of environment variables instead. */
177
178 compat = get_property(of->node, "compatible", &cplen);
179 compat2 = compat;
180 cplen2= cplen;
181 while (compat && cplen > 0) {
182 envp[i++] = scratch;
183 length = scnprintf (scratch, buffer_size,
184 "OF_COMPATIBLE_%d=%s", seen, compat);
185 ++length;
186 buffer_size -= length;
187 if ((buffer_size <= 0) || (i >= num_envp))
188 return -ENOMEM;
189 scratch += length;
190 length = strlen (compat) + 1;
191 compat += length;
192 cplen -= length;
193 seen++;
194 }
195
196 envp[i++] = scratch;
197 length = scnprintf (scratch, buffer_size, "OF_COMPATIBLE_N=%d", seen);
198 ++length;
199 buffer_size -= length;
200 if ((buffer_size <= 0) || (i >= num_envp))
201 return -ENOMEM;
202 scratch += length;
203
204 envp[i++] = scratch;
205 length = scnprintf (scratch, buffer_size, "MODALIAS=of:N%sT%s",
206 of->node->name, of->node->type);
207 /* overwrite '\0' */
208 buffer_size -= length;
209 if ((buffer_size <= 0) || (i >= num_envp))
210 return -ENOMEM;
211 scratch += length;
212
213 if (!compat2) {
214 compat2 = "";
215 cplen2 = 1;
216 }
217 while (cplen2 > 0) {
218 length = snprintf (scratch, buffer_size, "C%s", compat2);
219 buffer_size -= length;
220 if (buffer_size <= 0)
221 return -ENOMEM;
222 scratch += length;
223 length = strlen (compat2) + 1;
224 compat2 += length;
225 cplen2 -= length;
226 }
227
228 envp[i] = NULL;
229
230 return 0;
231}
232
233extern struct device_attribute macio_dev_attrs[]; 137extern struct device_attribute macio_dev_attrs[];
234 138
235struct bus_type macio_bus_type = { 139struct bus_type macio_bus_type = {
236 .name = "macio", 140 .name = "macio",
237 .match = macio_bus_match, 141 .match = macio_bus_match,
238 .uevent = macio_uevent, 142 .uevent = of_device_uevent,
239 .probe = macio_device_probe, 143 .probe = macio_device_probe,
240 .remove = macio_device_remove, 144 .remove = macio_device_remove,
241 .shutdown = macio_device_shutdown, 145 .shutdown = macio_device_shutdown,
@@ -491,7 +395,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
491#endif 395#endif
492 MAX_NODE_NAME_SIZE, np->name); 396 MAX_NODE_NAME_SIZE, np->name);
493 } else { 397 } else {
494 reg = get_property(np, "reg", NULL); 398 reg = of_get_property(np, "reg", NULL);
495 sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s", 399 sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s",
496 chip->lbus.index, 400 chip->lbus.index,
497 reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); 401 reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name);