aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/motu/motu.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/firewire/motu/motu.c')
-rw-r--r--sound/firewire/motu/motu.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/sound/firewire/motu/motu.c b/sound/firewire/motu/motu.c
index 281028ee3273..220e61926ea4 100644
--- a/sound/firewire/motu/motu.c
+++ b/sound/firewire/motu/motu.c
@@ -52,24 +52,14 @@ static void name_card(struct snd_motu *motu)
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);
@@ -82,6 +72,8 @@ static void do_registration(struct work_struct *work)
&motu->card);
if (err < 0)
return;
+ motu->card->private_free = motu_card_free;
+ motu->card->private_data = motu;
name_card(motu);
@@ -116,18 +108,10 @@ static void do_registration(struct work_struct *work)
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);