From: Sylvain Munaut <tnt@246tNt.com>
To: Paul Mackerras <paulus@samba.org>
Cc: Sylvain Munaut <tnt@246tNt.com>, Arnd Bergmann <arnd@arndb.de>,
Linux PPC Devel <linuxppc-dev@ozlabs.org>
Subject: [PATCH 2/4] macintosh: Use the new of_device common uevent handler
Date: Mon, 18 Dec 2006 23:46:37 +0100 [thread overview]
Message-ID: <11664820003098-git-send-email-tnt@246tNt.com> (raw)
In-Reply-To: <1166482000535-git-send-email-tnt@246tNt.com>
The generation of the uevent is now common to all bus using
of_device.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
---
drivers/macintosh/macio_asic.c | 81 ----------------------------------------
1 files changed, 1 insertions(+), 80 deletions(-)
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index d562160..767ad00 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -139,11 +139,6 @@ static int macio_uevent(struct device *d
{
struct macio_dev * macio_dev;
struct of_device * of;
- char *scratch;
- const char *compat, *compat2;
-
- int i = 0;
- int length, cplen, cplen2, seen = 0;
if (!dev)
return -ENODEV;
@@ -153,81 +148,7 @@ static int macio_uevent(struct device *d
return -ENODEV;
of = &macio_dev->ofdev;
-
- /* stuff we want to pass to /sbin/hotplug */
- envp[i++] = scratch = buffer;
- length = scnprintf (scratch, buffer_size, "OF_NAME=%s", of->node->name);
- ++length;
- buffer_size -= length;
- if ((buffer_size <= 0) || (i >= num_envp))
- return -ENOMEM;
- scratch += length;
-
- envp[i++] = scratch;
- length = scnprintf (scratch, buffer_size, "OF_TYPE=%s", of->node->type);
- ++length;
- buffer_size -= length;
- if ((buffer_size <= 0) || (i >= num_envp))
- return -ENOMEM;
- scratch += length;
-
- /* Since the compatible field can contain pretty much anything
- * it's not really legal to split it out with commas. We split it
- * up using a number of environment variables instead. */
-
- compat = get_property(of->node, "compatible", &cplen);
- compat2 = compat;
- cplen2= cplen;
- while (compat && cplen > 0) {
- envp[i++] = scratch;
- length = scnprintf (scratch, buffer_size,
- "OF_COMPATIBLE_%d=%s", seen, compat);
- ++length;
- buffer_size -= length;
- if ((buffer_size <= 0) || (i >= num_envp))
- return -ENOMEM;
- scratch += length;
- length = strlen (compat) + 1;
- compat += length;
- cplen -= length;
- seen++;
- }
-
- envp[i++] = scratch;
- length = scnprintf (scratch, buffer_size, "OF_COMPATIBLE_N=%d", seen);
- ++length;
- buffer_size -= length;
- if ((buffer_size <= 0) || (i >= num_envp))
- return -ENOMEM;
- scratch += length;
-
- envp[i++] = scratch;
- length = scnprintf (scratch, buffer_size, "MODALIAS=of:N%sT%s",
- of->node->name, of->node->type);
- /* overwrite '\0' */
- buffer_size -= length;
- if ((buffer_size <= 0) || (i >= num_envp))
- return -ENOMEM;
- scratch += length;
-
- if (!compat2) {
- compat2 = "";
- cplen2 = 1;
- }
- while (cplen2 > 0) {
- length = snprintf (scratch, buffer_size, "C%s", compat2);
- buffer_size -= length;
- if (buffer_size <= 0)
- return -ENOMEM;
- scratch += length;
- length = strlen (compat2) + 1;
- compat2 += length;
- cplen2 -= length;
- }
-
- envp[i] = NULL;
-
- return 0;
+ return of_device_uevent(of, envp, num_envp, buffer, buffer_size);
}
extern struct device_attribute macio_dev_attrs[];
--
1.4.2
next prev parent reply other threads:[~2006-12-18 22:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-18 22:46 [PATCH 0/3] uevents handler for macio & of_platform Sylvain Munaut
2006-12-18 22:46 ` [PATCH 1/4] powerpc: Add a unified uevent handler for bus based on of_device Sylvain Munaut
2006-12-18 22:46 ` Sylvain Munaut [this message]
2006-12-18 22:46 ` [PATCH 3/4] powerpc: Add uevent handler for of_platform_bus Sylvain Munaut
2006-12-18 22:46 ` [PATCH 4/4] powerpc: Add uevent handler for ibmebus Sylvain Munaut
2006-12-18 23:03 ` Arnd Bergmann
2006-12-18 23:09 ` Sylvain Munaut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11664820003098-git-send-email-tnt@246tNt.com \
--to=tnt@246tnt.com \
--cc=arnd@arndb.de \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.