diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-11-20 14:06:59 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 12:29:17 +0100 |
commit | f87135f56cb266e031f5ec081dfbde7e43f55e80 (patch) | |
tree | c048abae6bb04df53f5d8d7dcffbf2c28bc638ff /sound/core/oss/mixer_oss.c | |
parent | 6983b7240cd229787c3ee00e663ea94ea649d96a (diff) |
[ALSA] dynamic minors (3/6): store device-specific object pointers dynamically
Instead of storing the pointers to the device-specific structures in an
array, put them into the struct snd_minor, and look them up dynamically.
This makes the device type modules independent of the minor number
encoding.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/core/oss/mixer_oss.c')
-rw-r--r-- | sound/core/oss/mixer_oss.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 2dd6bf9b49e..2d7a42014f5 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -41,12 +41,13 @@ MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_MIXER); static int snd_mixer_oss_open(struct inode *inode, struct file *file) { - int cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode)); struct snd_card *card; struct snd_mixer_oss_file *fmixer; int err; - if ((card = snd_cards[cardnum]) == NULL) + card = snd_lookup_oss_minor_data(iminor(inode), + SNDRV_OSS_DEVICE_TYPE_MIXER); + if (card == NULL) return -ENODEV; if (card->mixer_oss == NULL) return -ENODEV; @@ -1286,7 +1287,7 @@ static int snd_mixer_oss_notify_handler(struct snd_card *card, int cmd) sprintf(name, "mixer%i%i", card->number, 0); if ((err = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER, card, 0, - &snd_mixer_oss_f_ops, + &snd_mixer_oss_f_ops, card, name)) < 0) { snd_printk(KERN_ERR "unable to register OSS mixer device %i:%i\n", card->number, 0); |