diff options
Diffstat (limited to 'sound/synth/emux/emux_seq.c')
-rw-r--r-- | sound/synth/emux/emux_seq.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c index 188fda0effb0..a0209204ae48 100644 --- a/sound/synth/emux/emux_seq.c +++ b/sound/synth/emux/emux_seq.c | |||
@@ -267,8 +267,8 @@ snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private_data, | |||
267 | /* | 267 | /* |
268 | * increment usage count | 268 | * increment usage count |
269 | */ | 269 | */ |
270 | int | 270 | static int |
271 | snd_emux_inc_count(struct snd_emux *emu) | 271 | __snd_emux_inc_count(struct snd_emux *emu) |
272 | { | 272 | { |
273 | emu->used++; | 273 | emu->used++; |
274 | if (!try_module_get(emu->ops.owner)) | 274 | if (!try_module_get(emu->ops.owner)) |
@@ -282,12 +282,21 @@ snd_emux_inc_count(struct snd_emux *emu) | |||
282 | return 1; | 282 | return 1; |
283 | } | 283 | } |
284 | 284 | ||
285 | int snd_emux_inc_count(struct snd_emux *emu) | ||
286 | { | ||
287 | int ret; | ||
288 | |||
289 | mutex_lock(&emu->register_mutex); | ||
290 | ret = __snd_emux_inc_count(emu); | ||
291 | mutex_unlock(&emu->register_mutex); | ||
292 | return ret; | ||
293 | } | ||
285 | 294 | ||
286 | /* | 295 | /* |
287 | * decrease usage count | 296 | * decrease usage count |
288 | */ | 297 | */ |
289 | void | 298 | static void |
290 | snd_emux_dec_count(struct snd_emux *emu) | 299 | __snd_emux_dec_count(struct snd_emux *emu) |
291 | { | 300 | { |
292 | module_put(emu->card->module); | 301 | module_put(emu->card->module); |
293 | emu->used--; | 302 | emu->used--; |
@@ -296,6 +305,12 @@ snd_emux_dec_count(struct snd_emux *emu) | |||
296 | module_put(emu->ops.owner); | 305 | module_put(emu->ops.owner); |
297 | } | 306 | } |
298 | 307 | ||
308 | void snd_emux_dec_count(struct snd_emux *emu) | ||
309 | { | ||
310 | mutex_lock(&emu->register_mutex); | ||
311 | __snd_emux_dec_count(emu); | ||
312 | mutex_unlock(&emu->register_mutex); | ||
313 | } | ||
299 | 314 | ||
300 | /* | 315 | /* |
301 | * Routine that is called upon a first use of a particular port | 316 | * Routine that is called upon a first use of a particular port |
@@ -315,7 +330,7 @@ snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info) | |||
315 | 330 | ||
316 | mutex_lock(&emu->register_mutex); | 331 | mutex_lock(&emu->register_mutex); |
317 | snd_emux_init_port(p); | 332 | snd_emux_init_port(p); |
318 | snd_emux_inc_count(emu); | 333 | __snd_emux_inc_count(emu); |
319 | mutex_unlock(&emu->register_mutex); | 334 | mutex_unlock(&emu->register_mutex); |
320 | return 0; | 335 | return 0; |
321 | } | 336 | } |
@@ -338,7 +353,7 @@ snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info) | |||
338 | 353 | ||
339 | mutex_lock(&emu->register_mutex); | 354 | mutex_lock(&emu->register_mutex); |
340 | snd_emux_sounds_off_all(p); | 355 | snd_emux_sounds_off_all(p); |
341 | snd_emux_dec_count(emu); | 356 | __snd_emux_dec_count(emu); |
342 | mutex_unlock(&emu->register_mutex); | 357 | mutex_unlock(&emu->register_mutex); |
343 | return 0; | 358 | return 0; |
344 | } | 359 | } |