summaryrefslogtreecommitdiff
path: root/sound/usb
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/bcd2000/bcd2000.c4
-rw-r--r--sound/usb/endpoint.c40
-rw-r--r--sound/usb/endpoint.h1
-rw-r--r--sound/usb/media.c4
-rw-r--r--sound/usb/midi2.c15
-rw-r--r--sound/usb/stream.c11
6 files changed, 49 insertions, 26 deletions
diff --git a/sound/usb/bcd2000/bcd2000.c b/sound/usb/bcd2000/bcd2000.c
index 7aec0a95c609..392b4d8e9e76 100644
--- a/sound/usb/bcd2000/bcd2000.c
+++ b/sound/usb/bcd2000/bcd2000.c
@@ -395,8 +395,8 @@ static int bcd2000_probe(struct usb_interface *interface,
snd_card_set_dev(card, &interface->dev);
- strncpy(card->driver, "snd-bcd2000", sizeof(card->driver));
- strncpy(card->shortname, "BCD2000", sizeof(card->shortname));
+ strscpy(card->driver, "snd-bcd2000", sizeof(card->driver));
+ strscpy(card->shortname, "BCD2000", sizeof(card->shortname));
usb_make_path(bcd2k->dev, usb_path, sizeof(usb_path));
snprintf(bcd2k->card->longname, sizeof(bcd2k->card->longname),
"Behringer BCD2000 at %s",
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index a385e85c4650..8f65349a06d3 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -505,13 +505,18 @@ int snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,
return -EPIPE;
}
- err = usb_submit_urb(ctx->urb, GFP_ATOMIC);
+ if (!atomic_read(&ep->chip->shutdown))
+ err = usb_submit_urb(ctx->urb, GFP_ATOMIC);
+ else
+ err = -ENODEV;
if (err < 0) {
- usb_audio_err(ep->chip,
- "Unable to submit urb #%d: %d at %s\n",
- ctx->index, err, __func__);
- if (!in_stream_lock)
- notify_xrun(ep);
+ if (!atomic_read(&ep->chip->shutdown)) {
+ usb_audio_err(ep->chip,
+ "Unable to submit urb #%d: %d at %s\n",
+ ctx->index, err, __func__);
+ if (!in_stream_lock)
+ notify_xrun(ep);
+ }
return -EPIPE;
}
@@ -575,12 +580,17 @@ static void snd_complete_urb(struct urb *urb)
prepare_inbound_urb(ep, ctx);
}
- err = usb_submit_urb(urb, GFP_ATOMIC);
+ if (!atomic_read(&ep->chip->shutdown))
+ err = usb_submit_urb(urb, GFP_ATOMIC);
+ else
+ err = -ENODEV;
if (err == 0)
return;
- usb_audio_err(ep->chip, "cannot submit urb (err = %d)\n", err);
- notify_xrun(ep);
+ if (!atomic_read(&ep->chip->shutdown)) {
+ usb_audio_err(ep->chip, "cannot submit urb (err = %d)\n", err);
+ notify_xrun(ep);
+ }
exit_clear:
clear_bit(ctx->index, &ep->active_mask);
@@ -1603,11 +1613,15 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
goto __error;
}
- err = usb_submit_urb(urb, GFP_ATOMIC);
+ if (!atomic_read(&ep->chip->shutdown))
+ err = usb_submit_urb(urb, GFP_ATOMIC);
+ else
+ err = -ENODEV;
if (err < 0) {
- usb_audio_err(ep->chip,
- "cannot submit urb %d, error %d: %s\n",
- i, err, usb_error_string(err));
+ if (!atomic_read(&ep->chip->shutdown))
+ usb_audio_err(ep->chip,
+ "cannot submit urb %d, error %d: %s\n",
+ i, err, usb_error_string(err));
goto __error;
}
set_bit(i, &ep->active_mask);
diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h
index c09f68ce08b1..ba70f52f6860 100644
--- a/sound/usb/endpoint.h
+++ b/sound/usb/endpoint.h
@@ -44,7 +44,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep);
void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool keep_pending);
void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
void snd_usb_endpoint_suspend(struct snd_usb_endpoint *ep);
-int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
void snd_usb_endpoint_release(struct snd_usb_endpoint *ep);
void snd_usb_endpoint_free_all(struct snd_usb_audio *chip);
diff --git a/sound/usb/media.c b/sound/usb/media.c
index 840f42cb9272..d48db6f3ae65 100644
--- a/sound/usb/media.c
+++ b/sound/usb/media.c
@@ -35,7 +35,7 @@ int snd_media_stream_init(struct snd_usb_substream *subs, struct snd_pcm *pcm,
{
struct media_device *mdev;
struct media_ctl *mctl;
- struct device *pcm_dev = &pcm->streams[stream].dev;
+ struct device *pcm_dev = pcm->streams[stream].dev;
u32 intf_type;
int ret = 0;
u16 mixer_pad;
@@ -163,7 +163,7 @@ void snd_media_stop_pipeline(struct snd_usb_substream *subs)
static int snd_media_mixer_init(struct snd_usb_audio *chip)
{
- struct device *ctl_dev = &chip->card->ctl_dev;
+ struct device *ctl_dev = chip->card->ctl_dev;
struct media_intf_devnode *ctl_intf;
struct usb_mixer_interface *mixer;
struct media_device *mdev = chip->media_dev;
diff --git a/sound/usb/midi2.c b/sound/usb/midi2.c
index ee2835741479..a27e244650c8 100644
--- a/sound/usb/midi2.c
+++ b/sound/usb/midi2.c
@@ -990,7 +990,7 @@ static int parse_midi_2_0(struct snd_usb_midi2_interface *umidi)
}
}
- return attach_legacy_rawmidi(umidi);
+ return 0;
}
/* is the given interface for MIDI 2.0? */
@@ -1059,12 +1059,6 @@ static void set_fallback_rawmidi_names(struct snd_usb_midi2_interface *umidi)
usb_string(dev, dev->descriptor.iSerialNumber,
ump->info.product_id,
sizeof(ump->info.product_id));
-#if IS_ENABLED(CONFIG_SND_UMP_LEGACY_RAWMIDI)
- if (ump->legacy_rmidi && !*ump->legacy_rmidi->name)
- snprintf(ump->legacy_rmidi->name,
- sizeof(ump->legacy_rmidi->name),
- "%s (MIDI 1.0)", ump->info.name);
-#endif
}
}
@@ -1157,6 +1151,13 @@ int snd_usb_midi_v2_create(struct snd_usb_audio *chip,
}
set_fallback_rawmidi_names(umidi);
+
+ err = attach_legacy_rawmidi(umidi);
+ if (err < 0) {
+ usb_audio_err(chip, "Failed to create legacy rawmidi\n");
+ goto error;
+ }
+
return 0;
error:
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index f10f4e6d3fb8..3d4add94e367 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -1093,6 +1093,7 @@ static int __snd_usb_parse_audio_interface(struct snd_usb_audio *chip,
int i, altno, err, stream;
struct audioformat *fp = NULL;
struct snd_usb_power_domain *pd = NULL;
+ bool set_iface_first;
int num, protocol;
dev = chip->dev;
@@ -1223,11 +1224,19 @@ static int __snd_usb_parse_audio_interface(struct snd_usb_audio *chip,
return err;
}
+ set_iface_first = false;
+ if (protocol == UAC_VERSION_1 ||
+ (chip->quirk_flags & QUIRK_FLAG_SET_IFACE_FIRST))
+ set_iface_first = true;
+
/* try to set the interface... */
usb_set_interface(chip->dev, iface_no, 0);
+ if (set_iface_first)
+ usb_set_interface(chip->dev, iface_no, altno);
snd_usb_init_pitch(chip, fp);
snd_usb_init_sample_rate(chip, fp, fp->rate_max);
- usb_set_interface(chip->dev, iface_no, altno);
+ if (!set_iface_first)
+ usb_set_interface(chip->dev, iface_no, altno);
}
return 0;
}