From d80f19fab89cba8a6d16193154c8ff3edab00942 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 7 Aug 2006 22:19:37 -0700 Subject: Driver core: convert sound core to use struct device Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. It also makes the struct sound_card to show up as a "real" device where all the different sound class devices are placed as childs and different card attribute files can hang off of. /sys/class/sound is still a flat directory, but the symlink targets of all devices belonging to the same card, point the the /sys/devices tree below the new card device object. Thanks to Kay for the updates to this patch. Signed-off-by: Kay Sievers Acked-by: Jaroslav Kysela Signed-off-by: Greg Kroah-Hartman --- sound/core/pcm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sound/core/pcm.c') diff --git a/sound/core/pcm.c b/sound/core/pcm.c index fbbbcd20c4c..5ac6e19ccb4 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -910,7 +910,8 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream) substream->pstr->substream_opened--; } -static ssize_t show_pcm_class(struct class_device *class_device, char *buf) +static ssize_t show_pcm_class(struct device *dev, + struct device_attribute *attr, char *buf) { struct snd_pcm *pcm; const char *str; @@ -921,7 +922,7 @@ static ssize_t show_pcm_class(struct class_device *class_device, char *buf) [SNDRV_PCM_CLASS_DIGITIZER] = "digitizer", }; - if (! (pcm = class_get_devdata(class_device)) || + if (! (pcm = dev_get_drvdata(dev)) || pcm->dev_class > SNDRV_PCM_CLASS_LAST) str = "none"; else @@ -929,7 +930,7 @@ static ssize_t show_pcm_class(struct class_device *class_device, char *buf) return snprintf(buf, PAGE_SIZE, "%s\n", str); } -static struct class_device_attribute pcm_attrs = +static struct device_attribute pcm_attrs = __ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL); static int snd_pcm_dev_register(struct snd_device *device) -- cgit v1.2.3