Re: [Alsa-devel] [PATCH] alsa: correct nonsensical sysfs device symlinks

Christopher "Monty" Montgomery
2007-01-25T17:48:14Z

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

Updated version of patch also taking into account feedback from
Takashi is attached.

I'm going to look at hald now.

Monty

[-- Attachment #2: alsa-sysfs-fix-2.6.20-rc5-updated.txt --]
[-- Type: text/plain, Size: 1300 bytes --]

diff -uprN -X linux-2.6.20-rc5/Documentation/dontdiff linux-2.6.20-rc5/sound/core/sound.c linux-2.6.20-rc5-monty/sound/core/sound.c
--- linux-2.6.20-rc5/sound/core/sound.c 2007-01-12 13:54:26.000000000 -0500
+++ linux-2.6.20-rc5-monty/sound/core/sound.c 2007-01-25 12:31:28.000000000 -0500
@@ -264,8 +264,10 @@ int snd_register_device(int type, struct
}
snd_minors[minor] = preg;
if (card)
- device = card->dev;
- preg->dev = device_create(sound_class, device, MKDEV(major, minor),
+ device = card->parent;
+ preg->dev = device_create(sound_class,
+ device,
+ MKDEV(major, minor),
"%s", name);
if (preg->dev)
dev_set_drvdata(preg->dev, private_data);
diff -uprN -X linux-2.6.20-rc5/Documentation/dontdiff linux-2.6.20-rc5/sound/sound_core.c linux-2.6.20-rc5-monty/sound/sound_core.c
--- linux-2.6.20-rc5/sound/sound_core.c 2007-01-12 13:54:26.000000000 -0500
+++ linux-2.6.20-rc5-monty/sound/sound_core.c 2007-01-25 12:04:30.000000000 -0500
@@ -170,7 +170,8 @@ static int sound_insert_unit(struct soun
else
sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP);

- device_create(sound_class, dev, MKDEV(SOUND_MAJOR, s->unit_minor),
+ device_create(sound_class, (dev?dev->parent:NULL),
+ MKDEV(SOUND_MAJOR, s->unit_minor),
s->name+6);
return r;