Commit 33046957 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "This contains unexpectedly many changes in a wide range due to the
  fixes for races at disconnection of USB audio devices.  In the end, we
  end up covering fairly core parts of sound subsystem.

  Other than that, just a few usual small fixes."

* tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: ice1724: Fix rate setup after resume
  ALSA: Avoid endless sleep after disconnect
  ALSA: Add a reference counter to card instance
  ALSA: usb-audio: Fix races at disconnection in mixer_quirks.c
  ALSA: usb-audio: Use rwsem for disconnect protection
  ALSA: usb-audio: Fix races at disconnection
  ALSA: PCM: Fix some races at disconnection
  ASoC: omap-dmic: Correct functional clock name
  ASoC: zoom2: Fix compile error by including correct header files
  ALSA: hda - Fix mute-LED setup for HP dv5 laptop
parents 08f05c49 16c2e1fa
...@@ -132,6 +132,7 @@ struct snd_card { ...@@ -132,6 +132,7 @@ struct snd_card {
int shutdown; /* this card is going down */ int shutdown; /* this card is going down */
int free_on_last_close; /* free in context of file_release */ int free_on_last_close; /* free in context of file_release */
wait_queue_head_t shutdown_sleep; wait_queue_head_t shutdown_sleep;
atomic_t refcount; /* refcount for disconnection */
struct device *dev; /* device assigned to this card */ struct device *dev; /* device assigned to this card */
struct device *card_dev; /* cardX object for sysfs */ struct device *card_dev; /* cardX object for sysfs */
...@@ -189,6 +190,7 @@ struct snd_minor { ...@@ -189,6 +190,7 @@ struct snd_minor {
const struct file_operations *f_ops; /* file operations */ const struct file_operations *f_ops; /* file operations */
void *private_data; /* private data for f_ops->open */ void *private_data; /* private data for f_ops->open */
struct device *dev; /* device for sysfs */ struct device *dev; /* device for sysfs */
struct snd_card *card_ptr; /* assigned card instance */
}; };
/* return a device pointer linked to each sound device as a parent */ /* return a device pointer linked to each sound device as a parent */
...@@ -295,6 +297,7 @@ int snd_card_info_done(void); ...@@ -295,6 +297,7 @@ int snd_card_info_done(void);
int snd_component_add(struct snd_card *card, const char *component); int snd_component_add(struct snd_card *card, const char *component);
int snd_card_file_add(struct snd_card *card, struct file *file); int snd_card_file_add(struct snd_card *card, struct file *file);
int snd_card_file_remove(struct snd_card *card, struct file *file); int snd_card_file_remove(struct snd_card *card, struct file *file);
void snd_card_unref(struct snd_card *card);
#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
......
...@@ -100,12 +100,15 @@ static int snd_compr_open(struct inode *inode, struct file *f) ...@@ -100,12 +100,15 @@ static int snd_compr_open(struct inode *inode, struct file *f)
if (dirn != compr->direction) { if (dirn != compr->direction) {
pr_err("this device doesn't support this direction\n"); pr_err("this device doesn't support this direction\n");
snd_card_unref(compr->card);
return -EINVAL; return -EINVAL;
} }
data = kzalloc(sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data) if (!data) {
snd_card_unref(compr->card);
return -ENOMEM; return -ENOMEM;
}
data->stream.ops = compr->ops; data->stream.ops = compr->ops;
data->stream.direction = dirn; data->stream.direction = dirn;
data->stream.private_data = compr->private_data; data->stream.private_data = compr->private_data;
...@@ -113,6 +116,7 @@ static int snd_compr_open(struct inode *inode, struct file *f) ...@@ -113,6 +116,7 @@ static int snd_compr_open(struct inode *inode, struct file *f)
runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
if (!runtime) { if (!runtime) {
kfree(data); kfree(data);
snd_card_unref(compr->card);
return -ENOMEM; return -ENOMEM;
} }
runtime->state = SNDRV_PCM_STATE_OPEN; runtime->state = SNDRV_PCM_STATE_OPEN;
...@@ -126,7 +130,8 @@ static int snd_compr_open(struct inode *inode, struct file *f) ...@@ -126,7 +130,8 @@ static int snd_compr_open(struct inode *inode, struct file *f)
kfree(runtime); kfree(runtime);
kfree(data); kfree(data);
} }
return ret; snd_card_unref(compr->card);
return 0;
} }
static int snd_compr_free(struct inode *inode, struct file *f) static int snd_compr_free(struct inode *inode, struct file *f)
......
...@@ -86,6 +86,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file) ...@@ -86,6 +86,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
write_lock_irqsave(&card->ctl_files_rwlock, flags); write_lock_irqsave(&card->ctl_files_rwlock, flags);
list_add_tail(&ctl->list, &card->ctl_files); list_add_tail(&ctl->list, &card->ctl_files);
write_unlock_irqrestore(&card->ctl_files_rwlock, flags); write_unlock_irqrestore(&card->ctl_files_rwlock, flags);
snd_card_unref(card);
return 0; return 0;
__error: __error:
...@@ -93,6 +94,8 @@ static int snd_ctl_open(struct inode *inode, struct file *file) ...@@ -93,6 +94,8 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
__error2: __error2:
snd_card_file_remove(card, file); snd_card_file_remove(card, file);
__error1: __error1:
if (card)
snd_card_unref(card);
return err; return err;
} }
...@@ -1434,6 +1437,8 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer, ...@@ -1434,6 +1437,8 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer,
spin_unlock_irq(&ctl->read_lock); spin_unlock_irq(&ctl->read_lock);
schedule(); schedule();
remove_wait_queue(&ctl->change_sleep, &wait); remove_wait_queue(&ctl->change_sleep, &wait);
if (ctl->card->shutdown)
return -ENODEV;
if (signal_pending(current)) if (signal_pending(current))
return -ERESTARTSYS; return -ERESTARTSYS;
spin_lock_irq(&ctl->read_lock); spin_lock_irq(&ctl->read_lock);
......
...@@ -100,8 +100,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) ...@@ -100,8 +100,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
if (hw == NULL) if (hw == NULL)
return -ENODEV; return -ENODEV;
if (!try_module_get(hw->card->module)) if (!try_module_get(hw->card->module)) {
snd_card_unref(hw->card);
return -EFAULT; return -EFAULT;
}
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
add_wait_queue(&hw->open_wait, &wait); add_wait_queue(&hw->open_wait, &wait);
...@@ -129,6 +131,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) ...@@ -129,6 +131,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
mutex_unlock(&hw->open_mutex); mutex_unlock(&hw->open_mutex);
schedule(); schedule();
mutex_lock(&hw->open_mutex); mutex_lock(&hw->open_mutex);
if (hw->card->shutdown) {
err = -ENODEV;
break;
}
if (signal_pending(current)) { if (signal_pending(current)) {
err = -ERESTARTSYS; err = -ERESTARTSYS;
break; break;
...@@ -148,6 +154,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) ...@@ -148,6 +154,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
mutex_unlock(&hw->open_mutex); mutex_unlock(&hw->open_mutex);
if (err < 0) if (err < 0)
module_put(hw->card->module); module_put(hw->card->module);
snd_card_unref(hw->card);
return err; return err;
} }
...@@ -459,12 +466,15 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device) ...@@ -459,12 +466,15 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device)
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
return -EINVAL; return -EINVAL;
} }
mutex_lock(&hwdep->open_mutex);
wake_up(&hwdep->open_wait);
#ifdef CONFIG_SND_OSSEMUL #ifdef CONFIG_SND_OSSEMUL
if (hwdep->ossreg) if (hwdep->ossreg)
snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device); snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device);
#endif #endif
snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device); snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device);
list_del_init(&hwdep->list); list_del_init(&hwdep->list);
mutex_unlock(&hwdep->open_mutex);
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
return 0; return 0;
} }
......
...@@ -213,6 +213,7 @@ int snd_card_create(int idx, const char *xid, ...@@ -213,6 +213,7 @@ int snd_card_create(int idx, const char *xid,
spin_lock_init(&card->files_lock); spin_lock_init(&card->files_lock);
INIT_LIST_HEAD(&card->files_list); INIT_LIST_HEAD(&card->files_list);
init_waitqueue_head(&card->shutdown_sleep); init_waitqueue_head(&card->shutdown_sleep);
atomic_set(&card->refcount, 0);
#ifdef CONFIG_PM #ifdef CONFIG_PM
mutex_init(&card->power_lock); mutex_init(&card->power_lock);
init_waitqueue_head(&card->power_sleep); init_waitqueue_head(&card->power_sleep);
...@@ -446,21 +447,36 @@ static int snd_card_do_free(struct snd_card *card) ...@@ -446,21 +447,36 @@ static int snd_card_do_free(struct snd_card *card)
return 0; return 0;
} }
/**
* snd_card_unref - release the reference counter
* @card: the card instance
*
* Decrements the reference counter. When it reaches to zero, wake up
* the sleeper and call the destructor if needed.
*/
void snd_card_unref(struct snd_card *card)
{
if (atomic_dec_and_test(&card->refcount)) {
wake_up(&card->shutdown_sleep);
if (card->free_on_last_close)
snd_card_do_free(card);
}
}
EXPORT_SYMBOL(snd_card_unref);
int snd_card_free_when_closed(struct snd_card *card) int snd_card_free_when_closed(struct snd_card *card)
{ {
int free_now = 0; int ret;
int ret = snd_card_disconnect(card);
if (ret) atomic_inc(&card->refcount);
ret = snd_card_disconnect(card);
if (ret) {
atomic_dec(&card->refcount);
return ret; return ret;
}
spin_lock(&card->files_lock);
if (list_empty(&card->files_list))
free_now = 1;
else
card->free_on_last_close = 1; card->free_on_last_close = 1;
spin_unlock(&card->files_lock); if (atomic_dec_and_test(&card->refcount))
if (free_now)
snd_card_do_free(card); snd_card_do_free(card);
return 0; return 0;
} }
...@@ -474,7 +490,7 @@ int snd_card_free(struct snd_card *card) ...@@ -474,7 +490,7 @@ int snd_card_free(struct snd_card *card)
return ret; return ret;
/* wait, until all devices are ready for the free operation */ /* wait, until all devices are ready for the free operation */
wait_event(card->shutdown_sleep, list_empty(&card->files_list)); wait_event(card->shutdown_sleep, !atomic_read(&card->refcount));
snd_card_do_free(card); snd_card_do_free(card);
return 0; return 0;
} }
...@@ -886,6 +902,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file) ...@@ -886,6 +902,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file)
return -ENODEV; return -ENODEV;
} }
list_add(&mfile->list, &card->files_list); list_add(&mfile->list, &card->files_list);
atomic_inc(&card->refcount);
spin_unlock(&card->files_lock); spin_unlock(&card->files_lock);
return 0; return 0;
} }
...@@ -908,7 +925,6 @@ EXPORT_SYMBOL(snd_card_file_add); ...@@ -908,7 +925,6 @@ EXPORT_SYMBOL(snd_card_file_add);
int snd_card_file_remove(struct snd_card *card, struct file *file) int snd_card_file_remove(struct snd_card *card, struct file *file)
{ {
struct snd_monitor_file *mfile, *found = NULL; struct snd_monitor_file *mfile, *found = NULL;
int last_close = 0;
spin_lock(&card->files_lock); spin_lock(&card->files_lock);
list_for_each_entry(mfile, &card->files_list, list) { list_for_each_entry(mfile, &card->files_list, list) {
...@@ -923,19 +939,13 @@ int snd_card_file_remove(struct snd_card *card, struct file *file) ...@@ -923,19 +939,13 @@ int snd_card_file_remove(struct snd_card *card, struct file *file)
break; break;
} }
} }
if (list_empty(&card->files_list))
last_close = 1;
spin_unlock(&card->files_lock); spin_unlock(&card->files_lock);
if (last_close) {
wake_up(&card->shutdown_sleep);
if (card->free_on_last_close)
snd_card_do_free(card);
}
if (!found) { if (!found) {
snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file); snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file);
return -ENOENT; return -ENOENT;
} }
kfree(found); kfree(found);
snd_card_unref(card);
return 0; return 0;
} }
......
...@@ -52,14 +52,19 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) ...@@ -52,14 +52,19 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
SNDRV_OSS_DEVICE_TYPE_MIXER); SNDRV_OSS_DEVICE_TYPE_MIXER);
if (card == NULL) if (card == NULL)
return -ENODEV; return -ENODEV;
if (card->mixer_oss == NULL) if (card->mixer_oss == NULL) {
snd_card_unref(card);
return -ENODEV; return -ENODEV;
}
err = snd_card_file_add(card, file); err = snd_card_file_add(card, file);
if (err < 0) if (err < 0) {
snd_card_unref(card);
return err; return err;
}
fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL); fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL);
if (fmixer == NULL) { if (fmixer == NULL) {
snd_card_file_remove(card, file); snd_card_file_remove(card, file);
snd_card_unref(card);
return -ENOMEM; return -ENOMEM;
} }
fmixer->card = card; fmixer->card = card;
...@@ -68,6 +73,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) ...@@ -68,6 +73,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
if (!try_module_get(card->module)) { if (!try_module_get(card->module)) {
kfree(fmixer); kfree(fmixer);
snd_card_file_remove(card, file); snd_card_file_remove(card, file);
snd_card_unref(card);
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
......
...@@ -2441,6 +2441,10 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) ...@@ -2441,6 +2441,10 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
mutex_unlock(&pcm->open_mutex); mutex_unlock(&pcm->open_mutex);
schedule(); schedule();
mutex_lock(&pcm->open_mutex); mutex_lock(&pcm->open_mutex);
if (pcm->card->shutdown) {
err = -ENODEV;
break;
}
if (signal_pending(current)) { if (signal_pending(current)) {
err = -ERESTARTSYS; err = -ERESTARTSYS;
break; break;
...@@ -2457,6 +2461,8 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) ...@@ -2457,6 +2461,8 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
__error2: __error2:
snd_card_file_remove(pcm->card, file); snd_card_file_remove(pcm->card, file);
__error1: __error1:
if (pcm)
snd_card_unref(pcm->card);
return err; return err;
} }
......
...@@ -1086,11 +1086,19 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) ...@@ -1086,11 +1086,19 @@ static int snd_pcm_dev_disconnect(struct snd_device *device)
if (list_empty(&pcm->list)) if (list_empty(&pcm->list))
goto unlock; goto unlock;
mutex_lock(&pcm->open_mutex);
wake_up(&pcm->open_wait);
list_del_init(&pcm->list); list_del_init(&pcm->list);
for (cidx = 0; cidx < 2; cidx++) for (cidx = 0; cidx < 2; cidx++)
for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) {
if (substream->runtime) snd_pcm_stream_lock_irq(substream);
if (substream->runtime) {
substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED; substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED;
wake_up(&substream->runtime->sleep);
wake_up(&substream->runtime->tsleep);
}
snd_pcm_stream_unlock_irq(substream);
}
list_for_each_entry(notify, &snd_pcm_notify_list, list) { list_for_each_entry(notify, &snd_pcm_notify_list, list) {
notify->n_disconnect(pcm); notify->n_disconnect(pcm);
} }
...@@ -1110,6 +1118,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) ...@@ -1110,6 +1118,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device)
pcm->streams[cidx].chmap_kctl = NULL; pcm->streams[cidx].chmap_kctl = NULL;
} }
} }
mutex_unlock(&pcm->open_mutex);
unlock: unlock:
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
return 0; return 0;
......
...@@ -369,6 +369,14 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime) ...@@ -369,6 +369,14 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime)
return usecs; return usecs;
} }
static void snd_pcm_set_state(struct snd_pcm_substream *substream, int state)
{
snd_pcm_stream_lock_irq(substream);
if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED)
substream->runtime->status->state = state;
snd_pcm_stream_unlock_irq(substream);
}
static int snd_pcm_hw_params(struct snd_pcm_substream *substream, static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
...@@ -452,7 +460,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -452,7 +460,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
runtime->boundary *= 2; runtime->boundary *= 2;
snd_pcm_timer_resolution_change(substream); snd_pcm_timer_resolution_change(substream);
runtime->status->state = SNDRV_PCM_STATE_SETUP; snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP);
if (pm_qos_request_active(&substream->latency_pm_qos_req)) if (pm_qos_request_active(&substream->latency_pm_qos_req))
pm_qos_remove_request(&substream->latency_pm_qos_req); pm_qos_remove_request(&substream->latency_pm_qos_req);
...@@ -464,7 +472,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -464,7 +472,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
/* hardware might be unusable from this time, /* hardware might be unusable from this time,
so we force application to retry to set so we force application to retry to set
the correct hardware parameter settings */ the correct hardware parameter settings */
runtime->status->state = SNDRV_PCM_STATE_OPEN; snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
if (substream->ops->hw_free != NULL) if (substream->ops->hw_free != NULL)
substream->ops->hw_free(substream); substream->ops->hw_free(substream);
return err; return err;
...@@ -512,7 +520,7 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream) ...@@ -512,7 +520,7 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream)
return -EBADFD; return -EBADFD;
if (substream->ops->hw_free) if (substream->ops->hw_free)
result = substream->ops->hw_free(substream); result = substream->ops->hw_free(substream);
runtime->status->state = SNDRV_PCM_STATE_OPEN; snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
pm_qos_remove_request(&substream->latency_pm_qos_req); pm_qos_remove_request(&substream->latency_pm_qos_req);
return result; return result;
} }
...@@ -1320,7 +1328,7 @@ static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state) ...@@ -1320,7 +1328,7 @@ static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
runtime->control->appl_ptr = runtime->status->hw_ptr; runtime->control->appl_ptr = runtime->status->hw_ptr;
runtime->status->state = SNDRV_PCM_STATE_PREPARED; snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED);
} }
static struct action_ops snd_pcm_action_prepare = { static struct action_ops snd_pcm_action_prepare = {
...@@ -1510,6 +1518,10 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, ...@@ -1510,6 +1518,10 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
down_read(&snd_pcm_link_rwsem); down_read(&snd_pcm_link_rwsem);
snd_pcm_stream_lock_irq(substream); snd_pcm_stream_lock_irq(substream);
remove_wait_queue(&to_check->sleep, &wait); remove_wait_queue(&to_check->sleep, &wait);
if (card->shutdown) {
result = -ENODEV;
break;
}
if (tout == 0) { if (tout == 0) {
if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
result = -ESTRPIPE; result = -ESTRPIPE;
...@@ -1634,6 +1646,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) ...@@ -1634,6 +1646,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
write_unlock_irq(&snd_pcm_link_rwlock); write_unlock_irq(&snd_pcm_link_rwlock);
up_write(&snd_pcm_link_rwsem); up_write(&snd_pcm_link_rwsem);
_nolock: _nolock:
snd_card_unref(substream1->pcm->card);
fput_light(file, fput_needed); fput_light(file, fput_needed);
if (res < 0) if (res < 0)
kfree(group); kfree(group);
...@@ -2108,7 +2121,9 @@ static int snd_pcm_playback_open(struct inode *inode, struct file *file) ...@@ -2108,7 +2121,9 @@ static int snd_pcm_playback_open(struct inode *inode, struct file *file)
return err; return err;
pcm = snd_lookup_minor_data(iminor(inode), pcm = snd_lookup_minor_data(iminor(inode),
SNDRV_DEVICE_TYPE_PCM_PLAYBACK); SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK); err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);
snd_card_unref(pcm->card);
return err;
} }
static int snd_pcm_capture_open(struct inode *inode, struct file *file) static int snd_pcm_capture_open(struct inode *inode, struct file *file)
...@@ -2119,7 +2134,9 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file) ...@@ -2119,7 +2134,9 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file)
return err; return err;
pcm = snd_lookup_minor_data(iminor(inode), pcm = snd_lookup_minor_data(iminor(inode),
SNDRV_DEVICE_TYPE_PCM_CAPTURE); SNDRV_DEVICE_TYPE_PCM_CAPTURE);
return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE); err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);
snd_card_unref(pcm->card);
return err;
} }
static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream)
...@@ -2156,6 +2173,10 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) ...@@ -2156,6 +2173,10 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream)
mutex_unlock(&pcm->open_mutex); mutex_unlock(&pcm->open_mutex);
schedule(); schedule();
mutex_lock(&pcm->open_mutex); mutex_lock(&pcm->open_mutex);
if (pcm->card->shutdown) {
err = -ENODEV;
break;
}
if (signal_pending(current)) { if (signal_pending(current)) {
err = -ERESTARTSYS; err = -ERESTARTSYS;
break; break;
......
...@@ -379,8 +379,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -379,8 +379,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
if (rmidi == NULL) if (rmidi == NULL)
return -ENODEV; return -ENODEV;
if (!try_module_get(rmidi->card->module)) if (!try_module_get(rmidi->card->module)) {
snd_card_unref(rmidi->card);
return -ENXIO; return -ENXIO;
}
mutex_lock(&rmidi->open_mutex); mutex_lock(&rmidi->open_mutex);
card = rmidi->card; card = rmidi->card;
...@@ -422,6 +424,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -422,6 +424,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
mutex_unlock(&rmidi->open_mutex); mutex_unlock(&rmidi->open_mutex);
schedule(); schedule();
mutex_lock(&rmidi->open_mutex); mutex_lock(&rmidi->open_mutex);
if (rmidi->card->shutdown) {
err = -ENODEV;
break;
}
if (signal_pending(current)) { if (signal_pending(current)) {
err = -ERESTARTSYS; err = -ERESTARTSYS;
break; break;
...@@ -440,6 +446,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -440,6 +446,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
#endif #endif
file->private_data = rawmidi_file; file->private_data = rawmidi_file;
mutex_unlock(&rmidi->open_mutex); mutex_unlock(&rmidi->open_mutex);
snd_card_unref(rmidi->card);
return 0; return 0;
__error: __error:
...@@ -447,6 +454,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -447,6 +454,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
__error_card: __error_card:
mutex_unlock(&rmidi->open_mutex); mutex_unlock(&rmidi->open_mutex);
module_put(rmidi->card->module); module_put(rmidi->card->module);
snd_card_unref(rmidi->card);
return err; return err;
} }
...@@ -991,6 +999,8 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun ...@@ -991,6 +999,8 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun
spin_unlock_irq(&runtime->lock); spin_unlock_irq(&runtime->lock);
schedule(); schedule();
remove_wait_queue(&runtime->sleep, &wait); remove_wait_queue(&runtime->sleep, &wait);
if (rfile->rmidi->card->shutdown)
return -ENODEV;
if (signal_pending(current)) if (signal_pending(current))
return result > 0 ? result : -ERESTARTSYS; return result > 0 ? result : -ERESTARTSYS;
if (!runtime->avail) if (!runtime->avail)
...@@ -1234,6 +1244,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, ...@@ -1234,6 +1244,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf,
spin_unlock_irq(&runtime->lock); spin_unlock_irq(&runtime->lock);
timeout = schedule_timeout(30 * HZ); timeout = schedule_timeout(30 * HZ);
remove_wait_queue(&runtime->sleep, &wait); remove_wait_queue(&runtime->sleep, &wait);
if (rfile->rmidi->card->shutdown)
return -ENODEV;
if (signal_pending(current)) if (signal_pending(current))
return result > 0 ? result : -ERESTARTSYS; return result > 0 ? result : -ERESTARTSYS;
if (!runtime->avail && !timeout) if (!runtime->avail && !timeout)
...@@ -1609,9 +1621,20 @@ static int snd_rawmidi_dev_register(struct snd_device *device) ...@@ -1609,9 +1621,20 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
static int snd_rawmidi_dev_disconnect(struct snd_device *device) static int snd_rawmidi_dev_disconnect(struct snd_device *device)
{ {
struct snd_rawmidi *rmidi = device->device_data; struct snd_rawmidi *rmidi = device->device_data;
int dir;
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
mutex_lock(&rmidi->open_mutex);
wake_up(&rmidi->open_wait);
list_del_init(&rmidi->list); list_del_init(&rmidi->list);
for (dir = 0; dir < 2; dir++) {
struct snd_rawmidi_substream *s;
list_for_each_entry(s, &rmidi->streams[dir].substreams, list) {
if (s->runtime)
wake_up(&s->runtime->sleep);
}
}
#ifdef CONFIG_SND_OSSEMUL #ifdef CONFIG_SND_OSSEMUL
if (rmidi->ossreg) { if (rmidi->ossreg) {
if ((int)rmidi->device == midi_map[rmidi->card->number]) { if ((int)rmidi->device == midi_map[rmidi->card->number]) {
...@@ -1626,6 +1649,7 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device) ...@@ -1626,6 +1649,7 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device)
} }
#endif /* CONFIG_SND_OSSEMUL */ #endif /* CONFIG_SND_OSSEMUL */
snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device); snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device);
mutex_unlock(&rmidi->open_mutex);
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
return 0; return 0;
} }
......
...@@ -98,6 +98,10 @@ static void snd_request_other(int minor) ...@@ -98,6 +98,10 @@ static void snd_request_other(int minor)
* *
* Checks that a minor device with the specified type is registered, and returns * Checks that a minor device with the specified type is registered, and returns
* its user data pointer. * its user data pointer.
*
* This function increments the reference counter of the card instance
* if an associated instance with the given minor number and type is found.
* The caller must call snd_card_unref() appropriately later.
*/ */
void *snd_lookup_minor_data(unsigned int minor, int type) void *snd_lookup_minor_data(unsigned int minor, int type)
{ {
...@@ -108,9 +112,11 @@ void *snd_lookup_minor_data(unsigned int minor, int type) ...@@ -108,9 +112,11 @@ void *snd_lookup_minor_data(unsigned int minor, int type)
return NULL; return NULL;
mutex_lock(&sound_mutex); mutex_lock(&sound_mutex);
mreg = snd_minors[minor]; mreg = snd_minors[minor];
if (mreg && mreg->type == type) if (mreg && mreg->type == type) {
private_data = mreg->private_data; private_data = mreg->private_data;
else if (mreg->card_ptr)
atomic_inc(&mreg->card_ptr->refcount);
} else
private_data = NULL; private_data = NULL;
mutex_unlock(&sound_mutex); mutex_unlock(&sound_mutex);
return private_data; return private_data;
...@@ -275,6 +281,7 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev, ...@@ -275,6 +281,7 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev,
preg->device = dev; preg->device = dev;
preg->f_ops = f_ops; preg->f_ops = f_ops;
preg->private_data = private_data; preg->private_data = private_data;
preg->card_ptr = card;
mutex_lock(&sound_mutex); mutex_lock(&sound_mutex);
#ifdef CONFIG_SND_DYNAMIC_MINORS #ifdef CONFIG_SND_DYNAMIC_MINORS
minor = snd_find_free_minor(type); minor = snd_find_free_minor(type);
......
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS]; static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
static DEFINE_MUTEX(sound_oss_mutex); static DEFINE_MUTEX(sound_oss_mutex);
/* NOTE: This function increments the refcount of the associated card like
* snd_lookup_minor_data(); the caller must call snd_card_unref() appropriately
*/
void *snd_lookup_oss_minor_data(unsigned int minor, int type) void *snd_lookup_oss_minor_data(unsigned int minor, int type)
{ {
struct snd_minor *mreg; struct snd_minor *mreg;
...@@ -49,9 +52,11 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type) ...@@ -49,9 +52,11 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type)
return NULL; return NULL;
mutex_lock(&sound_oss_mutex); mutex_lock(&sound_oss_mutex);
mreg = snd_oss_minors[minor]; mreg = snd_oss_minors[minor];
if (mreg && mreg->type == type) if (mreg && mreg->type == type) {
private_data = mreg->private_data; private_data = mreg->private_data;
else if (mreg->card_ptr)
atomic_inc(&mreg->card_ptr->refcount);
} else
private_data = NULL; private_data = NULL;
mutex_unlock(&sound_oss_mutex); mutex_unlock(&sound_oss_mutex);
return private_data; return private_data;
...@@ -123,6 +128,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, ...@@ -123,6 +128,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
preg->device = dev; preg->device = dev;
preg->f_ops = f_ops; preg->f_ops = f_ops;
preg->private_data = private_data; preg->private_data = private_data;
preg->card_ptr = card;
mutex_lock(&sound_oss_mutex); mutex_lock(&sound_oss_mutex);
snd_oss_minors[minor] = preg; snd_oss_minors[minor] = preg;
minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); minor_unit = SNDRV_MINOR_OSS_DEVICE(minor);
......
...@@ -1763,6 +1763,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { ...@@ -1763,6 +1763,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
"HP", STAC_HP_ZEPHYR), "HP", STAC_HP_ZEPHYR),
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660, SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
"HP Mini", STAC_92HD83XXX_HP_LED), "HP Mini", STAC_92HD83XXX_HP_LED),
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E,
"HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED),
{} /* terminator */ {} /* terminator */
}; };
......
...@@ -2859,7 +2859,12 @@ static int snd_vt1724_resume(struct device *dev) ...@@ -2859,7 +2859,12 @@ static int snd_vt1724_resume(struct device *dev)
ice->set_spdif_clock(ice, 0); ice->set_spdif_clock(ice, 0);
} else { } else {
/* internal on-card clock */ /* internal on-card clock */
snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1); int rate;
if (ice->cur_rate)
rate = ice->cur_rate;
else
rate = ice->pro_rate_default;
snd_vt1724_set_pro_rate(ice, rate, 1);
} }
update_spdif_bits(ice, ice->pm_saved_spdif_ctrl); update_spdif_bits(ice, ice->pm_saved_spdif_ctrl);
......
...@@ -464,9 +464,9 @@ static __devinit int asoc_dmic_probe(struct platform_device *pdev) ...@@ -464,9 +464,9 @@ static __devinit int asoc_dmic_probe(struct platform_device *pdev)
mutex_init(&dmic->mutex); mutex_init(&dmic->mutex);
dmic->fclk = clk_get(dmic->dev, "dmic_fck"); dmic->fclk = clk_get(dmic->dev, "fck");
if (IS_ERR(dmic->fclk)) { if (IS_ERR(dmic->fclk)) {
dev_err(dmic->dev, "cant get dmic_fck\n"); dev_err(dmic->dev, "cant get fck\n");
return -ENODEV; return -ENODEV;
} }
......
...@@ -21,15 +21,14 @@ ...@@ -21,15 +21,14 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/soc.h> #include <sound/soc.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <mach/hardware.h>
#include <mach/gpio.h>
#include <mach/board-zoom.h>
#include <linux/platform_data/asoc-ti-mcbsp.h> #include <linux/platform_data/asoc-ti-mcbsp.h>
#include <linux/platform_data/gpio-omap.h>
/* Register descriptions for twl4030 codec part */ /* Register descriptions for twl4030 codec part */
#include <linux/mfd/twl4030-audio.h> #include <linux/mfd/twl4030-audio.h>
......
...@@ -339,7 +339,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, ...@@ -339,7 +339,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
} }
mutex_init(&chip->mutex); mutex_init(&chip->mutex);
mutex_init(&chip->shutdown_mutex); init_rwsem(&chip->shutdown_rwsem);
chip->index = idx; chip->index = idx;
chip->dev = dev; chip->dev = dev;
chip->card = card; chip->card = card;
...@@ -560,7 +560,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, ...@@ -560,7 +560,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
card = chip->card; card = chip->card;
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
mutex_lock(&chip->shutdown_mutex); down_write(&chip->shutdown_rwsem);
chip->shutdown = 1; chip->shutdown = 1;
chip->num_interfaces--; chip->num_interfaces--;
if (chip->num_interfaces <= 0) { if (chip->num_interfaces <= 0) {
...@@ -582,11 +582,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, ...@@ -582,11 +582,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
snd_usb_mixer_disconnect(p); snd_usb_mixer_disconnect(p);
} }
usb_chip[chip->index] = NULL; usb_chip[chip->index] = NULL;
mutex_unlock(&chip->shutdown_mutex); up_write(&chip->shutdown_rwsem);
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
snd_card_free_when_closed(card); snd_card_free_when_closed(card);
} else { } else {
mutex_unlock(&chip->shutdown_mutex); up_write(&chip->shutdown_rwsem);
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
} }
} }
...@@ -618,16 +618,20 @@ int snd_usb_autoresume(struct snd_usb_audio *chip) ...@@ -618,16 +618,20 @@ int snd_usb_autoresume(struct snd_usb_audio *chip)
{ {
int err = -ENODEV; int err = -ENODEV;
down_read(&chip->shutdown_rwsem);
if (!chip->shutdown && !chip->probing) if (!chip->shutdown && !chip->probing)
err = usb_autopm_get_interface(chip->pm_intf); err = usb_autopm_get_interface(chip->pm_intf);
up_read(&chip->shutdown_rwsem);
return err; return err;
} }
void snd_usb_autosuspend(struct snd_usb_audio *chip) void snd_usb_autosuspend(struct snd_usb_audio *chip)
{ {
down_read(&chip->shutdown_rwsem);
if (!chip->shutdown && !chip->probing) if (!chip->shutdown && !chip->probing)
usb_autopm_put_interface(chip->pm_intf); usb_autopm_put_interface(chip->pm_intf);
up_read(&chip->shutdown_rwsem);
} }
static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
......
...@@ -126,6 +126,7 @@ struct snd_usb_substream { ...@@ -126,6 +126,7 @@ struct snd_usb_substream {
struct snd_usb_endpoint *sync_endpoint; struct snd_usb_endpoint *sync_endpoint;
unsigned long flags; unsigned long flags;
bool need_setup_ep; /* (re)configure EP at prepare? */ bool need_setup_ep; /* (re)configure EP at prepare? */
unsigned int speed; /* USB_SPEED_XXX */
u64 formats; /* format bitmasks (all or'ed) */ u64 formats; /* format bitmasks (all or'ed) */
unsigned int num_formats; /* number of supported audio formats (list) */ unsigned int num_formats; /* number of supported audio formats (list) */
......
...@@ -287,25 +287,32 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v ...@@ -287,25 +287,32 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v
unsigned char buf[2]; unsigned char buf[2];
int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;
int timeout = 10; int timeout = 10;
int err; int idx = 0, err;
err = snd_usb_autoresume(cval->mixer->chip); err = snd_usb_autoresume(cval->mixer->chip);
if (err < 0) if (err < 0)
return -EIO; return -EIO;
down_read(&chip->shutdown_rwsem);
while (timeout-- > 0) { while (timeout-- > 0) {
if (chip->shutdown)
break;
idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request, if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request,
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), validx, idx, buf, val_len) >= val_len) {
buf, val_len) >= val_len) {
*value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len)); *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len));
snd_usb_autosuspend(cval->mixer->chip); err = 0;
return 0; goto out;
} }
} }
snd_usb_autosuspend(cval->mixer->chip);
snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type); request, validx, idx, cval->val_type);
return -EINVAL; err = -EINVAL;
out:
up_read(&chip->shutdown_rwsem);
snd_usb_autosuspend(cval->mixer->chip);
return err;
} }
static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)
...@@ -313,7 +320,7 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v ...@@ -313,7 +320,7 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
struct snd_usb_audio *chip = cval->mixer->chip; struct snd_usb_audio *chip = cval->mixer->chip;
unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */ unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */
unsigned char *val; unsigned char *val;
int ret, size; int idx = 0, ret, size;
__u8 bRequest; __u8 bRequest;
if (request == UAC_GET_CUR) { if (request == UAC_GET_CUR) {
...@@ -330,16 +337,22 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v ...@@ -330,16 +337,22 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
if (ret) if (ret)
goto error; goto error;
down_read(&chip->shutdown_rwsem);
if (chip->shutdown)
ret = -ENODEV;
else {
idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest, ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest,
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), validx, idx, buf, size);
buf, size); }
up_read(&chip->shutdown_rwsem);
snd_usb_autosuspend(chip); snd_usb_autosuspend(chip);
if (ret < 0) { if (ret < 0) {
error: error:
snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type); request, validx, idx, cval->val_type);
return ret; return ret;
} }
...@@ -417,7 +430,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, ...@@ -417,7 +430,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
{ {
struct snd_usb_audio *chip = cval->mixer->chip; struct snd_usb_audio *chip = cval->mixer->chip;
unsigned char buf[2]; unsigned char buf[2];
int val_len, err, timeout = 10; int idx = 0, val_len, err, timeout = 10;
if (cval->mixer->protocol == UAC_VERSION_1) { if (cval->mixer->protocol == UAC_VERSION_1) {
val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;
...@@ -440,19 +453,27 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, ...@@ -440,19 +453,27 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
err = snd_usb_autoresume(chip); err = snd_usb_autoresume(chip);
if (err < 0) if (err < 0)
return -EIO; return -EIO;
while (timeout-- > 0) down_read(&chip->shutdown_rwsem);
while (timeout-- > 0) {
if (chip->shutdown)
break;
idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
if (snd_usb_ctl_msg(chip->dev, if (snd_usb_ctl_msg(chip->dev,
usb_sndctrlpipe(chip->dev, 0), request, usb_sndctrlpipe(chip->dev, 0), request,
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), validx, idx, buf, val_len) >= 0) {
buf, val_len) >= 0) { err = 0;
snd_usb_autosuspend(chip); goto out;
return 0; }
} }
snd_usb_autosuspend(chip);
snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n", snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n",
request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type, buf[0], buf[1]); request, validx, idx, cval->val_type, buf[0], buf[1]);
return -EINVAL; err = -EINVAL;
out:
up_read(&chip->shutdown_rwsem);
snd_usb_autosuspend(chip);
return err;
} }
static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value) static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value)
......
...@@ -283,6 +283,11 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e ...@@ -283,6 +283,11 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
if (value > 1) if (value > 1)
return -EINVAL; return -EINVAL;
changed = value != mixer->audigy2nx_leds[index]; changed = value != mixer->audigy2nx_leds[index];
down_read(&mixer->chip->shutdown_rwsem);
if (mixer->chip->shutdown) {
err = -ENODEV;
goto out;
}
if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042))
err = snd_usb_ctl_msg(mixer->chip->dev, err = snd_usb_ctl_msg(mixer->chip->dev,
usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
...@@ -299,6 +304,8 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e ...@@ -299,6 +304,8 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
value, index + 2, NULL, 0); value, index + 2, NULL, 0);
out:
up_read(&mixer->chip->shutdown_rwsem);
if (err < 0) if (err < 0)
return err; return err;
mixer->audigy2nx_leds[index] = value; mixer->audigy2nx_leds[index] = value;
...@@ -392,11 +399,16 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry, ...@@ -392,11 +399,16 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry,
for (i = 0; jacks[i].name; ++i) { for (i = 0; jacks[i].name; ++i) {
snd_iprintf(buffer, "%s: ", jacks[i].name); snd_iprintf(buffer, "%s: ", jacks[i].name);
down_read(&mixer->chip->shutdown_rwsem);
if (mixer->chip->shutdown)
err = 0;
else
err = snd_usb_ctl_msg(mixer->chip->dev, err = snd_usb_ctl_msg(mixer->chip->dev,
usb_rcvctrlpipe(mixer->chip->dev, 0), usb_rcvctrlpipe(mixer->chip->dev, 0),
UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS | UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS |
USB_RECIP_INTERFACE, 0, USB_RECIP_INTERFACE, 0,
jacks[i].unitid << 8, buf, 3); jacks[i].unitid << 8, buf, 3);
up_read(&mixer->chip->shutdown_rwsem);
if (err == 3 && (buf[0] == 3 || buf[0] == 6)) if (err == 3 && (buf[0] == 3 || buf[0] == 6))
snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]); snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]);
else else
...@@ -426,10 +438,15 @@ static int snd_xonar_u1_switch_put(struct snd_kcontrol *kcontrol, ...@@ -426,10 +438,15 @@ static int snd_xonar_u1_switch_put(struct snd_kcontrol *kcontrol,
else else
new_status = old_status & ~0x02; new_status = old_status & ~0x02;
changed = new_status != old_status; changed = new_status != old_status;
down_read(&mixer->chip->shutdown_rwsem);
if (mixer->chip->shutdown)
err = -ENODEV;
else
err = snd_usb_ctl_msg(mixer->chip->dev, err = snd_usb_ctl_msg(mixer->chip->dev,
usb_sndctrlpipe(mixer->chip->dev, 0), 0x08, usb_sndctrlpipe(mixer->chip->dev, 0), 0x08,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
50, 0, &new_status, 1); 50, 0, &new_status, 1);
up_read(&mixer->chip->shutdown_rwsem);
if (err < 0) if (err < 0)
return err; return err;
mixer->xonar_u1_status = new_status; mixer->xonar_u1_status = new_status;
...@@ -468,11 +485,17 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol, ...@@ -468,11 +485,17 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol,
u8 bRequest = (kcontrol->private_value >> 16) & 0xff; u8 bRequest = (kcontrol->private_value >> 16) & 0xff;
u16 wIndex = kcontrol->private_value & 0xffff; u16 wIndex = kcontrol->private_value & 0xffff;
u8 tmp; u8 tmp;
int ret;
int ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, down_read(&mixer->chip->shutdown_rwsem);
if (mixer->chip->shutdown)
ret = -ENODEV;
else
ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
0, cpu_to_le16(wIndex), 0, cpu_to_le16(wIndex),
&tmp, sizeof(tmp), 1000); &tmp, sizeof(tmp), 1000);
up_read(&mixer->chip->shutdown_rwsem);
if (ret < 0) { if (ret < 0) {
snd_printk(KERN_ERR snd_printk(KERN_ERR
...@@ -493,11 +516,17 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol, ...@@ -493,11 +516,17 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol,
u8 bRequest = (kcontrol->private_value >> 16) & 0xff; u8 bRequest = (kcontrol->private_value >> 16) & 0xff;
u16 wIndex = kcontrol->private_value & 0xffff; u16 wIndex = kcontrol->private_value & 0xffff;
u16 wValue = ucontrol->value.integer.value[0]; u16 wValue = ucontrol->value.integer.value[0];
int ret;
int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest, down_read(&mixer->chip->shutdown_rwsem);
if (mixer->chip->shutdown)
ret = -ENODEV;
else
ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
cpu_to_le16(wValue), cpu_to_le16(wIndex), cpu_to_le16(wValue), cpu_to_le16(wIndex),
NULL, 0, 1000); NULL, 0, 1000);
up_read(&mixer->chip->shutdown_rwsem);
if (ret < 0) { if (ret < 0) {
snd_printk(KERN_ERR snd_printk(KERN_ERR
...@@ -656,11 +685,16 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl, ...@@ -656,11 +685,16 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl,
return -EINVAL; return -EINVAL;
down_read(&mixer->chip->shutdown_rwsem);
if (mixer->chip->shutdown)
err = -ENODEV;
else
err = snd_usb_ctl_msg(chip->dev, err = snd_usb_ctl_msg(chip->dev,
usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR,
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
value, val_len); value, val_len);
up_read(&mixer->chip->shutdown_rwsem);
if (err < 0) if (err < 0)
return err; return err;
...@@ -703,11 +737,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, ...@@ -703,11 +737,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl,
if (!pval->is_cached) { if (!pval->is_cached) {
/* Read current value */ /* Read current value */
down_read(&mixer->chip->shutdown_rwsem);
if (mixer->chip->shutdown)
err = -ENODEV;
else
err = snd_usb_ctl_msg(chip->dev, err = snd_usb_ctl_msg(chip->dev,
usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR,
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
value, val_len); value, val_len);
up_read(&mixer->chip->shutdown_rwsem);
if (err < 0) if (err < 0)
return err; return err;
...@@ -719,11 +758,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, ...@@ -719,11 +758,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl,
if (cur_val != new_val) { if (cur_val != new_val) {
value[0] = new_val; value[0] = new_val;
value[1] = 0; value[1] = 0;
down_read(&mixer->chip->shutdown_rwsem);
if (mixer->chip->shutdown)
err = -ENODEV;
else
err = snd_usb_ctl_msg(chip->dev, err = snd_usb_ctl_msg(chip->dev,
usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR, usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR,
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
value, val_len); value, val_len);
up_read(&mixer->chip->shutdown_rwsem);
if (err < 0) if (err < 0)
return err; return err;
......
...@@ -71,6 +71,8 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream ...@@ -71,6 +71,8 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream
unsigned int hwptr_done; unsigned int hwptr_done;
subs = (struct snd_usb_substream *)substream->runtime->private_data; subs = (struct snd_usb_substream *)substream->runtime->private_data;
if (subs->stream->chip->shutdown)
return SNDRV_PCM_POS_XRUN;
spin_lock(&subs->lock); spin_lock(&subs->lock);
hwptr_done = subs->hwptr_done; hwptr_done = subs->hwptr_done;
substream->runtime->delay = snd_usb_pcm_delay(subs, substream->runtime->delay = snd_usb_pcm_delay(subs,
...@@ -444,7 +446,6 @@ static int configure_endpoint(struct snd_usb_substream *subs) ...@@ -444,7 +446,6 @@ static int configure_endpoint(struct snd_usb_substream *subs)
{ {
int ret; int ret;
mutex_lock(&subs->stream->chip->shutdown_mutex);
/* format changed */ /* format changed */
stop_endpoints(subs, 0, 0, 0); stop_endpoints(subs, 0, 0, 0);
ret = snd_usb_endpoint_set_params(subs->data_endpoint, ret = snd_usb_endpoint_set_params(subs->data_endpoint,
...@@ -455,7 +456,7 @@ static int configure_endpoint(struct snd_usb_substream *subs) ...@@ -455,7 +456,7 @@ static int configure_endpoint(struct snd_usb_substream *subs)
subs->cur_audiofmt, subs->cur_audiofmt,
subs->sync_endpoint); subs->sync_endpoint);
if (ret < 0) if (ret < 0)
goto unlock; return ret;
if (subs->sync_endpoint) if (subs->sync_endpoint)
ret = snd_usb_endpoint_set_params(subs->data_endpoint, ret = snd_usb_endpoint_set_params(subs->data_endpoint,
...@@ -465,9 +466,6 @@ static int configure_endpoint(struct snd_usb_substream *subs) ...@@ -465,9 +466,6 @@ static int configure_endpoint(struct snd_usb_substream *subs)
subs->cur_rate, subs->cur_rate,
subs->cur_audiofmt, subs->cur_audiofmt,
NULL); NULL);
unlock:
mutex_unlock(&subs->stream->chip->shutdown_mutex);
return ret; return ret;
} }
...@@ -505,7 +503,13 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, ...@@ -505,7 +503,13 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
} }
if ((ret = set_format(subs, fmt)) < 0) down_read(&subs->stream->chip->shutdown_rwsem);
if (subs->stream->chip->shutdown)
ret = -ENODEV;
else
ret = set_format(subs, fmt);
up_read(&subs->stream->chip->shutdown_rwsem);
if (ret < 0)
return ret; return ret;
subs->interface = fmt->iface; subs->interface = fmt->iface;
...@@ -527,10 +531,12 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) ...@@ -527,10 +531,12 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
subs->cur_audiofmt = NULL; subs->cur_audiofmt = NULL;
subs->cur_rate = 0; subs->cur_rate = 0;
subs->period_bytes = 0; subs->period_bytes = 0;
mutex_lock(&subs->stream->chip->shutdown_mutex); down_read(&subs->stream->chip->shutdown_rwsem);
if (!subs->stream->chip->shutdown) {
stop_endpoints(subs, 0, 1, 1); stop_endpoints(subs, 0, 1, 1);
deactivate_endpoints(subs); deactivate_endpoints(subs);
mutex_unlock(&subs->stream->chip->shutdown_mutex); }
up_read(&subs->stream->chip->shutdown_rwsem);
return snd_pcm_lib_free_vmalloc_buffer(substream); return snd_pcm_lib_free_vmalloc_buffer(substream);
} }
...@@ -552,12 +558,19 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -552,12 +558,19 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
return -ENXIO; return -ENXIO;
} }
if (snd_BUG_ON(!subs->data_endpoint)) down_read(&subs->stream->chip->shutdown_rwsem);
return -EIO; if (subs->stream->chip->shutdown) {
ret = -ENODEV;
goto unlock;
}
if (snd_BUG_ON(!subs->data_endpoint)) {
ret = -EIO;
goto unlock;
}
ret = set_format(subs, subs->cur_audiofmt); ret = set_format(subs, subs->cur_audiofmt);
if (ret < 0) if (ret < 0)
return ret; goto unlock;
iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface); iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
alts = &iface->altsetting[subs->cur_audiofmt->altset_idx]; alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
...@@ -567,12 +580,12 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -567,12 +580,12 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
subs->cur_audiofmt, subs->cur_audiofmt,
subs->cur_rate); subs->cur_rate);
if (ret < 0) if (ret < 0)
return ret; goto unlock;
if (subs->need_setup_ep) { if (subs->need_setup_ep) {
ret = configure_endpoint(subs); ret = configure_endpoint(subs);
if (ret < 0) if (ret < 0)
return ret; goto unlock;
subs->need_setup_ep = false; subs->need_setup_ep = false;
} }
...@@ -592,9 +605,11 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -592,9 +605,11 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
/* for playback, submit the URBs now; otherwise, the first hwptr_done /* for playback, submit the URBs now; otherwise, the first hwptr_done
* updates for all URBs would happen at the same time when starting */ * updates for all URBs would happen at the same time when starting */
if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK)
return start_endpoints(subs, 1); ret = start_endpoints(subs, 1);
return 0; unlock:
up_read(&subs->stream->chip->shutdown_rwsem);
return ret;
} }
static struct snd_pcm_hardware snd_usb_hardware = static struct snd_pcm_hardware snd_usb_hardware =
...@@ -647,7 +662,7 @@ static int hw_check_valid_format(struct snd_usb_substream *subs, ...@@ -647,7 +662,7 @@ static int hw_check_valid_format(struct snd_usb_substream *subs,
return 0; return 0;
} }
/* check whether the period time is >= the data packet interval */ /* check whether the period time is >= the data packet interval */
if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL) { if (subs->speed != USB_SPEED_FULL) {
ptime = 125 * (1 << fp->datainterval); ptime = 125 * (1 << fp->datainterval);
if (ptime > pt->max || (ptime == pt->max && pt->openmax)) { if (ptime > pt->max || (ptime == pt->max && pt->openmax)) {
hwc_debug(" > check: ptime %u > max %u\n", ptime, pt->max); hwc_debug(" > check: ptime %u > max %u\n", ptime, pt->max);
...@@ -925,7 +940,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre ...@@ -925,7 +940,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre
return err; return err;
param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME; param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME;
if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL) if (subs->speed == USB_SPEED_FULL)
/* full speed devices have fixed data packet interval */ /* full speed devices have fixed data packet interval */
ptmin = 1000; ptmin = 1000;
if (ptmin == 1000) if (ptmin == 1000)
......
...@@ -108,7 +108,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s ...@@ -108,7 +108,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s
} }
snd_iprintf(buffer, "\n"); snd_iprintf(buffer, "\n");
} }
if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL) if (subs->speed != USB_SPEED_FULL)
snd_iprintf(buffer, " Data packet interval: %d us\n", snd_iprintf(buffer, " Data packet interval: %d us\n",
125 * (1 << fp->datainterval)); 125 * (1 << fp->datainterval));
// snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize);
...@@ -124,7 +124,7 @@ static void proc_dump_ep_status(struct snd_usb_substream *subs, ...@@ -124,7 +124,7 @@ static void proc_dump_ep_status(struct snd_usb_substream *subs,
return; return;
snd_iprintf(buffer, " Packet Size = %d\n", ep->curpacksize); snd_iprintf(buffer, " Packet Size = %d\n", ep->curpacksize);
snd_iprintf(buffer, " Momentary freq = %u Hz (%#x.%04x)\n", snd_iprintf(buffer, " Momentary freq = %u Hz (%#x.%04x)\n",
snd_usb_get_speed(subs->dev) == USB_SPEED_FULL subs->speed == USB_SPEED_FULL
? get_full_speed_hz(ep->freqm) ? get_full_speed_hz(ep->freqm)
: get_high_speed_hz(ep->freqm), : get_high_speed_hz(ep->freqm),
ep->freqm >> 16, ep->freqm & 0xffff); ep->freqm >> 16, ep->freqm & 0xffff);
......
...@@ -90,6 +90,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as, ...@@ -90,6 +90,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as,
subs->direction = stream; subs->direction = stream;
subs->dev = as->chip->dev; subs->dev = as->chip->dev;
subs->txfr_quirk = as->chip->txfr_quirk; subs->txfr_quirk = as->chip->txfr_quirk;
subs->speed = snd_usb_get_speed(subs->dev);
snd_usb_set_pcm_ops(as->pcm, stream); snd_usb_set_pcm_ops(as->pcm, stream);
......
...@@ -37,7 +37,7 @@ struct snd_usb_audio { ...@@ -37,7 +37,7 @@ struct snd_usb_audio {
struct usb_interface *pm_intf; struct usb_interface *pm_intf;
u32 usb_id; u32 usb_id;
struct mutex mutex; struct mutex mutex;
struct mutex shutdown_mutex; struct rw_semaphore shutdown_rwsem;
unsigned int shutdown:1; unsigned int shutdown:1;
unsigned int probing:1; unsigned int probing:1;
unsigned int autosuspended:1; unsigned int autosuspended:1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment