diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-02-26 13:02:17 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-02-26 16:45:34 +0100 |
commit | 0ba41d917eeb87f608cf147f870ff2f4c1056bab (patch) | |
tree | e848ad3bb355ec92150b7f22eab66e88d7eee34b /sound/usb/format.c | |
parent | ALSA: ymfpci: Use standard printk helpers (diff) | |
download | linux-0ba41d917eeb87f608cf147f870ff2f4c1056bab.tar.xz linux-0ba41d917eeb87f608cf147f870ff2f4c1056bab.zip |
ALSA: usb-audio: Use standard printk helpers
Convert with dev_err() and co from snd_printk(), etc.
As there are too deep indirections (e.g. ep->chip->dev->dev),
a few new local macros, usb_audio_err() & co, are introduced.
Also, the device numbers in some messages are dropped, as they are
shown in the prefix automatically.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/format.c')
-rw-r--r-- | sound/usb/format.c | 68 |
1 files changed, 39 insertions, 29 deletions
diff --git a/sound/usb/format.c b/sound/usb/format.c index d244fd3703d8..8bcc87cf5667 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -74,8 +74,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, if ((pcm_formats == 0) && (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) { /* some devices don't define this correctly... */ - snd_printdd(KERN_INFO "%d:%u:%d : format type 0 is detected, processed as PCM\n", - chip->dev->devnum, fp->iface, fp->altsetting); + usb_audio_info(chip, "%u:%d : format type 0 is detected, processed as PCM\n", + fp->iface, fp->altsetting); format = 1 << UAC_FORMAT_TYPE_I_PCM; } if (format & (1 << UAC_FORMAT_TYPE_I_PCM)) { @@ -83,9 +83,9 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, sample_width == 24 && sample_bytes == 2) sample_bytes = 3; else if (sample_width > sample_bytes * 8) { - snd_printk(KERN_INFO "%d:%u:%d : sample bitwidth %d in over sample bytes %d\n", - chip->dev->devnum, fp->iface, fp->altsetting, - sample_width, sample_bytes); + usb_audio_info(chip, "%u:%d : sample bitwidth %d in over sample bytes %d\n", + fp->iface, fp->altsetting, + sample_width, sample_bytes); } /* check the format byte size */ switch (sample_bytes) { @@ -108,9 +108,10 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, pcm_formats |= SNDRV_PCM_FMTBIT_S32_LE; break; default: - snd_printk(KERN_INFO "%d:%u:%d : unsupported sample bitwidth %d in %d bytes\n", - chip->dev->devnum, fp->iface, fp->altsetting, - sample_width, sample_bytes); + usb_audio_info(chip, + "%u:%d : unsupported sample bitwidth %d in %d bytes\n", + fp->iface, fp->altsetting, + sample_width, sample_bytes); break; } } @@ -132,8 +133,9 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, pcm_formats |= SNDRV_PCM_FMTBIT_MU_LAW; } if (format & ~0x3f) { - snd_printk(KERN_INFO "%d:%u:%d : unsupported format bits %#x\n", - chip->dev->devnum, fp->iface, fp->altsetting, format); + usb_audio_info(chip, + "%u:%d : unsupported format bits %#x\n", + fp->iface, fp->altsetting, format); } pcm_formats |= snd_usb_interface_dsd_format_quirks(chip, fp, sample_bytes); @@ -158,8 +160,9 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof int nr_rates = fmt[offset]; if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) { - snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", - chip->dev->devnum, fp->iface, fp->altsetting); + usb_audio_err(chip, + "%u:%d : invalid UAC_FORMAT_TYPE desc\n", + fp->iface, fp->altsetting); return -EINVAL; } @@ -171,7 +174,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); if (fp->rate_table == NULL) { - snd_printk(KERN_ERR "cannot malloc\n"); + usb_audio_err(chip, "cannot malloc\n"); return -ENOMEM; } @@ -222,7 +225,8 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof * get to know how many sample rates we have to expect. * Then fp->rate_table can be allocated and filled. */ -static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets, +static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip, + struct audioformat *fp, int nr_triplets, const unsigned char *data) { int i, nr_rates = 0; @@ -261,7 +265,7 @@ static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets, nr_rates++; if (nr_rates >= MAX_NR_RATES) { - snd_printk(KERN_ERR "invalid uac2 rates\n"); + usb_audio_err(chip, "invalid uac2 rates\n"); break; } @@ -287,7 +291,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, int clock = snd_usb_clock_find_source(chip, fp->clock, false); if (clock < 0) { - snd_printk(KERN_ERR "%s(): unable to find clock source (clock %d)\n", + dev_err(&dev->dev, + "%s(): unable to find clock source (clock %d)\n", __func__, clock); goto err; } @@ -300,7 +305,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, tmp, sizeof(tmp)); if (ret < 0) { - snd_printk(KERN_ERR "%s(): unable to retrieve number of sample rates (clock %d)\n", + dev_err(&dev->dev, + "%s(): unable to retrieve number of sample rates (clock %d)\n", __func__, clock); goto err; } @@ -321,7 +327,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, data, data_size); if (ret < 0) { - snd_printk(KERN_ERR "%s(): unable to retrieve sample rate range (clock %d)\n", + dev_err(&dev->dev, + "%s(): unable to retrieve sample rate range (clock %d)\n", __func__, clock); ret = -EINVAL; goto err_free; @@ -332,7 +339,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, * will have to deal with. */ kfree(fp->rate_table); fp->rate_table = NULL; - fp->nr_rates = parse_uac2_sample_rate_range(fp, nr_triplets, data); + fp->nr_rates = parse_uac2_sample_rate_range(chip, fp, nr_triplets, data); if (fp->nr_rates == 0) { /* SNDRV_PCM_RATE_CONTINUOUS */ @@ -348,7 +355,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, /* Call the triplet parser again, but this time, fp->rate_table is * allocated, so the rates will be stored */ - parse_uac2_sample_rate_range(fp, nr_triplets, data); + parse_uac2_sample_rate_range(chip, fp, nr_triplets, data); err_free: kfree(data); @@ -408,8 +415,9 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, } if (fp->channels < 1) { - snd_printk(KERN_ERR "%d:%u:%d : invalid channels %d\n", - chip->dev->devnum, fp->iface, fp->altsetting, fp->channels); + usb_audio_err(chip, + "%u:%d : invalid channels %d\n", + fp->iface, fp->altsetting, fp->channels); return -EINVAL; } @@ -435,8 +443,9 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, fp->formats = SNDRV_PCM_FMTBIT_MPEG; break; default: - snd_printd(KERN_INFO "%d:%u:%d : unknown format tag %#x is detected. processed as MPEG.\n", - chip->dev->devnum, fp->iface, fp->altsetting, format); + usb_audio_info(chip, + "%u:%d : unknown format tag %#x is detected. processed as MPEG.\n", + fp->iface, fp->altsetting, format); fp->formats = SNDRV_PCM_FMTBIT_MPEG; break; } @@ -449,7 +458,7 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; brate = le16_to_cpu(fmt->wMaxBitRate); framesize = le16_to_cpu(fmt->wSamplesPerFrame); - snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); + usb_audio_info(chip, "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); fp->frame_size = framesize; ret = parse_audio_format_rates_v1(chip, fp, _fmt, 8); /* fmt[8..] sample rates */ break; @@ -458,7 +467,7 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, struct uac_format_type_ii_ext_descriptor *fmt = _fmt; brate = le16_to_cpu(fmt->wMaxBitRate); framesize = le16_to_cpu(fmt->wSamplesPerFrame); - snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); + usb_audio_info(chip, "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); fp->frame_size = framesize; ret = parse_audio_format_rates_v2(chip, fp); break; @@ -484,9 +493,10 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip, err = parse_audio_format_ii(chip, fp, format, fmt); break; default: - snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n", - chip->dev->devnum, fp->iface, fp->altsetting, - fmt->bFormatType); + usb_audio_info(chip, + "%u:%d : format type %d is not supported yet\n", + fp->iface, fp->altsetting, + fmt->bFormatType); return -ENOTSUPP; } fp->fmt_type = fmt->bFormatType; |