From: Greg KH <greg@kroah.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux-hotplug-devel@lists.sourceforge.net
Subject: [PATCH] add sysfs class support for ALSA sound devices [08/10]
Date: Thu, 15 Jan 2004 20:43:11 +0000 [thread overview]
Message-ID: <20040115204311.GI22199@kroah.com> (raw)
In-Reply-To: <20040115204259.GH22199@kroah.com>
This patch adds support for all ALSA sound devices. The previous OSS
sound patch is required for this one to work properly.
This patch is based on a work originally written by
Leann Ogasawara <ogasawara@osdl.org>
diff -Nru a/include/sound/core.h b/include/sound/core.h
--- a/include/sound/core.h Thu Jan 15 11:06:00 2004
+++ b/include/sound/core.h Thu Jan 15 11:06:00 2004
@@ -160,6 +160,7 @@
int shutdown; /* this card is going down */
wait_queue_head_t shutdown_sleep;
struct work_struct free_workq; /* for free in workqueue */
+ struct device *dev;
#ifdef CONFIG_PM
int (*set_power_state) (snd_card_t *card, unsigned int state);
diff -Nru a/sound/core/sound.c b/sound/core/sound.c
--- a/sound/core/sound.c Thu Jan 15 11:05:49 2004
+++ b/sound/core/sound.c Thu Jan 15 11:05:49 2004
@@ -38,9 +38,7 @@
static int major = CONFIG_SND_MAJOR;
int snd_major;
static int cards_limit = SNDRV_CARDS;
-#ifdef CONFIG_DEVFS_FS
static int device_mode = S_IFCHR | S_IRUGO | S_IWUGO;
-#endif
MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
MODULE_DESCRIPTION("Advanced Linux Sound Architecture driver for soundcards.");
@@ -66,6 +64,7 @@
static DECLARE_MUTEX(sound_mutex);
+extern struct class_simple *sound_class;
#ifdef CONFIG_KMOD
/**
@@ -203,6 +202,7 @@
{
int minor = snd_kernel_minor(type, card, dev);
snd_minor_t *preg;
+ struct device *device = NULL;
if (minor < 0)
return minor;
@@ -221,10 +221,14 @@
return -EBUSY;
}
list_add_tail(&preg->list, &snd_minors_hash[SNDRV_MINOR_CARD(minor)]);
-#ifdef CONFIG_DEVFS_FS
- if (strncmp(name, "controlC", 8)) /* created in sound.c */
+
+ if (strncmp(name, "controlC", 8)) { /* created in sound.c */
devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name);
-#endif
+ if (card)
+ device = card->dev;
+ class_simple_device_add(sound_class, MKDEV(major, minor), device, name);
+ }
+
up(&sound_mutex);
return 0;
}
@@ -252,10 +256,12 @@
up(&sound_mutex);
return -EINVAL;
}
-#ifdef CONFIG_DEVFS_FS
- if (strncmp(mptr->name, "controlC", 8)) /* created in sound.c */
+
+ if (strncmp(mptr->name, "controlC", 8)) { /* created in sound.c */
devfs_remove("snd/%s", mptr->name);
-#endif
+ class_simple_device_remove(MKDEV(major, minor));
+ }
+
list_del(&mptr->list);
up(&sound_mutex);
kfree(mptr);
@@ -322,9 +328,7 @@
static int __init alsa_sound_init(void)
{
-#ifdef CONFIG_DEVFS_FS
short controlnum;
-#endif
#ifdef CONFIG_SND_OSSEMUL
int err;
#endif
@@ -358,10 +362,10 @@
#ifdef CONFIG_SND_OSSEMUL
snd_info_minor_register();
#endif
-#ifdef CONFIG_DEVFS_FS
- for (controlnum = 0; controlnum < cards_limit; controlnum++)
+ for (controlnum = 0; controlnum < cards_limit; controlnum++) {
devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum);
-#endif
+ class_simple_device_add(sound_class, MKDEV(major, controlnum<<5), NULL, "controlC%d", controlnum);
+ }
#ifndef MODULE
printk(KERN_INFO "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n");
#endif
@@ -372,8 +376,10 @@
{
short controlnum;
- for (controlnum = 0; controlnum < cards_limit; controlnum++)
+ for (controlnum = 0; controlnum < cards_limit; controlnum++) {
devfs_remove("snd/controlC%d", controlnum);
+ class_simple_device_remove(MKDEV(major, controlnum<<5));
+ }
#ifdef CONFIG_SND_OSSEMUL
snd_info_minor_unregister();
diff -Nru a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
--- a/sound/pci/intel8x0.c Thu Jan 15 11:05:58 2004
+++ b/sound/pci/intel8x0.c Thu Jan 15 11:05:58 2004
@@ -2591,6 +2591,7 @@
break;
}
}
+ card->dev = &pci->dev;
if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, &chip)) < 0) {
snd_card_free(card);
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <greg@kroah.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux-hotplug-devel@lists.sourceforge.net
Subject: [PATCH] add sysfs class support for ALSA sound devices [08/10]
Date: Thu, 15 Jan 2004 12:43:11 -0800 [thread overview]
Message-ID: <20040115204311.GI22199@kroah.com> (raw)
In-Reply-To: <20040115204259.GH22199@kroah.com>
This patch adds support for all ALSA sound devices. The previous OSS
sound patch is required for this one to work properly.
This patch is based on a work originally written by
Leann Ogasawara <ogasawara@osdl.org>
diff -Nru a/include/sound/core.h b/include/sound/core.h
--- a/include/sound/core.h Thu Jan 15 11:06:00 2004
+++ b/include/sound/core.h Thu Jan 15 11:06:00 2004
@@ -160,6 +160,7 @@
int shutdown; /* this card is going down */
wait_queue_head_t shutdown_sleep;
struct work_struct free_workq; /* for free in workqueue */
+ struct device *dev;
#ifdef CONFIG_PM
int (*set_power_state) (snd_card_t *card, unsigned int state);
diff -Nru a/sound/core/sound.c b/sound/core/sound.c
--- a/sound/core/sound.c Thu Jan 15 11:05:49 2004
+++ b/sound/core/sound.c Thu Jan 15 11:05:49 2004
@@ -38,9 +38,7 @@
static int major = CONFIG_SND_MAJOR;
int snd_major;
static int cards_limit = SNDRV_CARDS;
-#ifdef CONFIG_DEVFS_FS
static int device_mode = S_IFCHR | S_IRUGO | S_IWUGO;
-#endif
MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
MODULE_DESCRIPTION("Advanced Linux Sound Architecture driver for soundcards.");
@@ -66,6 +64,7 @@
static DECLARE_MUTEX(sound_mutex);
+extern struct class_simple *sound_class;
#ifdef CONFIG_KMOD
/**
@@ -203,6 +202,7 @@
{
int minor = snd_kernel_minor(type, card, dev);
snd_minor_t *preg;
+ struct device *device = NULL;
if (minor < 0)
return minor;
@@ -221,10 +221,14 @@
return -EBUSY;
}
list_add_tail(&preg->list, &snd_minors_hash[SNDRV_MINOR_CARD(minor)]);
-#ifdef CONFIG_DEVFS_FS
- if (strncmp(name, "controlC", 8)) /* created in sound.c */
+
+ if (strncmp(name, "controlC", 8)) { /* created in sound.c */
devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name);
-#endif
+ if (card)
+ device = card->dev;
+ class_simple_device_add(sound_class, MKDEV(major, minor), device, name);
+ }
+
up(&sound_mutex);
return 0;
}
@@ -252,10 +256,12 @@
up(&sound_mutex);
return -EINVAL;
}
-#ifdef CONFIG_DEVFS_FS
- if (strncmp(mptr->name, "controlC", 8)) /* created in sound.c */
+
+ if (strncmp(mptr->name, "controlC", 8)) { /* created in sound.c */
devfs_remove("snd/%s", mptr->name);
-#endif
+ class_simple_device_remove(MKDEV(major, minor));
+ }
+
list_del(&mptr->list);
up(&sound_mutex);
kfree(mptr);
@@ -322,9 +328,7 @@
static int __init alsa_sound_init(void)
{
-#ifdef CONFIG_DEVFS_FS
short controlnum;
-#endif
#ifdef CONFIG_SND_OSSEMUL
int err;
#endif
@@ -358,10 +362,10 @@
#ifdef CONFIG_SND_OSSEMUL
snd_info_minor_register();
#endif
-#ifdef CONFIG_DEVFS_FS
- for (controlnum = 0; controlnum < cards_limit; controlnum++)
+ for (controlnum = 0; controlnum < cards_limit; controlnum++) {
devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum);
-#endif
+ class_simple_device_add(sound_class, MKDEV(major, controlnum<<5), NULL, "controlC%d", controlnum);
+ }
#ifndef MODULE
printk(KERN_INFO "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n");
#endif
@@ -372,8 +376,10 @@
{
short controlnum;
- for (controlnum = 0; controlnum < cards_limit; controlnum++)
+ for (controlnum = 0; controlnum < cards_limit; controlnum++) {
devfs_remove("snd/controlC%d", controlnum);
+ class_simple_device_remove(MKDEV(major, controlnum<<5));
+ }
#ifdef CONFIG_SND_OSSEMUL
snd_info_minor_unregister();
diff -Nru a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
--- a/sound/pci/intel8x0.c Thu Jan 15 11:05:58 2004
+++ b/sound/pci/intel8x0.c Thu Jan 15 11:05:58 2004
@@ -2591,6 +2591,7 @@
break;
}
}
+ card->dev = &pci->dev;
if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, &chip)) < 0) {
snd_card_free(card);
next prev parent reply other threads:[~2004-01-15 20:43 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-15 20:40 [PATCH] sysfs class patch update [00/10] Greg KH
2004-01-15 20:40 ` Greg KH
2004-01-15 20:41 ` [PATCH] add class_simple support [01/10] Greg KH
2004-01-15 20:41 ` Greg KH
2004-01-15 20:41 ` [PATCH] add sysfs class support for input devices [02/10] Greg KH
2004-01-15 20:41 ` Greg KH
2004-01-15 20:41 ` [PATCH] add class support for lp devices [03/10] Greg KH
2004-01-15 20:41 ` Greg KH
2004-01-15 20:41 ` [PATCH] add sysfs class support for mem devices [04/10] Greg KH
2004-01-15 20:41 ` Greg KH
2004-01-15 20:42 ` [PATCH] add sysfs class support for misc devices [05/10] Greg KH
2004-01-15 20:42 ` Greg KH
2004-01-15 20:42 ` [PATCH] add sysfs class support for raw devices [06/10] Greg KH
2004-01-15 20:42 ` Greg KH
2004-01-15 20:42 ` [PATCH] add sysfs class support for OSS sound devices [07/10] Greg KH
2004-01-15 20:42 ` Greg KH
2004-01-15 20:43 ` Greg KH [this message]
2004-01-15 20:43 ` [PATCH] add sysfs class support for ALSA sound devices [08/10] Greg KH
2004-01-15 20:43 ` [PATCH] clean up sysfs class support for tty devices [09/10] Greg KH
2004-01-15 20:43 ` Greg KH
2004-01-15 20:43 ` [PATCH] add sysfs class support for vc devices [10/10] Greg KH
2004-01-15 20:43 ` Greg KH
2004-01-16 4:13 ` Andrew Morton
2004-01-16 4:13 ` Andrew Morton
2004-01-16 19:04 ` Martin Schlemmer
2004-01-16 19:17 ` Andrew Morton
2004-01-16 19:17 ` Andrew Morton
2004-01-16 19:52 ` Martin Schlemmer
2004-01-16 22:15 ` [PATCH] add sysfs class support for ALSA sound devices [08/10] Måns Rullgård
2004-01-17 0:10 ` Greg KH
2004-01-17 0:10 ` Greg KH
2004-01-17 0:50 ` Måns Rullgård
2004-01-15 21:23 ` [PATCH] add sysfs class support for OSS sound devices [07/10] Prakash K. Cheemplavam
2004-01-15 21:23 ` Prakash K. Cheemplavam
2004-01-15 21:32 ` Greg KH
2004-01-15 21:32 ` Greg KH
2004-01-15 22:01 ` Prakash K. Cheemplavam
2004-01-20 1:58 ` [PATCH] add class_simple support [01/10] Rusty Russell
2004-01-20 1:58 ` Rusty Russell
2004-01-15 20:57 ` [PATCH] sysfs class patch update [00/10] Måns Rullgård
2004-01-15 22:56 ` Greg KH
2004-01-15 22:56 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040115204311.GI22199@kroah.com \
--to=greg@kroah.com \
--cc=akpm@osdl.org \
--cc=linux-hotplug-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.