struct snd_card *card = NULL;
/* look if we already serve this card and return if so */
- scoped_guard(mutex, ®ister_mutex) {
- for (i = 0; i < SNDRV_CARDS; i++) {
- if (devices[i] == device) {
- if (chips[i])
- chips[i]->intf_count++;
- usb_set_intfdata(intf, chips[i]);
- return 0;
- } else if (!devices[i] && regidx < 0)
- regidx = i;
- }
- if (regidx < 0) {
- dev_err(&intf->dev, "too many cards registered.\n");
- return -ENODEV;
- }
- devices[regidx] = device;
+ guard(mutex)(®ister_mutex);
+ for (i = 0; i < SNDRV_CARDS; i++) {
+ if (devices[i] == device) {
+ if (chips[i])
+ chips[i]->intf_count++;
+ usb_set_intfdata(intf, chips[i]);
+ return 0;
+ } else if (!devices[i] && regidx < 0)
+ regidx = i;
+ }
+ if (regidx < 0) {
+ dev_err(&intf->dev, "too many cards registered.\n");
+ return -ENODEV;
}
+ devices[regidx] = device;
/* check, if firmware is present on device, upload it if not */
ret = usb6fire_fw_init(intf);
struct sfire_chip *chip;
struct snd_card *card;
+ guard(mutex)(®ister_mutex);
chip = usb_get_intfdata(intf);
if (chip) { /* if !chip, fw upload has been performed */
chip->intf_count--;
if (!chip->intf_count) {
- scoped_guard(mutex, ®ister_mutex) {
- devices[chip->regidx] = NULL;
- chips[chip->regidx] = NULL;
- }
+ devices[chip->regidx] = NULL;
+ chips[chip->regidx] = NULL;
/*
* Save card pointer before teardown.