Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 92229
b: refs/heads/master
c: f18638d
h: refs/heads/master
i:
  92227: 0e7dae5
v: v3
  • Loading branch information
Takashi Iwai committed Apr 24, 2008
1 parent 8371d2a commit 20fadb5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 73d38b13ffb105ab633bd91969c8d218b2de38d4
refs/heads/master: f18638dcf0c481eca2430206ebcdc7295aec8623
26 changes: 9 additions & 17 deletions trunk/sound/core/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ int snd_card_disconnect(struct snd_card *card)
struct file *file;
int err;

if (!card)
return -EINVAL;

spin_lock(&card->files_lock);
if (card->shutdown) {
spin_unlock(&card->files_lock);
Expand All @@ -322,6 +325,7 @@ int snd_card_disconnect(struct snd_card *card)
/* phase 1: disable fops (user space) operations for ALSA API */
mutex_lock(&snd_card_mutex);
snd_cards[card->number] = NULL;
snd_cards_lock &= ~(1 << card->number);
mutex_unlock(&snd_card_mutex);

/* phase 2: replace file->f_op with special dummy operations */
Expand Down Expand Up @@ -365,6 +369,9 @@ int snd_card_disconnect(struct snd_card *card)
device_unregister(card->card_dev);
card->card_dev = NULL;
}
#endif
#ifdef CONFIG_PM
wake_up(&card->power_sleep);
#endif
return 0;
}
Expand Down Expand Up @@ -411,25 +418,10 @@ static int snd_card_do_free(struct snd_card *card)
return 0;
}

static int snd_card_free_prepare(struct snd_card *card)
{
if (card == NULL)
return -EINVAL;
(void) snd_card_disconnect(card);
mutex_lock(&snd_card_mutex);
snd_cards[card->number] = NULL;
snd_cards_lock &= ~(1 << card->number);
mutex_unlock(&snd_card_mutex);
#ifdef CONFIG_PM
wake_up(&card->power_sleep);
#endif
return 0;
}

int snd_card_free_when_closed(struct snd_card *card)
{
int free_now = 0;
int ret = snd_card_free_prepare(card);
int ret = snd_card_disconnect(card);
if (ret)
return ret;

Expand All @@ -449,7 +441,7 @@ EXPORT_SYMBOL(snd_card_free_when_closed);

int snd_card_free(struct snd_card *card)
{
int ret = snd_card_free_prepare(card);
int ret = snd_card_disconnect(card);
if (ret)
return ret;

Expand Down

0 comments on commit 20fadb5

Please sign in to comment.