From 7d2aae1e88660cf09be913e9754e45189dc33412 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 26 Jan 2007 12:40:31 +0100 Subject: [PATCH] ALSA: Fix sysfs breakage The recent change for a new sysfs tree with card* object breaks the /sys/class/sound tree if CONFIG_SYSFS_DEPRECATED is enabled. The device in each entry doesn't point the correct device object: /sys/class/sound ... |-- pcmC0D0c | |-- dev | |-- device -> ../../../class/sound/card0 | |-- pcm_class | |-- power | | `-- wakeup | |-- subsystem -> ../../../class/sound | `-- uevent Also, this change breaks some drivers (like sound/arm/*) referring card->dev directly to obtain the device object for memory handling. This patch reverts the semantics of card->dev to the former version, which points to a real device object. The card* object is stored in a new card->card_dev field, instead. The device parent is chosen either card->dev or card->card_dev according to CONFIG_SYSFS_DEPRECATED to keep the tree compatibility. Also, card* isn't created if CONFIG_SYSFS_DEPRECATED is enabled. The reason of card* object is a root of all beloing devices, and it makes little sense if each sound device points to the real device object directly. Signed-off-by: Takashi Iwai Acked-by: Monty Montgomery Signed-off-by: Greg Kroah-Hartman --- sound/core/sound.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sound/core/sound.c') diff --git a/sound/core/sound.c b/sound/core/sound.c index 282742022de6..82a61c67cf3a 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -238,7 +238,7 @@ int snd_register_device(int type, struct snd_card *card, int dev, { int minor; struct snd_minor *preg; - struct device *device = NULL; + struct device *device = snd_card_get_device_link(card); snd_assert(name, return -EINVAL); preg = kmalloc(sizeof *preg, GFP_KERNEL); @@ -263,8 +263,6 @@ int snd_register_device(int type, struct snd_card *card, int dev, return minor; } snd_minors[minor] = preg; - if (card) - device = card->dev; preg->dev = device_create(sound_class, device, MKDEV(major, minor), "%s", name); if (preg->dev) -- cgit v1.2.3