aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/oss
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/oss')
-rw-r--r--sound/core/oss/mixer_oss.c7
-rw-r--r--sound/core/oss/pcm_oss.c14
2 files changed, 8 insertions, 13 deletions
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 2dd6bf9b49ed..2d7a42014f51 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);
41 41
42static int snd_mixer_oss_open(struct inode *inode, struct file *file) 42static int snd_mixer_oss_open(struct inode *inode, struct file *file)
43{ 43{
44 int cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode));
45 struct snd_card *card; 44 struct snd_card *card;
46 struct snd_mixer_oss_file *fmixer; 45 struct snd_mixer_oss_file *fmixer;
47 int err; 46 int err;
48 47
49 if ((card = snd_cards[cardnum]) == NULL) 48 card = snd_lookup_oss_minor_data(iminor(inode),
49 SNDRV_OSS_DEVICE_TYPE_MIXER);
50 if (card == NULL)
50 return -ENODEV; 51 return -ENODEV;
51 if (card->mixer_oss == NULL) 52 if (card->mixer_oss == NULL)
52 return -ENODEV; 53 return -ENODEV;
@@ -1286,7 +1287,7 @@ static int snd_mixer_oss_notify_handler(struct snd_card *card, int cmd)
1286 sprintf(name, "mixer%i%i", card->number, 0); 1287 sprintf(name, "mixer%i%i", card->number, 0);
1287 if ((err = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER, 1288 if ((err = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER,
1288 card, 0, 1289 card, 0,
1289 &snd_mixer_oss_f_ops, 1290 &snd_mixer_oss_f_ops, card,
1290 name)) < 0) { 1291 name)) < 0) {
1291 snd_printk(KERN_ERR "unable to register OSS mixer device %i:%i\n", 1292 snd_printk(KERN_ERR "unable to register OSS mixer device %i:%i\n",
1292 card->number, 0); 1293 card->number, 0);
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 947bf08df42a..2ae283c7b28a 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1834,9 +1834,6 @@ static int snd_task_name(struct task_struct *task, char *name, size_t size)
1834 1834
1835static int snd_pcm_oss_open(struct inode *inode, struct file *file) 1835static int snd_pcm_oss_open(struct inode *inode, struct file *file)
1836{ 1836{
1837 int minor = iminor(inode);
1838 int cardnum = SNDRV_MINOR_OSS_CARD(minor);
1839 int device;
1840 int err; 1837 int err;
1841 char task_name[32]; 1838 char task_name[32];
1842 struct snd_pcm *pcm; 1839 struct snd_pcm *pcm;
@@ -1845,11 +1842,8 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
1845 int nonblock; 1842 int nonblock;
1846 wait_queue_t wait; 1843 wait_queue_t wait;
1847 1844
1848 snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO); 1845 pcm = snd_lookup_oss_minor_data(iminor(inode),
1849 device = SNDRV_MINOR_OSS_DEVICE(minor) == SNDRV_MINOR_OSS_PCM1 ? 1846 SNDRV_OSS_DEVICE_TYPE_PCM);
1850 adsp_map[cardnum] : dsp_map[cardnum];
1851
1852 pcm = snd_pcm_devices[(cardnum * SNDRV_PCM_DEVICES) + device];
1853 if (pcm == NULL) { 1847 if (pcm == NULL) {
1854 err = -ENODEV; 1848 err = -ENODEV;
1855 goto __error1; 1849 goto __error1;
@@ -1890,7 +1884,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
1890 down(&pcm->open_mutex); 1884 down(&pcm->open_mutex);
1891 while (1) { 1885 while (1) {
1892 err = snd_pcm_oss_open_file(file, pcm, &pcm_oss_file, 1886 err = snd_pcm_oss_open_file(file, pcm, &pcm_oss_file,
1893 minor, psetup, csetup); 1887 iminor(inode), psetup, csetup);
1894 if (err >= 0) 1888 if (err >= 0)
1895 break; 1889 break;
1896 if (err == -EAGAIN) { 1890 if (err == -EAGAIN) {
@@ -2450,7 +2444,7 @@ static void register_oss_dsp(struct snd_pcm *pcm, int index)
2450 sprintf(name, "dsp%i%i", pcm->card->number, pcm->device); 2444 sprintf(name, "dsp%i%i", pcm->card->number, pcm->device);
2451 if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM, 2445 if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM,
2452 pcm->card, index, &snd_pcm_oss_f_reg, 2446 pcm->card, index, &snd_pcm_oss_f_reg,
2453 name) < 0) { 2447 pcm, name) < 0) {
2454 snd_printk(KERN_ERR "unable to register OSS PCM device %i:%i\n", 2448 snd_printk(KERN_ERR "unable to register OSS PCM device %i:%i\n",
2455 pcm->card->number, pcm->device); 2449 pcm->card->number, pcm->device);
2456 } 2450 }