diff options
-rw-r--r-- | sound/usb/usx2y/us122l.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 98276aafefe6..463f3ffe3fb9 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -478,6 +478,14 @@ static bool us122l_create_card(struct snd_card *card) | |||
478 | return true; | 478 | return true; |
479 | } | 479 | } |
480 | 480 | ||
481 | static void snd_us122l_free(struct snd_card *card) | ||
482 | { | ||
483 | struct us122l *us122l = US122L(card); | ||
484 | int index = us122l->chip.index; | ||
485 | if (index >= 0 && index < SNDRV_CARDS) | ||
486 | snd_us122l_card_used[index] = 0; | ||
487 | } | ||
488 | |||
481 | static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | 489 | static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) |
482 | { | 490 | { |
483 | int dev; | 491 | int dev; |
@@ -494,7 +502,7 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
494 | if (err < 0) | 502 | if (err < 0) |
495 | return err; | 503 | return err; |
496 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; | 504 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; |
497 | 505 | card->private_free = snd_us122l_free; | |
498 | US122L(card)->chip.dev = device; | 506 | US122L(card)->chip.dev = device; |
499 | US122L(card)->chip.card = card; | 507 | US122L(card)->chip.card = card; |
500 | mutex_init(&US122L(card)->mutex); | 508 | mutex_init(&US122L(card)->mutex); |
@@ -588,7 +596,7 @@ static void snd_us122l_disconnect(struct usb_interface *intf) | |||
588 | } | 596 | } |
589 | 597 | ||
590 | usb_put_intf(intf); | 598 | usb_put_intf(intf); |
591 | usb_put_dev(US122L(card)->chip.dev); | 599 | usb_put_dev(us122l->chip.dev); |
592 | 600 | ||
593 | while (atomic_read(&us122l->mmap_count)) | 601 | while (atomic_read(&us122l->mmap_count)) |
594 | msleep(500); | 602 | msleep(500); |