linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Sylvain Munaut <tnt@246tNt.com>
Cc: Linux PPC Dev ML <linuxppc-dev@ozlabs.org>,
	Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH 08/10] macintosh: Use the new of_device common uevent handler
Date: Tue, 27 Mar 2007 16:30:09 +1000	[thread overview]
Message-ID: <1174977009.14065.0.camel@localhost.localdomain> (raw)
In-Reply-To: <11713184182928-git-send-email-tnt@246tNt.com>

On Mon, 2007-02-12 at 23:13 +0100, Sylvain Munaut wrote:
> The generation of the uevent is now common to all bus using
> of_device.

I haven't managed to figure out why so far (a quick inspection of the
code didn't show anything obvious) but with your patch, the snd-aoa
driver fails to auto-load at boot... might be the modalias being broken,
dunno.

Ben.

> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
> ---
>  drivers/macintosh/macio_asic.c |   98 ----------------------------------------
>  1 files changed, 1 insertions(+), 97 deletions(-)
> 
> diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
> index d562160..e851266 100644
> --- a/drivers/macintosh/macio_asic.c
> +++ b/drivers/macintosh/macio_asic.c
> @@ -134,108 +134,12 @@ static int macio_device_resume(struct de
>  	return 0;
>  }
>  
> -static int macio_uevent(struct device *dev, char **envp, int num_envp,
> -                          char *buffer, int buffer_size)
> -{
> -	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;
> -
> -	macio_dev = to_macio_device(dev);
> -	if (!macio_dev)
> -		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;
> -}
> -
>  extern struct device_attribute macio_dev_attrs[];
>  
>  struct bus_type macio_bus_type = {
>         .name	= "macio",
>         .match	= macio_bus_match,
> -       .uevent = macio_uevent,
> +       .uevent = of_device_uevent,
>         .probe	= macio_device_probe,
>         .remove	= macio_device_remove,
>         .shutdown = macio_device_shutdown,

  parent reply	other threads:[~2007-03-27  6:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-12 22:13 [PATCH 00/10] Mainly 52xx patches for 2.6.21 (but not only) Sylvain Munaut
2007-02-12 22:13 ` [PATCH 01/10] powerpc/serial: Dispose irq mapping when done in mpc52xx_serial.c Sylvain Munaut
2007-02-12 22:13   ` [PATCH 02/10] powerpc: Add device tree fixups for the EFIKA Sylvain Munaut
2007-02-12 22:13     ` [PATCH 03/10] powerpc: Restore 'proper' link order in platform Sylvain Munaut
2007-02-12 22:13       ` [PATCH 04/10] powerpc: Use common 52xx of_platform probe code for EFIKA Sylvain Munaut
2007-02-12 22:13         ` [PATCH 05/10] powerpc: Fix unbalanced of_node_{get, put} in efika-setup.c Sylvain Munaut
2007-02-12 22:13           ` [PATCH 06/10] powerpc: Small cleanup of EFIKA platform Sylvain Munaut
2007-02-12 22:13             ` [PATCH 07/10] powerpc: Add a unified uevent handler for bus based on of_device Sylvain Munaut
2007-02-12 22:13               ` [PATCH 08/10] macintosh: Use the new of_device common uevent handler Sylvain Munaut
2007-02-12 22:13                 ` [PATCH 09/10] powerpc: Add uevent handler for of_platform_bus Sylvain Munaut
2007-02-12 22:13                   ` [PATCH 10/10] powerpc: Add uevent handler for ibmebus Sylvain Munaut
2007-03-29 14:46                     ` Olaf Hering
2007-03-30 11:27                       ` Hoang-Nam Nguyen
2007-03-30 11:45                         ` Sylvain Munaut
2007-03-27  6:30                 ` Benjamin Herrenschmidt [this message]
2007-03-27  7:11                   ` [PATCH 08/10] macintosh: Use the new of_device common uevent handler Sylvain Munaut
2007-03-28 10:29                     ` Johannes Berg
2007-03-28 10:58                       ` Sylvain Munaut
2007-03-28 11:10                         ` Johannes Berg
2007-02-12 23:06     ` [PATCH 02/10] powerpc: Add device tree fixups for the EFIKA Kumar Gala
2007-02-12 23:11       ` Sylvain Munaut
2007-02-12 23:18       ` Benjamin Herrenschmidt
2007-02-12 23:12     ` Benjamin Herrenschmidt
2007-02-12 23:25       ` Sylvain Munaut
2007-02-13  0:20         ` Benjamin Herrenschmidt
2007-02-16 16:44           ` Segher Boessenkool
2007-02-12 23:10   ` [PATCH 01/10] powerpc/serial: Dispose irq mapping when done in mpc52xx_serial.c Benjamin Herrenschmidt
2007-02-15 22:18 ` [PATCH] " 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=1174977009.14065.0.camel@localhost.localdomain \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    --cc=tnt@246tNt.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).