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

From: Greg KH
Date: Fri Jan 26 2007 - 13:06:14 EST


On Fri, Jan 26, 2007 at 12:40:31PM +0100, Takashi Iwai wrote:
> At Fri, 26 Jan 2007 05:53:36 -0500,
> xiphmont@xxxxxxxx wrote:
> >
> > On 1/25/07, Greg KH <greg@xxxxxxxxx> wrote:
> >
> > > Is there anything else left to fix?
> >
> > Once that testing is done, no. But don't trust the two patches I sent
> > yet, I'll resumbit the patch resulting from more thorough testing in a
> > few hours (much thanks to Takashi for giving me the parent device
> > feedback I was trolling for).
>
> After rechecking the current code regarding this sysfs change at last
> night, I found out that it's more broken for some devices like
> sound/arm/*. They refer to card->dev to obtain the device for memory
> allocation, etc, and passing card* object will screw them up.
>
> The below is my current fix. Hoepfully all evils got away now... and
> thanks for Monty for heading up this issue!
>
>
> Takashi
>
> ====
> [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 <tiwai@xxxxxxx>

Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

Thanks for working on tracking this down, sorry I forgot all about this
when doing this original conversion.

greg k-h
-
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/