Commit e93e890e authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usb-audio: Improve some debug prints

There are a few rooms for improvements wrt the debug prints:
- The EP debug print is shown only at starting, not at stopping
- The EP debug print contains useless object addresses
- Some helpers show the urb and the EP object addresses, too

This patch addresses those shortcomings.
Tested-by: default avatarKeith Milner <kamilner@superlative.org>
Tested-by: default avatarDylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-8-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 1803503f
...@@ -367,8 +367,8 @@ static void queue_pending_output_urbs(struct snd_usb_endpoint *ep) ...@@ -367,8 +367,8 @@ static void queue_pending_output_urbs(struct snd_usb_endpoint *ep)
err = usb_submit_urb(ctx->urb, GFP_ATOMIC); err = usb_submit_urb(ctx->urb, GFP_ATOMIC);
if (err < 0) if (err < 0)
usb_audio_err(ep->chip, usb_audio_err(ep->chip,
"Unable to submit urb #%d: %d (urb %p)\n", "Unable to submit urb #%d: %d at %s\n",
ctx->index, err, ctx->urb); ctx->index, err, __func__);
else else
set_bit(ctx->index, &ep->active_mask); set_bit(ctx->index, &ep->active_mask);
} }
...@@ -494,8 +494,8 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip, ...@@ -494,8 +494,8 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
alts->desc.bInterfaceNumber, alts->desc.bInterfaceNumber,
alts->desc.bAlternateSetting); alts->desc.bAlternateSetting);
if (ep) { if (ep) {
usb_audio_dbg(ep->chip, "Re-using EP %x in iface %d,%d @%p\n", usb_audio_dbg(ep->chip, "Re-using EP %x in iface %d,%d\n",
ep_num, ep->iface, ep->altsetting, ep); ep_num, ep->iface, ep->altsetting);
goto __exit_unlock; goto __exit_unlock;
} }
......
...@@ -218,7 +218,7 @@ static int start_endpoints(struct snd_usb_substream *subs) ...@@ -218,7 +218,7 @@ static int start_endpoints(struct snd_usb_substream *subs)
if (!test_and_set_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) { if (!test_and_set_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) {
struct snd_usb_endpoint *ep = subs->data_endpoint; struct snd_usb_endpoint *ep = subs->data_endpoint;
dev_dbg(&subs->dev->dev, "Starting data EP @%p\n", ep); dev_dbg(&subs->dev->dev, "Starting data EP 0x%x\n", ep->ep_num);
ep->data_subs = subs; ep->data_subs = subs;
err = snd_usb_endpoint_start(ep); err = snd_usb_endpoint_start(ep);
...@@ -232,7 +232,7 @@ static int start_endpoints(struct snd_usb_substream *subs) ...@@ -232,7 +232,7 @@ static int start_endpoints(struct snd_usb_substream *subs)
!test_and_set_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) { !test_and_set_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) {
struct snd_usb_endpoint *ep = subs->sync_endpoint; struct snd_usb_endpoint *ep = subs->sync_endpoint;
dev_dbg(&subs->dev->dev, "Starting sync EP @%p\n", ep); dev_dbg(&subs->dev->dev, "Starting sync EP 0x%x\n", ep->ep_num);
ep->sync_slave = subs->data_endpoint; ep->sync_slave = subs->data_endpoint;
err = snd_usb_endpoint_start(ep); err = snd_usb_endpoint_start(ep);
...@@ -255,12 +255,17 @@ static void sync_pending_stops(struct snd_usb_substream *subs) ...@@ -255,12 +255,17 @@ static void sync_pending_stops(struct snd_usb_substream *subs)
static void stop_endpoints(struct snd_usb_substream *subs) static void stop_endpoints(struct snd_usb_substream *subs)
{ {
if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) { if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) {
dev_dbg(&subs->dev->dev, "Stopping sync EP 0x%x\n",
subs->sync_endpoint->ep_num);
snd_usb_endpoint_stop(subs->sync_endpoint); snd_usb_endpoint_stop(subs->sync_endpoint);
subs->sync_endpoint->sync_slave = NULL; subs->sync_endpoint->sync_slave = NULL;
} }
if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) {
dev_dbg(&subs->dev->dev, "Stopping data EP 0x%x\n",
subs->data_endpoint->ep_num);
snd_usb_endpoint_stop(subs->data_endpoint); snd_usb_endpoint_stop(subs->data_endpoint);
}
} }
/* PCM sync_stop callback */ /* PCM sync_stop callback */
......
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