linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 OSS sound devices [07/10]
Date: Thu, 15 Jan 2004 20:42:59 +0000	[thread overview]
Message-ID: <20040115204259.GH22199@kroah.com> (raw)
In-Reply-To: <20040115204241.GG22199@kroah.com>


This patch adds support for all OSS sound devices.

This patch is based on a work originally written by 
Leann Ogasawara <ogasawara@osdl.org>



diff -Nru a/sound/oss/soundcard.c b/sound/oss/soundcard.c
--- a/sound/oss/soundcard.c	Thu Jan 15 11:06:01 2004
+++ b/sound/oss/soundcard.c	Thu Jan 15 11:06:01 2004
@@ -73,6 +73,7 @@
 
 
 unsigned long seq_time = 0;	/* Time for /dev/sequencer */
+extern struct class_simple *sound_class;
 
 /*
  * Table for configurable mixer volume handling
@@ -569,6 +570,9 @@
 		devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor),
 				S_IFCHR | dev_list[i].mode,
 				"sound/%s", dev_list[i].name);
+		class_simple_device_add(sound_class, 
+					MKDEV(SOUND_MAJOR, dev_list[i].minor),
+					NULL, "%s", dev_list[i].name);
 
 		if (!dev_list[i].num)
 			continue;
@@ -578,6 +582,10 @@
 						dev_list[i].minor + (j*0x10)),
 					S_IFCHR | dev_list[i].mode,
 					"sound/%s%d", dev_list[i].name, j);
+			class_simple_device_add(sound_class,
+					MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)),
+					NULL,
+					"%s%d", dev_list[i].name, j);
 		}
 	}
 
@@ -593,10 +601,13 @@
 
 	for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) {
 		devfs_remove("sound/%s", dev_list[i].name);
+		class_simple_device_remove(MKDEV(SOUND_MAJOR, dev_list[i].minor));
 		if (!dev_list[i].num)
 			continue;
-		for (j = 1; j < *dev_list[i].num; j++)
+		for (j = 1; j < *dev_list[i].num; j++) {
 			devfs_remove("sound/%s%d", dev_list[i].name, j);
+			class_simple_device_remove(MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)));
+		}
 	}
 	
 	unregister_sound_special(1);
diff -Nru a/sound/sound_core.c b/sound/sound_core.c
--- a/sound/sound_core.c	Thu Jan 15 11:05:56 2004
+++ b/sound/sound_core.c	Thu Jan 15 11:05:56 2004
@@ -65,6 +65,9 @@
 extern int msnd_pinnacle_init(void);
 #endif
 
+struct class_simple *sound_class;
+EXPORT_SYMBOL(sound_class);
+
 /*
  *	Low level list operator. Scan the ordered list, find a hole and
  *	join into it. Called with the lock asserted
@@ -171,6 +174,8 @@
 
 	devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor),
 			S_IFCHR | mode, s->name);
+	class_simple_device_add(sound_class, MKDEV(SOUND_MAJOR, s->unit_minor),
+				NULL, s->name+6);
 	return r;
 
  fail:
@@ -193,6 +198,7 @@
 	spin_unlock(&sound_loader_lock);
 	if (p) {
 		devfs_remove(p->name);
+		class_simple_device_remove(MKDEV(SOUND_MAJOR, p->unit_minor));
 		kfree(p);
 	}
 }
@@ -556,6 +562,7 @@
 	   empty */
 	unregister_chrdev(SOUND_MAJOR, "sound");
 	devfs_remove("sound");
+	class_simple_destroy(sound_class);
 }
 
 static int __init init_soundcore(void)
@@ -565,6 +572,9 @@
 		return -EBUSY;
 	}
 	devfs_mk_dir ("sound");
+	sound_class = class_simple_create(THIS_MODULE, "sound");
+	if (IS_ERR(sound_class))
+		return PTR_ERR(sound_class);
 
 	return 0;
 }


-------------------------------------------------------
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

  reply	other threads:[~2004-01-15 20:42 UTC|newest]

Thread overview: 20+ 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:41 ` [PATCH] add class_simple support [01/10] Greg KH
2004-01-15 20:41   ` [PATCH] add sysfs class support for input devices [02/10] Greg KH
2004-01-15 20:41     ` [PATCH] add class support for lp devices [03/10] Greg KH
2004-01-15 20:41       ` [PATCH] add sysfs class support for mem devices [04/10] Greg KH
2004-01-15 20:42         ` [PATCH] add sysfs class support for misc devices [05/10] 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 [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                   ` [PATCH] add sysfs class support for vc devices [10/10] Greg KH
2004-01-16  4:13                     ` Andrew Morton
     [not found]                       ` <1074279897.23742.754.camel@nosferatu.lan>
2004-01-16 19:17                         ` Andrew Morton
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-15 21:23               ` [PATCH] add sysfs class support for OSS sound devices [07/10] Prakash K. Cheemplavam
2004-01-15 21:32                 ` Greg KH
2004-01-20  1:58   ` [PATCH] add class_simple support [01/10] 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

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=20040115204259.GH22199@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).