From: Chris Rankin <rankinc@pacbell.net>
To: linux-sound@vger.kernel.org
Subject: [PATCH] : register_sound_special() fails for unit >= 16
Date: Wed, 01 Aug 2001 02:06:35 +0000 [thread overview]
Message-ID: <marc-linux-sound-99663181326838@msgid-missing> (raw)
Hi,
I have noticed that the register_sound_special() function in
drivers/sound/sound_core.c implicitly assumes that it will never be
asked to allocate a device with a minor number >= 16. This is
unfortunate because some 3rd party kernel modules use
register_sound_special() to create all their device nodes. If (as I
do) you have more than one sound device then you are stuck when you
need /dev/dsp1, /dev/mixer1 etc.
I have written a small patch that solves this; any feedback would be
greatly appreciated. Note that I have also renamed "sequencer2" to
"music" to resolve a name conflict between devices (14,8) and (14,33),
and "midi00" to "midi" to bring this function into line with
register_sound_midi().
Cheers,
Chris
--- drivers/sound/sound_core.c.orig Tue Jul 31 18:26:12 2001
+++ drivers/sound/sound_core.c Tue Jul 31 18:41:45 2001
@@ -17,7 +17,7 @@
* plug into this. The fact they dont all go via OSS doesn't mean
* they don't have to implement the OSS API. There is a lot of logic
* to keeping much of the OSS weight out of the code in a compatibility
- * module, but its up to the driver to rember to load it...
+ * module, but its up to the driver to remember to load it...
*
* The code provides a set of functions for registration of devices
* by type. This is done rather than providing a single call so that
@@ -173,10 +173,10 @@
return r;
}
- if (r = low)
+ if ( r < SOUND_STEP )
sprintf (name_buf, "%s", name);
else
- sprintf (name_buf, "%s%d", name, (r - low) / SOUND_STEP);
+ sprintf (name_buf, "%s%d", name, (r / SOUND_STEP));
s->de = devfs_register (devfs_handle, name_buf,
DEVFS_FL_NONE, SOUND_MAJOR, s->unit_minor,
S_IFCHR | mode, fops, NULL);
@@ -231,9 +231,10 @@
int register_sound_special(struct file_operations *fops, int unit)
{
- char *name;
+ const int chain = (unit & 0x0F);
+ const char *name;
- switch (unit) {
+ switch (chain) {
case 0:
name = "mixer";
break;
@@ -241,7 +242,7 @@
name = "sequencer";
break;
case 2:
- name = "midi00";
+ name = "midi";
break;
case 3:
name = "dsp";
@@ -259,7 +260,7 @@
name = "unknown7";
break;
case 8:
- name = "sequencer2";
+ name = "music";
break;
case 9:
name = "dmmidi";
@@ -283,7 +284,7 @@
name = "unknown";
break;
}
- return sound_insert_unit(&chains[unit&15], fops, -1, unit, unit+1,
+ return sound_insert_unit(&chains[chain], fops, -1, unit, chain+128,
name, S_IRUSR | S_IWUSR);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-sound" in
the body of a message to majordomo@vger.kernel.org
reply other threads:[~2001-08-01 2:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=marc-linux-sound-99663181326838@msgid-missing \
--to=rankinc@pacbell.net \
--cc=linux-sound@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.