return -ENOMEM;
}
- init_rwsem(&chip->shutdown_rwsem);
+ mutex_init(&chip->shutdown_mutex);
chip->index = idx;
chip->dev = dev;
chip->card = card;
return chip;
__error:
- if (chip) {
- if (!chip->num_interfaces)
- snd_card_free(chip->card);
- chip->probing = 0;
- }
+ if (chip && !chip->num_interfaces)
+ snd_card_free(chip->card);
mutex_unlock(®ister_mutex);
__err_val:
return NULL;
chip = ptr;
card = chip->card;
- down_write(&chip->shutdown_rwsem);
- chip->shutdown = 1;
- up_write(&chip->shutdown_rwsem);
-
mutex_lock(®ister_mutex);
+ mutex_lock(&chip->shutdown_mutex);
+ chip->shutdown = 1;
chip->num_interfaces--;
if (chip->num_interfaces <= 0) {
snd_card_disconnect(card);
snd_usb_mixer_disconnect(p);
}
usb_chip[chip->index] = NULL;
+ mutex_unlock(&chip->shutdown_mutex);
mutex_unlock(®ister_mutex);
snd_card_free_when_closed(card);
} else {
+ mutex_unlock(&chip->shutdown_mutex);
mutex_unlock(®ister_mutex);
}
}
{
int err = -ENODEV;
- down_read(&chip->shutdown_rwsem);
if (!chip->shutdown && !chip->probing)
err = usb_autopm_get_interface(chip->pm_intf);
- up_read(&chip->shutdown_rwsem);
return err;
}
void snd_usb_autosuspend(struct snd_usb_audio *chip)
{
- down_read(&chip->shutdown_rwsem);
if (!chip->shutdown && !chip->probing)
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)