return err;
}
-static void bebob_free(struct snd_bebob *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);
snd_bebob_stream_destroy_duplex(bebob);
}
-/*
- * This module releases the FireWire unit data after all ALSA character devices
- * are released by applications. This is for releasing stream data or finishing
- * transactions safely. Thus at returning from .remove(), this module still keep
- * references for the unit.
- */
-static void
-bebob_card_free(struct snd_card *card)
-{
- bebob_free(card->private_data);
-}
-
static const struct snd_bebob_spec *
get_saffire_spec(struct fw_unit *unit)
{
set_bit(card_index, devices_used);
mutex_unlock(&devices_mutex);
+ bebob->card->private_free = bebob_card_free;
+ bebob->card->private_data = bebob;
+
err = name_device(bebob);
if (err < 0)
goto error;
if (err < 0)
goto error;
- /*
- * After registered, bebob instance can be released corresponding to
- * releasing the sound card instance.
- */
- bebob->card->private_free = bebob_card_free;
- bebob->card->private_data = bebob;
bebob->registered = true;
return;
error:
- snd_bebob_stream_destroy_duplex(bebob);
snd_card_free(bebob->card);
dev_info(&bebob->unit->device,
"Sound card registration failed: %d\n", err);
strcpy(card->mixername, "DICE");
}
-static void dice_free(struct snd_dice *dice)
+static void dice_card_free(struct snd_card *card)
{
+ struct snd_dice *dice = card->private_data;
+
snd_dice_stream_destroy_duplex(dice);
snd_dice_transaction_destroy(dice);
}
-/*
- * This module releases the FireWire unit data after all ALSA character devices
- * are released by applications. This is for releasing stream data or finishing
- * transactions safely. Thus at returning from .remove(), this module still keep
- * references for the unit.
- */
-static void dice_card_free(struct snd_card *card)
-{
- dice_free(card->private_data);
-}
-
static void do_registration(struct work_struct *work)
{
struct snd_dice *dice = container_of(work, struct snd_dice, dwork.work);
&dice->card);
if (err < 0)
return;
+ dice->card->private_free = dice_card_free;
+ dice->card->private_data = dice;
err = snd_dice_transaction_init(dice);
if (err < 0)
if (err < 0)
goto error;
- /*
- * After registered, dice instance can be released corresponding to
- * releasing the sound card instance.
- */
- dice->card->private_free = dice_card_free;
- dice->card->private_data = dice;
dice->registered = true;
return;
error:
- snd_dice_stream_destroy_duplex(dice);
- snd_dice_transaction_destroy(dice);
- snd_dice_stream_destroy_duplex(dice);
snd_card_free(dice->card);
dev_info(&dice->unit->device,
"Sound card registration failed: %d\n", err);
return 0;
}
-static void dg00x_free(struct snd_dg00x *dg00x)
+static void dg00x_card_free(struct snd_card *card)
{
+ struct snd_dg00x *dg00x = card->private_data;
+
snd_dg00x_stream_destroy_duplex(dg00x);
snd_dg00x_transaction_unregister(dg00x);
}
-static void dg00x_card_free(struct snd_card *card)
-{
- dg00x_free(card->private_data);
-}
-
static void do_registration(struct work_struct *work)
{
struct snd_dg00x *dg00x =
&dg00x->card);
if (err < 0)
return;
+ dg00x->card->private_free = dg00x_card_free;
+ dg00x->card->private_data = dg00x;
err = name_card(dg00x);
if (err < 0)
if (err < 0)
goto error;
- dg00x->card->private_free = dg00x_card_free;
- dg00x->card->private_data = dg00x;
dg00x->registered = true;
return;
error:
- snd_dg00x_transaction_unregister(dg00x);
- snd_dg00x_stream_destroy_duplex(dg00x);
snd_card_free(dg00x->card);
dev_info(&dg00x->unit->device,
"Sound card registration failed: %d\n", err);
dev_name(&ff->unit->device), 100 << fw_dev->max_speed);
}
-static void ff_free(struct snd_ff *ff)
+static void ff_card_free(struct snd_card *card)
{
+ struct snd_ff *ff = card->private_data;
+
snd_ff_stream_destroy_duplex(ff);
snd_ff_transaction_unregister(ff);
}
-static void ff_card_free(struct snd_card *card)
-{
- ff_free(card->private_data);
-}
-
static void do_registration(struct work_struct *work)
{
struct snd_ff *ff = container_of(work, struct snd_ff, dwork.work);
&ff->card);
if (err < 0)
return;
+ ff->card->private_free = ff_card_free;
+ ff->card->private_data = ff;
err = snd_ff_transaction_register(ff);
if (err < 0)
if (err < 0)
goto error;
- ff->card->private_free = ff_card_free;
- ff->card->private_data = ff;
ff->registered = true;
return;
error:
- snd_ff_transaction_unregister(ff);
- snd_ff_stream_destroy_duplex(ff);
snd_card_free(ff->card);
dev_info(&ff->unit->device,
"Sound card registration failed: %d\n", err);
return err;
}
-static void efw_free(struct snd_efw *efw)
+static void
+efw_card_free(struct snd_card *card)
{
+ struct snd_efw *efw = card->private_data;
+
mutex_lock(&devices_mutex);
clear_bit(efw->card_index, devices_used);
mutex_unlock(&devices_mutex);
snd_efw_transaction_remove_instance(efw);
}
-/*
- * This module releases the FireWire unit data after all ALSA character devices
- * are released by applications. This is for releasing stream data or finishing
- * transactions safely. Thus at returning from .remove(), this module still keep
- * references for the unit.
- */
-static void
-efw_card_free(struct snd_card *card)
-{
- efw_free(card->private_data);
-}
-
static void
do_registration(struct work_struct *work)
{
set_bit(card_index, devices_used);
mutex_unlock(&devices_mutex);
+ efw->card->private_free = efw_card_free;
+ efw->card->private_data = efw;
+
/* prepare response buffer */
snd_efw_resp_buf_size = clamp(snd_efw_resp_buf_size,
SND_EFW_RESPONSE_MAXIMUM_BYTES, 4096U);
if (err < 0)
goto error;
- /*
- * After registered, efw instance can be released corresponding to
- * releasing the sound card instance.
- */
- efw->card->private_free = efw_card_free;
- efw->card->private_data = efw;
efw->registered = true;
return;
error:
- snd_efw_transaction_remove_instance(efw);
- snd_efw_stream_destroy_duplex(efw);
snd_card_free(efw->card);
dev_info(&efw->unit->device,
"Sound card registration failed: %d\n", err);
dev_name(&motu->unit->device), 100 << fw_dev->max_speed);
}
-static void motu_free(struct snd_motu *motu)
+static void motu_card_free(struct snd_card *card)
{
- snd_motu_transaction_unregister(motu);
+ struct snd_motu *motu = card->private_data;
+ snd_motu_transaction_unregister(motu);
snd_motu_stream_destroy_duplex(motu);
}
-/*
- * This module releases the FireWire unit data after all ALSA character devices
- * are released by applications. This is for releasing stream data or finishing
- * transactions safely. Thus at returning from .remove(), this module still keep
- * references for the unit.
- */
-static void motu_card_free(struct snd_card *card)
-{
- motu_free(card->private_data);
-}
-
static void do_registration(struct work_struct *work)
{
struct snd_motu *motu = container_of(work, struct snd_motu, dwork.work);
&motu->card);
if (err < 0)
return;
+ motu->card->private_free = motu_card_free;
+ motu->card->private_data = motu;
name_card(motu);
if (err < 0)
goto error;
- /*
- * After registered, motu instance can be released corresponding to
- * releasing the sound card instance.
- */
- motu->card->private_free = motu_card_free;
- motu->card->private_data = motu;
motu->registered = true;
return;
error:
- snd_motu_transaction_unregister(motu);
- snd_motu_stream_destroy_duplex(motu);
snd_card_free(motu->card);
dev_info(&motu->unit->device,
"Sound card registration failed: %d\n", err);
return err;
}
-static void oxfw_free(struct snd_oxfw *oxfw)
+static void oxfw_card_free(struct snd_card *card)
{
+ struct snd_oxfw *oxfw = card->private_data;
+
snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream);
if (oxfw->has_output)
snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);
}
-/*
- * This module releases the FireWire unit data after all ALSA character devices
- * are released by applications. This is for releasing stream data or finishing
- * transactions safely. Thus at returning from .remove(), this module still keep
- * references for the unit.
- */
-static void oxfw_card_free(struct snd_card *card)
-{
- oxfw_free(card->private_data);
-}
-
static int detect_quirks(struct snd_oxfw *oxfw)
{
struct fw_device *fw_dev = fw_parent_device(oxfw->unit);
&oxfw->card);
if (err < 0)
return;
+ oxfw->card->private_free = oxfw_card_free;
+ oxfw->card->private_data = oxfw;
err = name_card(oxfw);
if (err < 0)
if (err < 0)
goto error;
- /*
- * After registered, oxfw instance can be released corresponding to
- * releasing the sound card instance.
- */
- oxfw->card->private_free = oxfw_card_free;
- oxfw->card->private_data = oxfw;
oxfw->registered = true;
return;
error:
- snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream);
- if (oxfw->has_output)
- snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);
snd_card_free(oxfw->card);
dev_info(&oxfw->unit->device,
"Sound card registration failed: %d\n", err);
return 0;
}
-static void tscm_free(struct snd_tscm *tscm)
+static void tscm_card_free(struct snd_card *card)
{
+ struct snd_tscm *tscm = card->private_data;
+
snd_tscm_transaction_unregister(tscm);
snd_tscm_stream_destroy_duplex(tscm);
}
-static void tscm_card_free(struct snd_card *card)
-{
- tscm_free(card->private_data);
-}
-
static void do_registration(struct work_struct *work)
{
struct snd_tscm *tscm = container_of(work, struct snd_tscm, dwork.work);
&tscm->card);
if (err < 0)
return;
+ tscm->card->private_free = tscm_card_free;
+ tscm->card->private_data = tscm;
err = identify_model(tscm);
if (err < 0)
if (err < 0)
goto error;
- /*
- * After registered, tscm instance can be released corresponding to
- * releasing the sound card instance.
- */
- tscm->card->private_free = tscm_card_free;
- tscm->card->private_data = tscm;
tscm->registered = true;
return;
error:
- snd_tscm_transaction_unregister(tscm);
- snd_tscm_stream_destroy_duplex(tscm);
snd_card_free(tscm->card);
dev_info(&tscm->unit->device,
"Sound card registration failed: %d\n", err);