int if_idx;
int idx;
- mutex_lock(&qdev_mutex);
+ guard(mutex)(&qdev_mutex);
/* find all active intf for set alt 0 and cleanup usb audio dev */
for (idx = 0; idx < SNDRV_CARDS; idx++) {
if (!atomic_read(&uadev[idx].in_use))
disable_audio_stream(subs);
}
atomic_set(&uadev[idx].in_use, 0);
- mutex_lock(&chip->mutex);
+ guard(mutex)(&chip->mutex);
uaudio_dev_cleanup(&uadev[idx]);
- mutex_unlock(&chip->mutex);
}
- mutex_unlock(&qdev_mutex);
}
/**
chip = usb_get_intfdata(intf);
- mutex_lock(&qdev_mutex);
- mutex_lock(&chip->mutex);
+ guard(mutex)(&qdev_mutex);
+ guard(mutex)(&chip->mutex);
dev = &uadev[chip->card->number];
}
}
- mutex_unlock(&chip->mutex);
- mutex_unlock(&qdev_mutex);
-
return 0;
}
goto response;
}
- mutex_lock(&chip->mutex);
- if (req_msg->enable) {
- if (info_idx < 0 || chip->system_suspend || subs->opened) {
- ret = -EBUSY;
- mutex_unlock(&chip->mutex);
-
- goto response;
+ scoped_guard(mutex, &chip->mutex) {
+ if (req_msg->enable) {
+ if (info_idx < 0 || chip->system_suspend || subs->opened) {
+ ret = -EBUSY;
+ goto response;
+ }
+ subs->opened = 1;
}
- subs->opened = 1;
}
- mutex_unlock(&chip->mutex);
if (req_msg->service_interval_valid) {
ret = get_data_interval_from_si(subs,
ret = prepare_qmi_response(subs, req_msg, &resp,
info_idx);
if (ret < 0) {
- mutex_lock(&chip->mutex);
+ guard(mutex)(&chip->mutex);
subs->opened = 0;
- mutex_unlock(&chip->mutex);
}
} else {
info = &uadev[pcm_card_num].info[info_idx];
}
disable_audio_stream(subs);
- mutex_lock(&chip->mutex);
+ guard(mutex)(&chip->mutex);
subs->opened = 0;
- mutex_unlock(&chip->mutex);
}
response:
if (!req_msg->enable && ret != -EINVAL && ret != -ENODEV) {
- mutex_lock(&chip->mutex);
+ guard(mutex)(&chip->mutex);
if (info_idx >= 0) {
info = &uadev[pcm_card_num].info[info_idx];
uaudio_dev_intf_cleanup(uadev[pcm_card_num].udev,
if (atomic_read(&uadev[pcm_card_num].in_use))
kref_put(&uadev[pcm_card_num].kref,
uaudio_dev_release);
- mutex_unlock(&chip->mutex);
}
mutex_unlock(&qdev_mutex);
!usb_qmi_get_pcm_num(chip, 0))
return;
- mutex_lock(&qdev_mutex);
- mutex_lock(&chip->mutex);
+ guard(mutex)(&qdev_mutex);
+ guard(mutex)(&chip->mutex);
if (!uadev[chip->card->number].chip) {
sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
if (!sdev)
- goto exit;
+ return;
sb = xhci_sideband_register(intf, XHCI_SIDEBAND_VENDOR,
uaudio_sideband_notifier);
snd_soc_usb_connect(uaudio_qdev->auxdev->dev.parent, sdev);
}
- mutex_unlock(&chip->mutex);
- mutex_unlock(&qdev_mutex);
-
return;
unreg_xhci:
kfree(sdev);
uadev[chip->card->number].sdev = NULL;
uadev[chip->card->number].chip = NULL;
-exit:
- mutex_unlock(&chip->mutex);
- mutex_unlock(&qdev_mutex);
}
/**
if (card_num >= SNDRV_CARDS)
return;
- mutex_lock(&qdev_mutex);
- mutex_lock(&chip->mutex);
+ guard(mutex)(&qdev_mutex);
+ guard(mutex)(&chip->mutex);
dev = &uadev[card_num];
/* Device has already been cleaned up, or never populated */
- if (!dev->chip) {
- mutex_unlock(&chip->mutex);
- mutex_unlock(&qdev_mutex);
+ if (!dev->chip)
return;
- }
/* cleaned up already */
if (!dev->udev)
kfree(dev->sdev);
dev->sdev = NULL;
}
- mutex_unlock(&chip->mutex);
-
- mutex_unlock(&qdev_mutex);
}
/**
if (card_num >= SNDRV_CARDS)
return;
- mutex_lock(&qdev_mutex);
- mutex_lock(&chip->mutex);
+ guard(mutex)(&qdev_mutex);
+ guard(mutex)(&chip->mutex);
uaudio_send_disconnect_ind(chip);
-
- mutex_unlock(&chip->mutex);
- mutex_unlock(&qdev_mutex);
}
static struct snd_usb_platform_ops offload_ops = {