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

From: Takashi Iwai
Date: Thu Jan 25 2007 - 11:55:07 EST


At Thu, 25 Jan 2007 10:57:25 -0500,
Christopher "Monty" Montgomery wrote:
>
> On 1/25/07, Pierre Ossman <drzeus@xxxxxxxxx> wrote:
>
> > There is some option about deprecated sysfs stuff. Perhaps this is the
> > cause of your twisted tree. It's off here:
> >
> > # CONFIG_SYSFS_DEPRECATED is not set
>
> It is set. It is also set in the default config, so plently of people
> are running with a broken sysfs tree.
>
> I assume we agree that even if that's set, the tree should not be
> outright broken like it is (the compatability mode should actually be
> compatable, ie, work, right? :-) Given that, is my patch correct?
> What was there (plugging the old 'dev' arg into the new call's
> 'parent' makes no sense) is clearly wrong.

It makes sense because the meaning of card->dev was changed, too.
Now it points the "card*" object that is the root of all belonging
devices. The former card->dev is stored in card->parent.

> And it's clear my pacth is incomplete, as it doesn't correct the
> device entries for the other entries.

Well, for older systems, we shouldn't have also "card*" objects, too.
An untested patch below...


Takashi

diff -r 64671853e8e2 core/init.c
--- a/core/init.c Thu Jan 25 13:15:05 2007 +0100
+++ b/core/init.c Thu Jan 25 17:50:06 2007 +0100
@@ -503,12 +503,14 @@ int snd_card_register(struct snd_card *c
int err;

snd_assert(card != NULL, return -EINVAL);
+#ifndef CONFIG_SYSFS_DEPRECATED
if (!card->dev) {
card->dev = device_create(sound_class, card->parent, 0,
"card%i", card->number);
if (IS_ERR(card->dev))
card->dev = NULL;
}
+#endif
if ((err = snd_device_register_all(card)) < 0)
return err;
mutex_lock(&snd_card_mutex);
diff -r 64671853e8e2 core/sound.c
--- a/core/sound.c Thu Jan 25 13:15:05 2007 +0100
+++ b/core/sound.c Thu Jan 25 17:50:40 2007 +0100
@@ -241,6 +241,9 @@ int snd_register_device_for_dev(int type
int minor;
struct snd_minor *preg;

+ if (!device && !card)
+ device = card->parent;
+
snd_assert(name, return -EINVAL);
preg = kmalloc(sizeof *preg, GFP_KERNEL);
if (preg == NULL)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/