aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorKarsten Wiese <fzu@wemgehoertderstaat.de>2009-04-20 07:01:21 -0400
committerTakashi Iwai <tiwai@suse.de>2009-04-20 07:39:38 -0400
commit5d4af1be06affa2b42cdf59cd376752be1f934b3 (patch)
tree65617051a596a59159b5d69abe5c8d9c68013e19 /sound/usb
parentf600f6c4824d7e40be370f7e26ab0fbc3f6f911c (diff)
ALSA: us122l: add snd_us122l_free()
Use it to clean up snd_us122l_card_used[]. Without patch unplugging of an US122L soundcard didn't reset the corresponding element of snd_us122l_card_used[] to 0. The (SNDRV_CARDS + 1)th plugging in did not result in creating the soundcard device anymore. Index values supplied with the modprobe command line were not used correctly anymore after the first unplugging of an US122L. Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de> Cc: stable@kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/usx2y/us122l.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c
index 98276aafefe..463f3ffe3fb 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
481static 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
481static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) 489static 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);