[alsa-devel] [PATCH v4 15/15] ALSA: usb-audio: improve logging messages

Takashi Iwai tiwai at suse.de
Mon Oct 7 11:23:41 CEST 2013


At Sun,  6 Oct 2013 22:31:20 +0200,
Eldad Zack wrote:
> 
> Add -EBUSY to the list of returned USB error strings.
> Change some debugging messages to KERN_DEBUG.

snd_printdd() implies KERN_DEBUG as default, so it's superfluous.


Takashi

> Add the calling function for usb_submit_urb related errors.
> 
> Signed-off-by: Eldad Zack <eldad at fogrefinery.com>
> ---
>  sound/usb/endpoint.c | 12 +++++++-----
>  sound/usb/pcm.c      |  4 ++--
>  2 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
> index 81056b6..ac4dedf 100644
> --- a/sound/usb/endpoint.c
> +++ b/sound/usb/endpoint.c
> @@ -114,6 +114,8 @@ static const char *usb_error_string(int err)
>  	case -EFBIG:
>  	case -EMSGSIZE:
>  		return "internal error";
> +	case -EBUSY:
> +		return "device busy";
>  	default:
>  		return "unknown error";
>  	}
> @@ -333,8 +335,8 @@ static void queue_pending_output_urbs(struct snd_usb_endpoint *ep)
>  
>  		err = usb_submit_urb(ctx->urb, GFP_ATOMIC);
>  		if (err < 0)
> -			snd_printk(KERN_ERR "Unable to submit urb #%d: %d (urb %p)\n",
> -				   ctx->index, err, ctx->urb);
> +			snd_printk(KERN_ERR "%s: cannot submit urb #%d: %d (urb %p)\n",
> +				   __func__, ctx->index, err, ctx->urb);
>  		else
>  			set_bit(ctx->index, &ep->active_mask);
>  	}
> @@ -387,7 +389,7 @@ static void snd_complete_urb(struct urb *urb)
>  	if (err == 0)
>  		return;
>  
> -	snd_printk(KERN_ERR "cannot submit urb (err = %d)\n", err);
> +	snd_printk(KERN_ERR "%s: cannot submit urb (err = %d)\n", __func__, err);
>  	//snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
>  
>  exit_clear:
> @@ -948,8 +950,8 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
>  
>  		err = usb_submit_urb(urb, GFP_ATOMIC);
>  		if (err < 0) {
> -			snd_printk(KERN_ERR "cannot submit urb %d, error %d: %s\n",
> -				   i, err, usb_error_string(err));
> +			snd_printk(KERN_ERR "%s: cannot submit urb %d, error %d: %s\n",
> +				   __func__, i, err, usb_error_string(err));
>  			goto __error;
>  		}
>  		set_bit(i, &ep->active_mask);
> diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
> index f3d48d4..8897da7 100644
> --- a/sound/usb/pcm.c
> +++ b/sound/usb/pcm.c
> @@ -606,7 +606,7 @@ static int match_endpoint_audioformats(struct audioformat *fp,
>  	if (fp->channels == match->channels)
>  		score++;
>  
> -	snd_printdd("%s: (fmt @%p) score %d\n", __func__, fp, score);
> +	snd_printdd(KERN_DEBUG "%s: (fmt @%p) score %d\n", __func__, fp, score);
>  
>  	return score;
>  }
> @@ -660,7 +660,7 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs)
>  	if (sync_fp->channels != subs->channels) {
>  		sync_period_bytes = (subs->period_bytes / subs->channels) *
>  			sync_fp->channels;
> -		snd_printdd("%s: adjusted sync ep period bytes (%d -> %d)\n",
> +		snd_printdd(KERN_DEBUG "%s: adjusted sync ep period bytes (%d -> %d)\n",
>  			__func__, subs->period_bytes, sync_period_bytes);
>  	}
>  
> -- 
> 1.8.1.5
> 


More information about the Alsa-devel mailing list