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

Takashi Iwai
2007-01-25T18:23:30Z

At Thu, 25 Jan 2007 13:07:04 -0500,
xiphmont@xiph.org wrote:
>
> On 1/25/07, Takashi Iwai <tiwai@suse.de> wrote:
> > At Thu, 25 Jan 2007 12:30:44 -0500,
> > xiphmont@xiph.org wrote:
> > >
> > > > I'm working on this now and will doublecheck just in case my test was
> > > > flawed first time.
> > >
> > > Doublechecking indicates my initial test was wrong somehow; both
> > > card->dev->parent and card->parent passed as arg 2 to the
> > > device_create call in snd_register_device result in correct device
> > > symlinks. Are these two actually semantically different? I'm just
> > > curious.
> >
> > If card->dev is created, they should be identical.
> > But, again, card->dev should be NULL on the older systems.
> >
> > > The call to device_create in cound_core.c:sound_insert_unit also needs
> > > to be modified in order for the device symlinks in the other unit
> > > types to be correct. Again, modifying the 'dev' argument to
> > > '(dev?dev->parent:NULL)' appears to fix the problem. Is that
> > > correct/appropriate there?
> >
> > Your change breaks the expected heavior if CONFIG_SYSFS_DEPRECATED is
> > enabled. Then devices won't belong to card* objects any more...
>
> FWIW, CONFIG_SYSFS_DEPRECATED is enabled on all my machines-- it's
> exactly that behavior that is wrong in 2.6.20-rc5 and that I'm trying
> to fix (and testing against here/now).

Err, replace /enabled/disabled/ in my reply above.

The problem with your patch is that it breaks the structure newly
introduced. In the new tree, card* contains the whole belonging
devices, and each device points to the one in the card object.
Passing dev->parent there cuts the relation between the card object
and each device.

That's why my patch rules out setting card->dev with ifdef
CONFIG_SYSFS_DEPRECATED. As fallback, it takes the parent device to
build the old style tree.

> Having just checked a 2.6.18 machine, none of the device symlinks
> point to card* objects; thay all point to /sys/devices/....

Yes, it's a new stuff.

Takashi