diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-11-20 14:03:48 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 12:29:14 +0100 |
commit | 2af677fc884fc6dc79e65c99050ea607ac8bab9b (patch) | |
tree | 4291d36c2f116d5887b88da5f0213b68933a1201 /sound/core/sound_oss.c | |
parent | a106cd3d9e88c8761bd0eac2ce402cc82bd11fea (diff) | |
download | kernel_samsung_aries-2af677fc884fc6dc79e65c99050ea607ac8bab9b.zip kernel_samsung_aries-2af677fc884fc6dc79e65c99050ea607ac8bab9b.tar.gz kernel_samsung_aries-2af677fc884fc6dc79e65c99050ea607ac8bab9b.tar.bz2 |
[ALSA] dynamic minors (1/6): store device type in struct snd_minor
Instead of a comment string, store the device type in the snd_minor
structure. This makes snd_minor more flexible, and has the nice side
effect that we don't need anymore to create a separate snd_minor
template for registering a device but can pass the file_operations
directly to snd_register_device().
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/core/sound_oss.c')
-rw-r--r-- | sound/core/sound_oss.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index ec37604..4d189ff 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c @@ -91,7 +91,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev) } int snd_register_oss_device(int type, struct snd_card *card, int dev, - struct snd_minor * reg, const char *name) + struct file_operations *f_ops, const char *name) { int minor = snd_oss_kernel_minor(type, card, dev); int minor_unit; @@ -103,12 +103,13 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, if (minor < 0) return minor; - preg = (struct snd_minor *)kmalloc(sizeof(struct snd_minor), GFP_KERNEL); + preg = kzalloc(sizeof(struct snd_minor), GFP_KERNEL); if (preg == NULL) return -ENOMEM; - *preg = *reg; preg->number = minor; + preg->type = type; preg->device = dev; + preg->f_ops = f_ops; down(&sound_oss_mutex); list_add_tail(&preg->list, &snd_oss_minors_hash[cidx]); minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); @@ -125,11 +126,12 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, } if (card) carddev = card->dev; - register1 = register_sound_special_device(reg->f_ops, minor, carddev); + register1 = register_sound_special_device(f_ops, minor, carddev); if (register1 != minor) goto __end; if (track2 >= 0) { - register2 = register_sound_special_device(reg->f_ops, track2, carddev); + register2 = register_sound_special_device(f_ops, track2, + carddev); if (register2 != track2) goto __end; } @@ -190,6 +192,25 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev) static struct snd_info_entry *snd_minor_info_oss_entry = NULL; +static const char *snd_oss_device_type_name(int type) +{ + switch (type) { + case SNDRV_OSS_DEVICE_TYPE_MIXER: + return "mixer"; + case SNDRV_OSS_DEVICE_TYPE_SEQUENCER: + case SNDRV_OSS_DEVICE_TYPE_MUSIC: + return "sequencer"; + case SNDRV_OSS_DEVICE_TYPE_PCM: + return "digital audio"; + case SNDRV_OSS_DEVICE_TYPE_MIDI: + return "raw midi"; + case SNDRV_OSS_DEVICE_TYPE_DMFM: + return "hardware dependent"; + default: + return "?"; + } +} + static void snd_minor_info_oss_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { @@ -205,9 +226,9 @@ static void snd_minor_info_oss_read(struct snd_info_entry *entry, if (dev != SNDRV_MINOR_OSS_SNDSTAT && dev != SNDRV_MINOR_OSS_SEQUENCER && dev != SNDRV_MINOR_OSS_MUSIC) - snd_iprintf(buffer, "%3i: [%i-%2i]: %s\n", mptr->number, card, dev, mptr->comment); + snd_iprintf(buffer, "%3i: [%i-%2i]: %s\n", mptr->number, card, dev, snd_oss_device_type_name(mptr->type)); else - snd_iprintf(buffer, "%3i: : %s\n", mptr->number, mptr->comment); + snd_iprintf(buffer, "%3i: : %s\n", mptr->number, snd_oss_device_type_name(mptr->type)); } } up(&sound_oss_mutex); |