static void bebob_free(struct snd_bebob *bebob)
{
+ mutex_lock(&devices_mutex);
+ clear_bit(bebob->card_index, devices_used);
+ mutex_unlock(&devices_mutex);
+
snd_bebob_stream_destroy_duplex(bebob);
}
static void
bebob_card_free(struct snd_card *card)
{
- struct snd_bebob *bebob = card->private_data;
-
- mutex_lock(&devices_mutex);
- clear_bit(bebob->card_index, devices_used);
- mutex_unlock(&devices_mutex);
-
bebob_free(card->private_data);
}
return;
mutex_lock(&devices_mutex);
-
for (card_index = 0; card_index < SNDRV_CARDS; card_index++) {
if (!test_bit(card_index, devices_used) && enable[card_index])
break;
mutex_unlock(&devices_mutex);
return;
}
+ set_bit(card_index, devices_used);
+ mutex_unlock(&devices_mutex);
err = name_device(bebob);
if (err < 0)
if (err < 0)
goto error;
- set_bit(card_index, devices_used);
- mutex_unlock(&devices_mutex);
-
/*
* After registered, bebob instance can be released corresponding to
* releasing the sound card instance.
return;
error:
- mutex_unlock(&devices_mutex);
snd_bebob_stream_destroy_duplex(bebob);
snd_card_free(bebob->card);
dev_info(&bebob->unit->device,
static void efw_free(struct snd_efw *efw)
{
+ mutex_lock(&devices_mutex);
+ clear_bit(efw->card_index, devices_used);
+ mutex_unlock(&devices_mutex);
+
snd_efw_stream_destroy_duplex(efw);
snd_efw_transaction_remove_instance(efw);
}
static void
efw_card_free(struct snd_card *card)
{
- struct snd_efw *efw = card->private_data;
-
- if (efw->card_index >= 0) {
- mutex_lock(&devices_mutex);
- clear_bit(efw->card_index, devices_used);
- mutex_unlock(&devices_mutex);
- }
-
efw_free(card->private_data);
}
if (efw->registered)
return;
- mutex_lock(&devices_mutex);
-
/* check registered cards */
+ mutex_lock(&devices_mutex);
for (card_index = 0; card_index < SNDRV_CARDS; ++card_index) {
if (!test_bit(card_index, devices_used) && enable[card_index])
break;
mutex_unlock(&devices_mutex);
return;
}
+ set_bit(card_index, devices_used);
+ mutex_unlock(&devices_mutex);
/* prepare response buffer */
snd_efw_resp_buf_size = clamp(snd_efw_resp_buf_size,
if (err < 0)
goto error;
- set_bit(card_index, devices_used);
- mutex_unlock(&devices_mutex);
-
/*
* After registered, efw instance can be released corresponding to
* releasing the sound card instance.
return;
error:
- mutex_unlock(&devices_mutex);
snd_efw_transaction_remove_instance(efw);
snd_efw_stream_destroy_duplex(efw);
snd_card_free(efw->card);