diff options
Diffstat (limited to 'sound/drivers/opl3/opl3_seq.c')
-rw-r--r-- | sound/drivers/opl3/opl3_seq.c | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c index 96762c9d4855..2d33f53d36b8 100644 --- a/sound/drivers/opl3/opl3_seq.c +++ b/sound/drivers/opl3/opl3_seq.c | |||
@@ -51,14 +51,15 @@ void snd_opl3_synth_use_dec(struct snd_opl3 * opl3) | |||
51 | int snd_opl3_synth_setup(struct snd_opl3 * opl3) | 51 | int snd_opl3_synth_setup(struct snd_opl3 * opl3) |
52 | { | 52 | { |
53 | int idx; | 53 | int idx; |
54 | struct snd_hwdep *hwdep = opl3->hwdep; | ||
54 | 55 | ||
55 | mutex_lock(&opl3->access_mutex); | 56 | mutex_lock(&hwdep->open_mutex); |
56 | if (opl3->used) { | 57 | if (hwdep->used) { |
57 | mutex_unlock(&opl3->access_mutex); | 58 | mutex_unlock(&hwdep->open_mutex); |
58 | return -EBUSY; | 59 | return -EBUSY; |
59 | } | 60 | } |
60 | opl3->used++; | 61 | hwdep->used++; |
61 | mutex_unlock(&opl3->access_mutex); | 62 | mutex_unlock(&hwdep->open_mutex); |
62 | 63 | ||
63 | snd_opl3_reset(opl3); | 64 | snd_opl3_reset(opl3); |
64 | 65 | ||
@@ -81,6 +82,7 @@ int snd_opl3_synth_setup(struct snd_opl3 * opl3) | |||
81 | void snd_opl3_synth_cleanup(struct snd_opl3 * opl3) | 82 | void snd_opl3_synth_cleanup(struct snd_opl3 * opl3) |
82 | { | 83 | { |
83 | unsigned long flags; | 84 | unsigned long flags; |
85 | struct snd_hwdep *hwdep; | ||
84 | 86 | ||
85 | /* Stop system timer */ | 87 | /* Stop system timer */ |
86 | spin_lock_irqsave(&opl3->sys_timer_lock, flags); | 88 | spin_lock_irqsave(&opl3->sys_timer_lock, flags); |
@@ -91,9 +93,11 @@ void snd_opl3_synth_cleanup(struct snd_opl3 * opl3) | |||
91 | spin_unlock_irqrestore(&opl3->sys_timer_lock, flags); | 93 | spin_unlock_irqrestore(&opl3->sys_timer_lock, flags); |
92 | 94 | ||
93 | snd_opl3_reset(opl3); | 95 | snd_opl3_reset(opl3); |
94 | mutex_lock(&opl3->access_mutex); | 96 | hwdep = opl3->hwdep; |
95 | opl3->used--; | 97 | mutex_lock(&hwdep->open_mutex); |
96 | mutex_unlock(&opl3->access_mutex); | 98 | hwdep->used--; |
99 | mutex_unlock(&hwdep->open_mutex); | ||
100 | wake_up(&hwdep->open_wait); | ||
97 | } | 101 | } |
98 | 102 | ||
99 | static int snd_opl3_synth_use(void *private_data, struct snd_seq_port_subscribe * info) | 103 | static int snd_opl3_synth_use(void *private_data, struct snd_seq_port_subscribe * info) |
@@ -152,15 +156,7 @@ static int snd_opl3_synth_event_input(struct snd_seq_event * ev, int direct, | |||
152 | { | 156 | { |
153 | struct snd_opl3 *opl3 = private_data; | 157 | struct snd_opl3 *opl3 = private_data; |
154 | 158 | ||
155 | if (ev->type >= SNDRV_SEQ_EVENT_INSTR_BEGIN && | 159 | snd_midi_process_event(&opl3_ops, ev, opl3->chset); |
156 | ev->type <= SNDRV_SEQ_EVENT_INSTR_CHANGE) { | ||
157 | if (direct) { | ||
158 | snd_seq_instr_event(&opl3->fm_ops, opl3->ilist, ev, | ||
159 | opl3->seq_client, atomic, hop); | ||
160 | } | ||
161 | } else { | ||
162 | snd_midi_process_event(&opl3_ops, ev, opl3->chset); | ||
163 | } | ||
164 | return 0; | 160 | return 0; |
165 | } | 161 | } |
166 | 162 | ||
@@ -249,16 +245,6 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev) | |||
249 | return err; | 245 | return err; |
250 | } | 246 | } |
251 | 247 | ||
252 | /* initialize instrument list */ | ||
253 | opl3->ilist = snd_seq_instr_list_new(); | ||
254 | if (opl3->ilist == NULL) { | ||
255 | snd_seq_delete_kernel_client(client); | ||
256 | opl3->seq_client = -1; | ||
257 | return -ENOMEM; | ||
258 | } | ||
259 | opl3->ilist->flags = SNDRV_SEQ_INSTR_FLG_DIRECT; | ||
260 | snd_seq_fm_init(&opl3->fm_ops, NULL); | ||
261 | |||
262 | /* setup system timer */ | 248 | /* setup system timer */ |
263 | init_timer(&opl3->tlist); | 249 | init_timer(&opl3->tlist); |
264 | opl3->tlist.function = snd_opl3_timer_func; | 250 | opl3->tlist.function = snd_opl3_timer_func; |
@@ -287,8 +273,6 @@ static int snd_opl3_seq_delete_device(struct snd_seq_device *dev) | |||
287 | snd_seq_delete_kernel_client(opl3->seq_client); | 273 | snd_seq_delete_kernel_client(opl3->seq_client); |
288 | opl3->seq_client = -1; | 274 | opl3->seq_client = -1; |
289 | } | 275 | } |
290 | if (opl3->ilist) | ||
291 | snd_seq_instr_list_free(&opl3->ilist); | ||
292 | return 0; | 276 | return 0; |
293 | } | 277 | } |
294 | 278 | ||