1 From 2507b27c0841752a6f419439896fcb089fa4a5ba Mon Sep 17 00:00:00 2001
2 From: Sylvain Munaut <tnt@246tNt.com>
3 Date: Sat, 23 Dec 2006 23:13:56 +0100
4 Subject: [PATCH] [PATCH] macintosh: Use the new of_device common uevent handler
6 The generation of the uevent is now common to all bus using
9 Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
11 drivers/macintosh/macio_asic.c | 98 +---------------------------------------
12 1 files changed, 1 insertions(+), 97 deletions(-)
14 diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
15 index d562160..e851266 100644
16 --- a/drivers/macintosh/macio_asic.c
17 +++ b/drivers/macintosh/macio_asic.c
18 @@ -134,108 +134,12 @@ static int macio_device_resume(struct device * dev)
22 -static int macio_uevent(struct device *dev, char **envp, int num_envp,
23 - char *buffer, int buffer_size)
25 - struct macio_dev * macio_dev;
26 - struct of_device * of;
28 - const char *compat, *compat2;
31 - int length, cplen, cplen2, seen = 0;
36 - macio_dev = to_macio_device(dev);
40 - of = &macio_dev->ofdev;
42 - /* stuff we want to pass to /sbin/hotplug */
43 - envp[i++] = scratch = buffer;
44 - length = scnprintf (scratch, buffer_size, "OF_NAME=%s", of->node->name);
46 - buffer_size -= length;
47 - if ((buffer_size <= 0) || (i >= num_envp))
51 - envp[i++] = scratch;
52 - length = scnprintf (scratch, buffer_size, "OF_TYPE=%s", of->node->type);
54 - buffer_size -= length;
55 - if ((buffer_size <= 0) || (i >= num_envp))
59 - /* Since the compatible field can contain pretty much anything
60 - * it's not really legal to split it out with commas. We split it
61 - * up using a number of environment variables instead. */
63 - compat = get_property(of->node, "compatible", &cplen);
66 - while (compat && cplen > 0) {
67 - envp[i++] = scratch;
68 - length = scnprintf (scratch, buffer_size,
69 - "OF_COMPATIBLE_%d=%s", seen, compat);
71 - buffer_size -= length;
72 - if ((buffer_size <= 0) || (i >= num_envp))
75 - length = strlen (compat) + 1;
81 - envp[i++] = scratch;
82 - length = scnprintf (scratch, buffer_size, "OF_COMPATIBLE_N=%d", seen);
84 - buffer_size -= length;
85 - if ((buffer_size <= 0) || (i >= num_envp))
89 - envp[i++] = scratch;
90 - length = scnprintf (scratch, buffer_size, "MODALIAS=of:N%sT%s",
91 - of->node->name, of->node->type);
92 - /* overwrite '\0' */
93 - buffer_size -= length;
94 - if ((buffer_size <= 0) || (i >= num_envp))
102 - while (cplen2 > 0) {
103 - length = snprintf (scratch, buffer_size, "C%s", compat2);
104 - buffer_size -= length;
105 - if (buffer_size <= 0)
108 - length = strlen (compat2) + 1;
118 extern struct device_attribute macio_dev_attrs[];
120 struct bus_type macio_bus_type = {
122 .match = macio_bus_match,
123 - .uevent = macio_uevent,
124 + .uevent = of_device_uevent,
125 .probe = macio_device_probe,
126 .remove = macio_device_remove,
127 .shutdown = macio_device_shutdown,