Re: sysfs & ALSA card

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 7 Oct 2006, Kay Sievers wrote:

> On Sat, Oct 07, 2006 at 02:55:31PM +0200, Kay Sievers wrote:
> > On Sat, 2006-10-07 at 00:44 -0700, Greg KH wrote: 
> > >  $ tree /sys/class/sound/
> > >  /sys/class/sound/
> > >  |-- Audigy2 -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2
> > >  |-- admmidi1 -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/admmidi1
> 
> > > Yeah, I picked the wrong name for the card, it should be "card1" instead
> > > of "Audigy2" here, but you get the idea.
> > 
> > That looks nice. Yeah, it should something that matches to the C1 in the
> > other names.
> 
> This works fine for me with two soundcards and connect/disconnect
> module load/unload.
> 
> All devices are in a flat list in the class directory, also the card%i
> ones:
>   $ tree /sys/class/sound/
>   /sys/class/sound/
>   |-- adsp -> ../../devices/pci0000:00/0000:00:1e.2/card0/adsp

....

> In the /sys/devices hierarchy all devices belonging to the same card are
> nicely below the card device:
>   $ ls -l /sys/devices/pci0000:00/0000:00:1e.2/card0
>   total 0
>   drwxr-xr-x 3 root root    0 2006-10-07 21:09 0-0:AD1981B
>   drwxr-xr-x 3 root root    0 2006-10-07 21:09 adsp
>   drwxr-xr-x 3 root root    0 2006-10-07 21:09 audio

....

The implementation looks good (Acked-by: Jaroslav Kysela <[email protected]>).
Please, fix this small typo:

> --- linux-2.6.orig/sound/core/sound.c
> +++ linux-2.6/sound/core/sound.c
> @@ -268,11 +268,10 @@ int snd_register_device(int type, struct
>  	snd_minors[minor] = preg;
>  	if (card)
>  		device = card->dev;
> -	preg->class_dev = class_device_create(sound_class, NULL,
> -					      MKDEV(major, minor),
> -					      device, "%s", name);
> -	if (preg->class_dev)
> -		class_set_devdata(preg->class_dev, private_data);
> +	preg->dev = device_create(sound_class, device, MKDEV(major, minor),
> +				  "%s", name);
> +	if (preg->dev)
> +		dev_get_drvdata(preg->dev);

I think, it should be:

	if (preg->dev)
		dev_set_drvdata(preg->dev, private_data);

						Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux