summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/u_audio.c
diff options
context:
space:
mode:
authorCliff Cai <cliff.cai@analog.com>2009-12-09 22:28:39 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-23 11:34:20 -0800
commitfeef1d952ee1e9ac074640d7029dbbe8501725c2 (patch)
treefba4643b1789198955e88345c958fc19a6748246 /drivers/usb/gadget/u_audio.c
parentd16f172622a7941c4fca09724ce16df5348af5fb (diff)
downloadblackbird-obmc-linux-feef1d952ee1e9ac074640d7029dbbe8501725c2.tar.gz
blackbird-obmc-linux-feef1d952ee1e9ac074640d7029dbbe8501725c2.zip
USB: audio gadget: free alsa devices when unloading
Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/u_audio.c')
-rw-r--r--drivers/usb/gadget/u_audio.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/usb/gadget/u_audio.c b/drivers/usb/gadget/u_audio.c
index 8252595d619d..35e0930f5bbb 100644
--- a/drivers/usb/gadget/u_audio.c
+++ b/drivers/usb/gadget/u_audio.c
@@ -288,6 +288,7 @@ static int gaudio_close_snd_dev(struct gaudio *gau)
return 0;
}
+static struct gaudio *the_card;
/**
* gaudio_setup - setup ALSA interface and preparing for USB transfer
*
@@ -303,6 +304,9 @@ int __init gaudio_setup(struct gaudio *card)
if (ret)
ERROR(card, "we need at least one control device\n");
+ if (!the_card)
+ the_card = card;
+
return ret;
}
@@ -312,9 +316,11 @@ int __init gaudio_setup(struct gaudio *card)
*
* This is called to free all resources allocated by @gaudio_setup().
*/
-void gaudio_cleanup(struct gaudio *card)
+void gaudio_cleanup(void)
{
- if (card)
- gaudio_close_snd_dev(card);
+ if (the_card) {
+ gaudio_close_snd_dev(the_card);
+ the_card = NULL;
+ }
}
OpenPOWER on IntegriCloud