aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/hwdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/hwdep.c')
-rw-r--r--sound/core/hwdep.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index 46b47689362c..39c03f3dfbfa 100644
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -47,14 +47,11 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device);
47 47
48static struct snd_hwdep *snd_hwdep_search(struct snd_card *card, int device) 48static struct snd_hwdep *snd_hwdep_search(struct snd_card *card, int device)
49{ 49{
50 struct list_head *p;
51 struct snd_hwdep *hwdep; 50 struct snd_hwdep *hwdep;
52 51
53 list_for_each(p, &snd_hwdep_devices) { 52 list_for_each_entry(hwdep, &snd_hwdep_devices, list)
54 hwdep = list_entry(p, struct snd_hwdep, list);
55 if (hwdep->card == card && hwdep->device == device) 53 if (hwdep->card == card && hwdep->device == device)
56 return hwdep; 54 return hwdep;
57 }
58 return NULL; 55 return NULL;
59} 56}
60 57
@@ -159,15 +156,16 @@ static int snd_hwdep_release(struct inode *inode, struct file * file)
159 int err = -ENXIO; 156 int err = -ENXIO;
160 struct snd_hwdep *hw = file->private_data; 157 struct snd_hwdep *hw = file->private_data;
161 struct module *mod = hw->card->module; 158 struct module *mod = hw->card->module;
159
162 mutex_lock(&hw->open_mutex); 160 mutex_lock(&hw->open_mutex);
163 if (hw->ops.release) { 161 if (hw->ops.release)
164 err = hw->ops.release(hw, file); 162 err = hw->ops.release(hw, file);
165 wake_up(&hw->open_wait);
166 }
167 if (hw->used > 0) 163 if (hw->used > 0)
168 hw->used--; 164 hw->used--;
169 snd_card_file_remove(hw->card, file);
170 mutex_unlock(&hw->open_mutex); 165 mutex_unlock(&hw->open_mutex);
166 wake_up(&hw->open_wait);
167
168 snd_card_file_remove(hw->card, file);
171 module_put(mod); 169 module_put(mod);
172 return err; 170 return err;
173} 171}
@@ -468,15 +466,12 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device)
468static void snd_hwdep_proc_read(struct snd_info_entry *entry, 466static void snd_hwdep_proc_read(struct snd_info_entry *entry,
469 struct snd_info_buffer *buffer) 467 struct snd_info_buffer *buffer)
470{ 468{
471 struct list_head *p;
472 struct snd_hwdep *hwdep; 469 struct snd_hwdep *hwdep;
473 470
474 mutex_lock(&register_mutex); 471 mutex_lock(&register_mutex);
475 list_for_each(p, &snd_hwdep_devices) { 472 list_for_each_entry(hwdep, &snd_hwdep_devices, list)
476 hwdep = list_entry(p, struct snd_hwdep, list);
477 snd_iprintf(buffer, "%02i-%02i: %s\n", 473 snd_iprintf(buffer, "%02i-%02i: %s\n",
478 hwdep->card->number, hwdep->device, hwdep->name); 474 hwdep->card->number, hwdep->device, hwdep->name);
479 }
480 mutex_unlock(&register_mutex); 475 mutex_unlock(&register_mutex);
481} 476}
482 477