diff options
author | Karsten Wiese <fzu@wemgehoertderstaat.de> | 2009-04-20 07:01:21 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-04-20 07:39:38 -0400 |
commit | 5d4af1be06affa2b42cdf59cd376752be1f934b3 (patch) | |
tree | 65617051a596a59159b5d69abe5c8d9c68013e19 /sound | |
parent | f600f6c4824d7e40be370f7e26ab0fbc3f6f911c (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')
-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); |