diff options
author | Cliff Cai <cliff.cai@analog.com> | 2009-12-09 22:28:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-23 14:34:20 -0500 |
commit | feef1d952ee1e9ac074640d7029dbbe8501725c2 (patch) | |
tree | fba4643b1789198955e88345c958fc19a6748246 /drivers/usb | |
parent | d16f172622a7941c4fca09724ce16df5348af5fb (diff) |
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')
-rw-r--r-- | drivers/usb/gadget/audio.c | 1 | ||||
-rw-r--r-- | drivers/usb/gadget/f_audio.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/u_audio.c | 12 | ||||
-rw-r--r-- | drivers/usb/gadget/u_audio.h | 2 |
4 files changed, 12 insertions, 5 deletions
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c index 58f220323847..a62af7b59094 100644 --- a/drivers/usb/gadget/audio.c +++ b/drivers/usb/gadget/audio.c | |||
@@ -158,6 +158,7 @@ fail: | |||
158 | 158 | ||
159 | static int __exit audio_unbind(struct usb_composite_dev *cdev) | 159 | static int __exit audio_unbind(struct usb_composite_dev *cdev) |
160 | { | 160 | { |
161 | gaudio_cleanup(); | ||
161 | return 0; | 162 | return 0; |
162 | } | 163 | } |
163 | 164 | ||
diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c index 1ff420b7d72f..df77f6131c73 100644 --- a/drivers/usb/gadget/f_audio.c +++ b/drivers/usb/gadget/f_audio.c | |||
@@ -792,7 +792,7 @@ int __init audio_bind_config(struct usb_configuration *c) | |||
792 | return status; | 792 | return status; |
793 | 793 | ||
794 | add_fail: | 794 | add_fail: |
795 | gaudio_cleanup(&audio->card); | 795 | gaudio_cleanup(); |
796 | setup_fail: | 796 | setup_fail: |
797 | kfree(audio); | 797 | kfree(audio); |
798 | return status; | 798 | return status; |
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) | |||
288 | return 0; | 288 | return 0; |
289 | } | 289 | } |
290 | 290 | ||
291 | static struct gaudio *the_card; | ||
291 | /** | 292 | /** |
292 | * gaudio_setup - setup ALSA interface and preparing for USB transfer | 293 | * gaudio_setup - setup ALSA interface and preparing for USB transfer |
293 | * | 294 | * |
@@ -303,6 +304,9 @@ int __init gaudio_setup(struct gaudio *card) | |||
303 | if (ret) | 304 | if (ret) |
304 | ERROR(card, "we need at least one control device\n"); | 305 | ERROR(card, "we need at least one control device\n"); |
305 | 306 | ||
307 | if (!the_card) | ||
308 | the_card = card; | ||
309 | |||
306 | return ret; | 310 | return ret; |
307 | 311 | ||
308 | } | 312 | } |
@@ -312,9 +316,11 @@ int __init gaudio_setup(struct gaudio *card) | |||
312 | * | 316 | * |
313 | * This is called to free all resources allocated by @gaudio_setup(). | 317 | * This is called to free all resources allocated by @gaudio_setup(). |
314 | */ | 318 | */ |
315 | void gaudio_cleanup(struct gaudio *card) | 319 | void gaudio_cleanup(void) |
316 | { | 320 | { |
317 | if (card) | 321 | if (the_card) { |
318 | gaudio_close_snd_dev(card); | 322 | gaudio_close_snd_dev(the_card); |
323 | the_card = NULL; | ||
324 | } | ||
319 | } | 325 | } |
320 | 326 | ||
diff --git a/drivers/usb/gadget/u_audio.h b/drivers/usb/gadget/u_audio.h index cc8d159c648a..08ffce3298e6 100644 --- a/drivers/usb/gadget/u_audio.h +++ b/drivers/usb/gadget/u_audio.h | |||
@@ -51,6 +51,6 @@ struct gaudio { | |||
51 | }; | 51 | }; |
52 | 52 | ||
53 | int gaudio_setup(struct gaudio *card); | 53 | int gaudio_setup(struct gaudio *card); |
54 | void gaudio_cleanup(struct gaudio *card); | 54 | void gaudio_cleanup(void); |
55 | 55 | ||
56 | #endif /* __U_AUDIO_H */ | 56 | #endif /* __U_AUDIO_H */ |