Commit 0ba41d91 authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarTakashi Iwai <tiwai@suse.de>
parent 6436bcf6
...@@ -139,8 +139,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int ...@@ -139,8 +139,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
struct usb_interface *iface = usb_ifnum_to_if(dev, interface); struct usb_interface *iface = usb_ifnum_to_if(dev, interface);
if (!iface) { if (!iface) {
snd_printk(KERN_ERR "%d:%u:%d : does not exist\n", dev_err(&dev->dev, "%u:%d : does not exist\n",
dev->devnum, ctrlif, interface); ctrlif, interface);
return -EINVAL; return -EINVAL;
} }
...@@ -165,8 +165,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int ...@@ -165,8 +165,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
} }
if (usb_interface_claimed(iface)) { if (usb_interface_claimed(iface)) {
snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n", dev_dbg(&dev->dev, "%d:%d: skipping, already claimed\n",
dev->devnum, ctrlif, interface); ctrlif, interface);
return -EINVAL; return -EINVAL;
} }
...@@ -176,8 +176,9 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int ...@@ -176,8 +176,9 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
int err = snd_usbmidi_create(chip->card, iface, int err = snd_usbmidi_create(chip->card, iface,
&chip->midi_list, NULL); &chip->midi_list, NULL);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "%d:%u:%d: cannot create sequencer device\n", dev_err(&dev->dev,
dev->devnum, ctrlif, interface); "%u:%d: cannot create sequencer device\n",
ctrlif, interface);
return -EINVAL; return -EINVAL;
} }
usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L); usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
...@@ -188,14 +189,15 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int ...@@ -188,14 +189,15 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && if ((altsd->bInterfaceClass != USB_CLASS_AUDIO &&
altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) ||
altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING) { altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING) {
snd_printdd(KERN_ERR "%d:%u:%d: skipping non-supported interface %d\n", dev_dbg(&dev->dev,
dev->devnum, ctrlif, interface, altsd->bInterfaceClass); "%u:%d: skipping non-supported interface %d\n",
ctrlif, interface, altsd->bInterfaceClass);
/* skip non-supported classes */ /* skip non-supported classes */
return -EINVAL; return -EINVAL;
} }
if (snd_usb_get_speed(dev) == USB_SPEED_LOW) { if (snd_usb_get_speed(dev) == USB_SPEED_LOW) {
snd_printk(KERN_ERR "low speed audio streaming not supported\n"); dev_err(&dev->dev, "low speed audio streaming not supported\n");
return -EINVAL; return -EINVAL;
} }
...@@ -228,26 +230,27 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) ...@@ -228,26 +230,27 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
protocol = altsd->bInterfaceProtocol; protocol = altsd->bInterfaceProtocol;
if (!control_header) { if (!control_header) {
snd_printk(KERN_ERR "cannot find UAC_HEADER\n"); dev_err(&dev->dev, "cannot find UAC_HEADER\n");
return -EINVAL; return -EINVAL;
} }
switch (protocol) { switch (protocol) {
default: default:
snd_printdd(KERN_WARNING "unknown interface protocol %#02x, assuming v1\n", dev_warn(&dev->dev,
protocol); "unknown interface protocol %#02x, assuming v1\n",
protocol);
/* fall through */ /* fall through */
case UAC_VERSION_1: { case UAC_VERSION_1: {
struct uac1_ac_header_descriptor *h1 = control_header; struct uac1_ac_header_descriptor *h1 = control_header;
if (!h1->bInCollection) { if (!h1->bInCollection) {
snd_printk(KERN_INFO "skipping empty audio interface (v1)\n"); dev_info(&dev->dev, "skipping empty audio interface (v1)\n");
return -EINVAL; return -EINVAL;
} }
if (h1->bLength < sizeof(*h1) + h1->bInCollection) { if (h1->bLength < sizeof(*h1) + h1->bInCollection) {
snd_printk(KERN_ERR "invalid UAC_HEADER (v1)\n"); dev_err(&dev->dev, "invalid UAC_HEADER (v1)\n");
return -EINVAL; return -EINVAL;
} }
...@@ -277,7 +280,7 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) ...@@ -277,7 +280,7 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
} }
if (!assoc) { if (!assoc) {
snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n"); dev_err(&dev->dev, "Audio class v2 interfaces need an interface association\n");
return -EINVAL; return -EINVAL;
} }
...@@ -351,14 +354,14 @@ static int snd_usb_audio_create(struct usb_interface *intf, ...@@ -351,14 +354,14 @@ static int snd_usb_audio_create(struct usb_interface *intf,
case USB_SPEED_SUPER: case USB_SPEED_SUPER:
break; break;
default: default:
snd_printk(KERN_ERR "unknown device speed %d\n", snd_usb_get_speed(dev)); dev_err(&dev->dev, "unknown device speed %d\n", snd_usb_get_speed(dev));
return -ENXIO; return -ENXIO;
} }
err = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE, err = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE,
0, &card); 0, &card);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "cannot create card instance %d\n", idx); dev_err(&dev->dev, "cannot create card instance %d\n", idx);
return err; return err;
} }
...@@ -499,7 +502,7 @@ snd_usb_audio_probe(struct usb_device *dev, ...@@ -499,7 +502,7 @@ snd_usb_audio_probe(struct usb_device *dev,
for (i = 0; i < SNDRV_CARDS; i++) { for (i = 0; i < SNDRV_CARDS; i++) {
if (usb_chip[i] && usb_chip[i]->dev == dev) { if (usb_chip[i] && usb_chip[i]->dev == dev) {
if (usb_chip[i]->shutdown) { if (usb_chip[i]->shutdown) {
snd_printk(KERN_ERR "USB device is in the shutdown state, cannot create a card instance\n"); dev_err(&dev->dev, "USB device is in the shutdown state, cannot create a card instance\n");
goto __error; goto __error;
} }
chip = usb_chip[i]; chip = usb_chip[i];
...@@ -523,7 +526,7 @@ snd_usb_audio_probe(struct usb_device *dev, ...@@ -523,7 +526,7 @@ snd_usb_audio_probe(struct usb_device *dev,
break; break;
} }
if (!chip) { if (!chip) {
printk(KERN_ERR "no available usb audio device\n"); dev_err(&dev->dev, "no available usb audio device\n");
goto __error; goto __error;
} }
} }
......
...@@ -115,9 +115,9 @@ static int uac_clock_selector_set_val(struct snd_usb_audio *chip, int selector_i ...@@ -115,9 +115,9 @@ static int uac_clock_selector_set_val(struct snd_usb_audio *chip, int selector_i
return ret; return ret;
if (ret != sizeof(pin)) { if (ret != sizeof(pin)) {
snd_printk(KERN_ERR usb_audio_err(chip,
"usb-audio:%d: setting selector (id %d) unexpected length %d\n", "setting selector (id %d) unexpected length %d\n",
chip->dev->devnum, selector_id, ret); selector_id, ret);
return -EINVAL; return -EINVAL;
} }
...@@ -126,9 +126,9 @@ static int uac_clock_selector_set_val(struct snd_usb_audio *chip, int selector_i ...@@ -126,9 +126,9 @@ static int uac_clock_selector_set_val(struct snd_usb_audio *chip, int selector_i
return ret; return ret;
if (ret != pin) { if (ret != pin) {
snd_printk(KERN_ERR usb_audio_err(chip,
"usb-audio:%d: setting selector (id %d) to %x failed (current: %d)\n", "setting selector (id %d) to %x failed (current: %d)\n",
chip->dev->devnum, selector_id, pin, ret); selector_id, pin, ret);
return -EINVAL; return -EINVAL;
} }
...@@ -158,7 +158,8 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id) ...@@ -158,7 +158,8 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
&data, sizeof(data)); &data, sizeof(data));
if (err < 0) { if (err < 0) {
snd_printk(KERN_WARNING "%s(): cannot get clock validity for id %d\n", dev_warn(&dev->dev,
"%s(): cannot get clock validity for id %d\n",
__func__, source_id); __func__, source_id);
return 0; return 0;
} }
...@@ -177,9 +178,9 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, ...@@ -177,9 +178,9 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
entity_id &= 0xff; entity_id &= 0xff;
if (test_and_set_bit(entity_id, visited)) { if (test_and_set_bit(entity_id, visited)) {
snd_printk(KERN_WARNING usb_audio_warn(chip,
"%s(): recursive clock topology detected, id %d.\n", "%s(): recursive clock topology detected, id %d.\n",
__func__, entity_id); __func__, entity_id);
return -EINVAL; return -EINVAL;
} }
...@@ -188,8 +189,9 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, ...@@ -188,8 +189,9 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
if (source) { if (source) {
entity_id = source->bClockID; entity_id = source->bClockID;
if (validate && !uac_clock_source_is_valid(chip, entity_id)) { if (validate && !uac_clock_source_is_valid(chip, entity_id)) {
snd_printk(KERN_ERR "usb-audio:%d: clock source %d is not valid, cannot use\n", usb_audio_err(chip,
chip->dev->devnum, entity_id); "clock source %d is not valid, cannot use\n",
entity_id);
return -ENXIO; return -ENXIO;
} }
return entity_id; return entity_id;
...@@ -208,7 +210,7 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, ...@@ -208,7 +210,7 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
/* Selector values are one-based */ /* Selector values are one-based */
if (ret > selector->bNrInPins || ret < 1) { if (ret > selector->bNrInPins || ret < 1) {
snd_printk(KERN_ERR usb_audio_err(chip,
"%s(): selector reported illegal value, id %d, ret %d\n", "%s(): selector reported illegal value, id %d, ret %d\n",
__func__, selector->bClockID, ret); __func__, selector->bClockID, ret);
...@@ -237,9 +239,9 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, ...@@ -237,9 +239,9 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
if (err < 0) if (err < 0)
continue; continue;
snd_printk(KERN_INFO usb_audio_info(chip,
"usb-audio:%d: found and selected valid clock source %d\n", "found and selected valid clock source %d\n",
chip->dev->devnum, ret); ret);
return ret; return ret;
} }
...@@ -296,8 +298,8 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface, ...@@ -296,8 +298,8 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
data, sizeof(data))) < 0) { data, sizeof(data))) < 0) {
snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d to ep %#x\n", dev_err(&dev->dev, "%d:%d: cannot set freq %d to ep %#x\n",
dev->devnum, iface, fmt->altsetting, rate, ep); iface, fmt->altsetting, rate, ep);
return err; return err;
} }
...@@ -305,14 +307,14 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface, ...@@ -305,14 +307,14 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN, USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN,
UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
data, sizeof(data))) < 0) { data, sizeof(data))) < 0) {
snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq at ep %#x\n", dev_err(&dev->dev, "%d:%d: cannot get freq at ep %#x\n",
dev->devnum, iface, fmt->altsetting, ep); iface, fmt->altsetting, ep);
return 0; /* some devices don't support reading */ return 0; /* some devices don't support reading */
} }
crate = data[0] | (data[1] << 8) | (data[2] << 16); crate = data[0] | (data[1] << 8) | (data[2] << 16);
if (crate != rate) { if (crate != rate) {
snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate); dev_warn(&dev->dev, "current rate %d is different from the runtime rate %d\n", crate, rate);
// runtime->rate = crate; // runtime->rate = crate;
} }
...@@ -332,8 +334,8 @@ static int get_sample_rate_v2(struct snd_usb_audio *chip, int iface, ...@@ -332,8 +334,8 @@ static int get_sample_rate_v2(struct snd_usb_audio *chip, int iface,
snd_usb_ctrl_intf(chip) | (clock << 8), snd_usb_ctrl_intf(chip) | (clock << 8),
&data, sizeof(data)); &data, sizeof(data));
if (err < 0) { if (err < 0) {
snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2): err %d\n", dev_warn(&dev->dev, "%d:%d: cannot get freq (v2): err %d\n",
dev->devnum, iface, altsetting, err); iface, altsetting, err);
return 0; return 0;
} }
...@@ -369,8 +371,9 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface, ...@@ -369,8 +371,9 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
snd_usb_ctrl_intf(chip) | (clock << 8), snd_usb_ctrl_intf(chip) | (clock << 8),
&data, sizeof(data)); &data, sizeof(data));
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d (v2): err %d\n", usb_audio_err(chip,
dev->devnum, iface, fmt->altsetting, rate, err); "%d:%d: cannot set freq %d (v2): err %d\n",
iface, fmt->altsetting, rate, err);
return err; return err;
} }
...@@ -381,14 +384,14 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface, ...@@ -381,14 +384,14 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
if (cur_rate != rate) { if (cur_rate != rate) {
if (!writeable) { if (!writeable) {
snd_printk(KERN_WARNING usb_audio_warn(chip,
"%d:%d:%d: freq mismatch (RO clock): req %d, clock runs @%d\n", "%d:%d: freq mismatch (RO clock): req %d, clock runs @%d\n",
dev->devnum, iface, fmt->altsetting, rate, cur_rate); iface, fmt->altsetting, rate, cur_rate);
return -ENXIO; return -ENXIO;
} }
snd_printd(KERN_WARNING usb_audio_dbg(chip,
"current rate %d is different from the runtime rate %d\n", "current rate %d is different from the runtime rate %d\n",
cur_rate, rate); cur_rate, rate);
} }
/* Some devices doesn't respond to sample rate changes while the /* Some devices doesn't respond to sample rate changes while the
......
...@@ -333,8 +333,9 @@ static void queue_pending_output_urbs(struct snd_usb_endpoint *ep) ...@@ -333,8 +333,9 @@ 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)
snd_printk(KERN_ERR "Unable to submit urb #%d: %d (urb %p)\n", usb_audio_err(ep->chip,
ctx->index, err, ctx->urb); "Unable to submit urb #%d: %d (urb %p)\n",
ctx->index, err, ctx->urb);
else else
set_bit(ctx->index, &ep->active_mask); set_bit(ctx->index, &ep->active_mask);
} }
...@@ -387,7 +388,7 @@ static void snd_complete_urb(struct urb *urb) ...@@ -387,7 +388,7 @@ static void snd_complete_urb(struct urb *urb)
if (err == 0) if (err == 0)
return; return;
snd_printk(KERN_ERR "cannot submit urb (err = %d)\n", err); usb_audio_err(ep->chip, "cannot submit urb (err = %d)\n", err);
//snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); //snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
exit_clear: exit_clear:
...@@ -426,13 +427,14 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip, ...@@ -426,13 +427,14 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
if (ep->ep_num == ep_num && if (ep->ep_num == ep_num &&
ep->iface == alts->desc.bInterfaceNumber && ep->iface == alts->desc.bInterfaceNumber &&
ep->altsetting == alts->desc.bAlternateSetting) { ep->altsetting == alts->desc.bAlternateSetting) {
snd_printdd(KERN_DEBUG "Re-using EP %x in iface %d,%d @%p\n", usb_audio_dbg(ep->chip,
"Re-using EP %x in iface %d,%d @%p\n",
ep_num, ep->iface, ep->altsetting, ep); ep_num, ep->iface, ep->altsetting, ep);
goto __exit_unlock; goto __exit_unlock;
} }
} }
snd_printdd(KERN_DEBUG "Creating new %s %s endpoint #%x\n", usb_audio_dbg(chip, "Creating new %s %s endpoint #%x\n",
is_playback ? "playback" : "capture", is_playback ? "playback" : "capture",
type == SND_USB_ENDPOINT_TYPE_DATA ? "data" : "sync", type == SND_USB_ENDPOINT_TYPE_DATA ? "data" : "sync",
ep_num); ep_num);
...@@ -496,8 +498,9 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep) ...@@ -496,8 +498,9 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep)
} while (time_before(jiffies, end_time)); } while (time_before(jiffies, end_time));
if (alive) if (alive)
snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n", usb_audio_err(ep->chip,
alive, ep->ep_num); "timeout: still %d active urbs on EP #%x\n",
alive, ep->ep_num);
clear_bit(EP_FLAG_STOPPING, &ep->flags); clear_bit(EP_FLAG_STOPPING, &ep->flags);
return 0; return 0;
...@@ -794,8 +797,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, ...@@ -794,8 +797,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
int err; int err;
if (ep->use_count != 0) { if (ep->use_count != 0) {
snd_printk(KERN_WARNING "Unable to change format on ep #%x: already in use\n", usb_audio_warn(ep->chip,
ep->ep_num); "Unable to change format on ep #%x: already in use\n",
ep->ep_num);
return -EBUSY; return -EBUSY;
} }
...@@ -830,8 +834,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, ...@@ -830,8 +834,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
err = -EINVAL; err = -EINVAL;
} }
snd_printdd(KERN_DEBUG "Setting params for ep #%x (type %d, %d urbs), ret=%d\n", usb_audio_dbg(ep->chip,
ep->ep_num, ep->type, ep->nurbs, err); "Setting params for ep #%x (type %d, %d urbs), ret=%d\n",
ep->ep_num, ep->type, ep->nurbs, err);
return err; return err;
} }
...@@ -906,8 +911,9 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep) ...@@ -906,8 +911,9 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep)
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "cannot submit urb %d, error %d: %s\n", usb_audio_err(ep->chip,
i, err, usb_error_string(err)); "cannot submit urb %d, error %d: %s\n",
i, err, usb_error_string(err));
goto __error; goto __error;
} }
set_bit(i, &ep->active_mask); set_bit(i, &ep->active_mask);
......
...@@ -74,8 +74,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, ...@@ -74,8 +74,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
if ((pcm_formats == 0) && if ((pcm_formats == 0) &&
(format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) { (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) {
/* some devices don't define this correctly... */ /* some devices don't define this correctly... */
snd_printdd(KERN_INFO "%d:%u:%d : format type 0 is detected, processed as PCM\n", usb_audio_info(chip, "%u:%d : format type 0 is detected, processed as PCM\n",
chip->dev->devnum, fp->iface, fp->altsetting); fp->iface, fp->altsetting);
format = 1 << UAC_FORMAT_TYPE_I_PCM; format = 1 << UAC_FORMAT_TYPE_I_PCM;
} }
if (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, ...@@ -83,9 +83,9 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
sample_width == 24 && sample_bytes == 2) sample_width == 24 && sample_bytes == 2)
sample_bytes = 3; sample_bytes = 3;
else if (sample_width > sample_bytes * 8) { else if (sample_width > sample_bytes * 8) {
snd_printk(KERN_INFO "%d:%u:%d : sample bitwidth %d in over sample bytes %d\n", usb_audio_info(chip, "%u:%d : sample bitwidth %d in over sample bytes %d\n",
chip->dev->devnum, fp->iface, fp->altsetting, fp->iface, fp->altsetting,
sample_width, sample_bytes); sample_width, sample_bytes);
} }
/* check the format byte size */ /* check the format byte size */
switch (sample_bytes) { switch (sample_bytes) {
...@@ -108,9 +108,10 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, ...@@ -108,9 +108,10 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
pcm_formats |= SNDRV_PCM_FMTBIT_S32_LE; pcm_formats |= SNDRV_PCM_FMTBIT_S32_LE;
break; break;
default: default:
snd_printk(KERN_INFO "%d:%u:%d : unsupported sample bitwidth %d in %d bytes\n", usb_audio_info(chip,
chip->dev->devnum, fp->iface, fp->altsetting, "%u:%d : unsupported sample bitwidth %d in %d bytes\n",
sample_width, sample_bytes); fp->iface, fp->altsetting,
sample_width, sample_bytes);
break; break;
} }
} }
...@@ -132,8 +133,9 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, ...@@ -132,8 +133,9 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
pcm_formats |= SNDRV_PCM_FMTBIT_MU_LAW; pcm_formats |= SNDRV_PCM_FMTBIT_MU_LAW;
} }
if (format & ~0x3f) { if (format & ~0x3f) {
snd_printk(KERN_INFO "%d:%u:%d : unsupported format bits %#x\n", usb_audio_info(chip,
chip->dev->devnum, fp->iface, fp->altsetting, format); "%u:%d : unsupported format bits %#x\n",
fp->iface, fp->altsetting, format);
} }
pcm_formats |= snd_usb_interface_dsd_format_quirks(chip, fp, sample_bytes); 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 ...@@ -158,8 +160,9 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
int nr_rates = fmt[offset]; int nr_rates = fmt[offset];
if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) { if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) {
snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", usb_audio_err(chip,
chip->dev->devnum, fp->iface, fp->altsetting); "%u:%d : invalid UAC_FORMAT_TYPE desc\n",
fp->iface, fp->altsetting);
return -EINVAL; return -EINVAL;
} }
...@@ -171,7 +174,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof ...@@ -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); fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);
if (fp->rate_table == NULL) { if (fp->rate_table == NULL) {
snd_printk(KERN_ERR "cannot malloc\n"); usb_audio_err(chip, "cannot malloc\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -222,7 +225,8 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof ...@@ -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. * get to know how many sample rates we have to expect.
* Then fp->rate_table can be allocated and filled. * 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) const unsigned char *data)
{ {
int i, nr_rates = 0; int i, nr_rates = 0;
...@@ -261,7 +265,7 @@ static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets, ...@@ -261,7 +265,7 @@ static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets,
nr_rates++; nr_rates++;
if (nr_rates >= MAX_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; break;
} }
...@@ -287,7 +291,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, ...@@ -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); int clock = snd_usb_clock_find_source(chip, fp->clock, false);
if (clock < 0) { 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); __func__, clock);
goto err; goto err;
} }
...@@ -300,7 +305,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, ...@@ -300,7 +305,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
tmp, sizeof(tmp)); tmp, sizeof(tmp));
if (ret < 0) { 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); __func__, clock);
goto err; goto err;
} }
...@@ -321,7 +327,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, ...@@ -321,7 +327,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
data, data_size); data, data_size);
if (ret < 0) { 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); __func__, clock);
ret = -EINVAL; ret = -EINVAL;
goto err_free; goto err_free;
...@@ -332,7 +339,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, ...@@ -332,7 +339,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
* will have to deal with. */ * will have to deal with. */
kfree(fp->rate_table); kfree(fp->rate_table);
fp->rate_table = NULL; 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) { if (fp->nr_rates == 0) {
/* SNDRV_PCM_RATE_CONTINUOUS */ /* SNDRV_PCM_RATE_CONTINUOUS */
...@@ -348,7 +355,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, ...@@ -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 /* Call the triplet parser again, but this time, fp->rate_table is
* allocated, so the rates will be stored */ * 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: err_free:
kfree(data); kfree(data);
...@@ -408,8 +415,9 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, ...@@ -408,8 +415,9 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
} }
if (fp->channels < 1) { if (fp->channels < 1) {
snd_printk(KERN_ERR "%d:%u:%d : invalid channels %d\n", usb_audio_err(chip,
chip->dev->devnum, fp->iface, fp->altsetting, fp->channels); "%u:%d : invalid channels %d\n",
fp->iface, fp->altsetting, fp->channels);
return -EINVAL; return -EINVAL;
} }
...@@ -435,8 +443,9 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, ...@@ -435,8 +443,9 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
fp->formats = SNDRV_PCM_FMTBIT_MPEG; fp->formats = SNDRV_PCM_FMTBIT_MPEG;
break; break;
default: default:
snd_printd(KERN_INFO "%d:%u:%d : unknown format tag %#x is detected. processed as MPEG.\n", usb_audio_info(chip,
chip->dev->devnum, fp->iface, fp->altsetting, format); "%u:%d : unknown format tag %#x is detected. processed as MPEG.\n",
fp->iface, fp->altsetting, format);
fp->formats = SNDRV_PCM_FMTBIT_MPEG; fp->formats = SNDRV_PCM_FMTBIT_MPEG;
break; break;
} }
...@@ -449,7 +458,7 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, ...@@ -449,7 +458,7 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; struct uac_format_type_ii_discrete_descriptor *fmt = _fmt;
brate = le16_to_cpu(fmt->wMaxBitRate); brate = le16_to_cpu(fmt->wMaxBitRate);
framesize = le16_to_cpu(fmt->wSamplesPerFrame); 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; fp->frame_size = framesize;
ret = parse_audio_format_rates_v1(chip, fp, _fmt, 8); /* fmt[8..] sample rates */ ret = parse_audio_format_rates_v1(chip, fp, _fmt, 8); /* fmt[8..] sample rates */
break; break;
...@@ -458,7 +467,7 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, ...@@ -458,7 +467,7 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
struct uac_format_type_ii_ext_descriptor *fmt = _fmt; struct uac_format_type_ii_ext_descriptor *fmt = _fmt;
brate = le16_to_cpu(fmt->wMaxBitRate); brate = le16_to_cpu(fmt->wMaxBitRate);
framesize = le16_to_cpu(fmt->wSamplesPerFrame); 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; fp->frame_size = framesize;
ret = parse_audio_format_rates_v2(chip, fp); ret = parse_audio_format_rates_v2(chip, fp);
break; break;
...@@ -484,9 +493,10 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip, ...@@ -484,9 +493,10 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip,
err = parse_audio_format_ii(chip, fp, format, fmt); err = parse_audio_format_ii(chip, fp, format, fmt);
break; break;
default: default:
snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n", usb_audio_info(chip,
chip->dev->devnum, fp->iface, fp->altsetting, "%u:%d : format type %d is not supported yet\n",
fmt->bFormatType); fp->iface, fp->altsetting,
fmt->bFormatType);
return -ENOTSUPP; return -ENOTSUPP;
} }
fp->fmt_type = fmt->bFormatType; fp->fmt_type = fmt->bFormatType;
......
...@@ -191,16 +191,16 @@ static int snd_usbmidi_submit_urb(struct urb* urb, gfp_t flags) ...@@ -191,16 +191,16 @@ static int snd_usbmidi_submit_urb(struct urb* urb, gfp_t flags)
{ {
int err = usb_submit_urb(urb, flags); int err = usb_submit_urb(urb, flags);
if (err < 0 && err != -ENODEV) if (err < 0 && err != -ENODEV)
snd_printk(KERN_ERR "usb_submit_urb: %d\n", err); dev_err(&urb->dev->dev, "usb_submit_urb: %d\n", err);
return err; return err;
} }
/* /*
* Error handling for URB completion functions. * Error handling for URB completion functions.
*/ */
static int snd_usbmidi_urb_error(int status) static int snd_usbmidi_urb_error(const struct urb *urb)
{ {
switch (status) { switch (urb->status) {
/* manually unlinked, or device gone */ /* manually unlinked, or device gone */
case -ENOENT: case -ENOENT:
case -ECONNRESET: case -ECONNRESET:
...@@ -213,7 +213,7 @@ static int snd_usbmidi_urb_error(int status) ...@@ -213,7 +213,7 @@ static int snd_usbmidi_urb_error(int status)
case -EILSEQ: case -EILSEQ:
return -EIO; return -EIO;
default: default:
snd_printk(KERN_ERR "urb status %d\n", status); dev_err(&urb->dev->dev, "urb status %d\n", urb->status);
return 0; /* continue */ return 0; /* continue */
} }
} }
...@@ -227,7 +227,7 @@ static void snd_usbmidi_input_data(struct snd_usb_midi_in_endpoint* ep, int port ...@@ -227,7 +227,7 @@ static void snd_usbmidi_input_data(struct snd_usb_midi_in_endpoint* ep, int port
struct usbmidi_in_port* port = &ep->ports[portidx]; struct usbmidi_in_port* port = &ep->ports[portidx];
if (!port->substream) { if (!port->substream) {
snd_printd("unexpected port %d!\n", portidx); dev_dbg(&ep->umidi->dev->dev, "unexpected port %d!\n", portidx);
return; return;
} }
if (!test_bit(port->substream->number, &ep->umidi->input_triggered)) if (!test_bit(port->substream->number, &ep->umidi->input_triggered))
...@@ -259,7 +259,7 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb) ...@@ -259,7 +259,7 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb)
ep->umidi->usb_protocol_ops->input(ep, urb->transfer_buffer, ep->umidi->usb_protocol_ops->input(ep, urb->transfer_buffer,
urb->actual_length); urb->actual_length);
} else { } else {
int err = snd_usbmidi_urb_error(urb->status); int err = snd_usbmidi_urb_error(urb);
if (err < 0) { if (err < 0) {
if (err != -ENODEV) { if (err != -ENODEV) {
ep->error_resubmit = 1; ep->error_resubmit = 1;
...@@ -289,7 +289,7 @@ static void snd_usbmidi_out_urb_complete(struct urb* urb) ...@@ -289,7 +289,7 @@ static void snd_usbmidi_out_urb_complete(struct urb* urb)
} }
spin_unlock(&ep->buffer_lock); spin_unlock(&ep->buffer_lock);
if (urb->status < 0) { if (urb->status < 0) {
int err = snd_usbmidi_urb_error(urb->status); int err = snd_usbmidi_urb_error(urb);
if (err < 0) { if (err < 0) {
if (err != -ENODEV) if (err != -ENODEV)
mod_timer(&ep->umidi->error_timer, mod_timer(&ep->umidi->error_timer,
...@@ -1668,7 +1668,7 @@ static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi, ...@@ -1668,7 +1668,7 @@ static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi,
struct snd_rawmidi_substream *substream = snd_usbmidi_find_substream(umidi, stream, number); struct snd_rawmidi_substream *substream = snd_usbmidi_find_substream(umidi, stream, number);
if (!substream) { if (!substream) {
snd_printd(KERN_ERR "substream %d:%d not found\n", stream, number); dev_err(&umidi->dev->dev, "substream %d:%d not found\n", stream, number);
return; return;
} }
...@@ -1717,7 +1717,7 @@ static int snd_usbmidi_create_endpoints(struct snd_usb_midi* umidi, ...@@ -1717,7 +1717,7 @@ static int snd_usbmidi_create_endpoints(struct snd_usb_midi* umidi,
} }
} }
} }
snd_printdd(KERN_INFO "created %d output and %d input ports\n", dev_dbg(&umidi->dev->dev, "created %d output and %d input ports\n",
out_ports, in_ports); out_ports, in_ports);
return 0; return 0;
} }
...@@ -1747,10 +1747,11 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, ...@@ -1747,10 +1747,11 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
ms_header->bLength >= 7 && ms_header->bLength >= 7 &&
ms_header->bDescriptorType == USB_DT_CS_INTERFACE && ms_header->bDescriptorType == USB_DT_CS_INTERFACE &&
ms_header->bDescriptorSubtype == UAC_HEADER) ms_header->bDescriptorSubtype == UAC_HEADER)
snd_printdd(KERN_INFO "MIDIStreaming version %02x.%02x\n", dev_dbg(&umidi->dev->dev, "MIDIStreaming version %02x.%02x\n",
ms_header->bcdMSC[1], ms_header->bcdMSC[0]); ms_header->bcdMSC[1], ms_header->bcdMSC[0]);
else else
snd_printk(KERN_WARNING "MIDIStreaming interface descriptor not found\n"); dev_warn(&umidi->dev->dev,
"MIDIStreaming interface descriptor not found\n");
epidx = 0; epidx = 0;
for (i = 0; i < intfd->bNumEndpoints; ++i) { for (i = 0; i < intfd->bNumEndpoints; ++i) {
...@@ -1767,7 +1768,8 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, ...@@ -1767,7 +1768,8 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
if (usb_endpoint_dir_out(ep)) { if (usb_endpoint_dir_out(ep)) {
if (endpoints[epidx].out_ep) { if (endpoints[epidx].out_ep) {
if (++epidx >= MIDI_MAX_ENDPOINTS) { if (++epidx >= MIDI_MAX_ENDPOINTS) {
snd_printk(KERN_WARNING "too many endpoints\n"); dev_warn(&umidi->dev->dev,
"too many endpoints\n");
break; break;
} }
} }
...@@ -1782,12 +1784,13 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, ...@@ -1782,12 +1784,13 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
*/ */
endpoints[epidx].out_interval = 1; endpoints[epidx].out_interval = 1;
endpoints[epidx].out_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; endpoints[epidx].out_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1;
snd_printdd(KERN_INFO "EP %02X: %d jack(s)\n", dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n",
ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack); ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack);
} else { } else {
if (endpoints[epidx].in_ep) { if (endpoints[epidx].in_ep) {
if (++epidx >= MIDI_MAX_ENDPOINTS) { if (++epidx >= MIDI_MAX_ENDPOINTS) {
snd_printk(KERN_WARNING "too many endpoints\n"); dev_warn(&umidi->dev->dev,
"too many endpoints\n");
break; break;
} }
} }
...@@ -1797,7 +1800,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, ...@@ -1797,7 +1800,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW) else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW)
endpoints[epidx].in_interval = 1; endpoints[epidx].in_interval = 1;
endpoints[epidx].in_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; endpoints[epidx].in_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1;
snd_printdd(KERN_INFO "EP %02X: %d jack(s)\n", dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n",
ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack); ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack);
} }
} }
...@@ -1865,7 +1868,7 @@ static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi) ...@@ -1865,7 +1868,7 @@ static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi)
(get_endpoint(hostif, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) (get_endpoint(hostif, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT)
return; return;
snd_printdd(KERN_INFO "switching to altsetting %d with int ep\n", dev_dbg(&umidi->dev->dev, "switching to altsetting %d with int ep\n",
intfd->bAlternateSetting); intfd->bAlternateSetting);
usb_set_interface(umidi->dev, intfd->bInterfaceNumber, usb_set_interface(umidi->dev, intfd->bInterfaceNumber,
intfd->bAlternateSetting); intfd->bAlternateSetting);
...@@ -2047,25 +2050,25 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, ...@@ -2047,25 +2050,25 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
* input bulk endpoints (at indices 1 and 3) which aren't used. * input bulk endpoints (at indices 1 and 3) which aren't used.
*/ */
if (intfd->bNumEndpoints < (endpoint->out_cables > 0x0001 ? 5 : 3)) { if (intfd->bNumEndpoints < (endpoint->out_cables > 0x0001 ? 5 : 3)) {
snd_printdd(KERN_ERR "not enough endpoints\n"); dev_dbg(&umidi->dev->dev, "not enough endpoints\n");
return -ENOENT; return -ENOENT;
} }
epd = get_endpoint(hostif, 0); epd = get_endpoint(hostif, 0);
if (!usb_endpoint_dir_in(epd) || !usb_endpoint_xfer_int(epd)) { if (!usb_endpoint_dir_in(epd) || !usb_endpoint_xfer_int(epd)) {
snd_printdd(KERN_ERR "endpoint[0] isn't interrupt\n"); dev_dbg(&umidi->dev->dev, "endpoint[0] isn't interrupt\n");
return -ENXIO; return -ENXIO;
} }
epd = get_endpoint(hostif, 2); epd = get_endpoint(hostif, 2);
if (!usb_endpoint_dir_out(epd) || !usb_endpoint_xfer_bulk(epd)) { if (!usb_endpoint_dir_out(epd) || !usb_endpoint_xfer_bulk(epd)) {
snd_printdd(KERN_ERR "endpoint[2] isn't bulk output\n"); dev_dbg(&umidi->dev->dev, "endpoint[2] isn't bulk output\n");
return -ENXIO; return -ENXIO;
} }
if (endpoint->out_cables > 0x0001) { if (endpoint->out_cables > 0x0001) {
epd = get_endpoint(hostif, 4); epd = get_endpoint(hostif, 4);
if (!usb_endpoint_dir_out(epd) || if (!usb_endpoint_dir_out(epd) ||
!usb_endpoint_xfer_bulk(epd)) { !usb_endpoint_xfer_bulk(epd)) {
snd_printdd(KERN_ERR "endpoint[4] isn't bulk output\n"); dev_dbg(&umidi->dev->dev, "endpoint[4] isn't bulk output\n");
return -ENXIO; return -ENXIO;
} }
} }
...@@ -2289,7 +2292,7 @@ int snd_usbmidi_create(struct snd_card *card, ...@@ -2289,7 +2292,7 @@ int snd_usbmidi_create(struct snd_card *card,
err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
break; break;
default: default:
snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); dev_err(&umidi->dev->dev, "invalid quirk type %d\n", quirk->type);
err = -ENXIO; err = -ENXIO;
break; break;
} }
......
This diff is collapsed.
...@@ -600,8 +600,8 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol, ...@@ -600,8 +600,8 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol,
up_read(&mixer->chip->shutdown_rwsem); up_read(&mixer->chip->shutdown_rwsem);
if (ret < 0) { if (ret < 0) {
snd_printk(KERN_ERR dev_err(&dev->dev,
"unable to issue vendor read request (ret = %d)", ret); "unable to issue vendor read request (ret = %d)", ret);
return ret; return ret;
} }
...@@ -631,8 +631,8 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol, ...@@ -631,8 +631,8 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol,
up_read(&mixer->chip->shutdown_rwsem); up_read(&mixer->chip->shutdown_rwsem);
if (ret < 0) { if (ret < 0) {
snd_printk(KERN_ERR dev_err(&dev->dev,
"unable to issue vendor write request (ret = %d)", ret); "unable to issue vendor write request (ret = %d)", ret);
return ret; return ret;
} }
...@@ -1699,7 +1699,7 @@ void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer, ...@@ -1699,7 +1699,7 @@ void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer,
snd_usb_mixer_notify_id(mixer, mixer->rc_cfg->mute_mixer_id); snd_usb_mixer_notify_id(mixer, mixer->rc_cfg->mute_mixer_id);
break; break;
default: default:
snd_printd(KERN_DEBUG "memory change in unknown unit %d\n", unitid); usb_audio_dbg(mixer->chip, "memory change in unknown unit %d\n", unitid);
break; break;
} }
} }
......
...@@ -166,8 +166,8 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface, ...@@ -166,8 +166,8 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface,
USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT,
UAC_EP_CS_ATTR_PITCH_CONTROL << 8, ep, UAC_EP_CS_ATTR_PITCH_CONTROL << 8, ep,
data, sizeof(data))) < 0) { data, sizeof(data))) < 0) {
snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH\n", usb_audio_err(chip, "%d:%d: cannot set enable PITCH\n",
dev->devnum, iface, ep); iface, ep);
return err; return err;
} }
...@@ -187,8 +187,8 @@ static int init_pitch_v2(struct snd_usb_audio *chip, int iface, ...@@ -187,8 +187,8 @@ static int init_pitch_v2(struct snd_usb_audio *chip, int iface,
USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
UAC2_EP_CS_PITCH << 8, 0, UAC2_EP_CS_PITCH << 8, 0,
data, sizeof(data))) < 0) { data, sizeof(data))) < 0) {
snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH (v2)\n", usb_audio_err(chip, "%d:%d: cannot set enable PITCH (v2)\n",
dev->devnum, iface, fmt->altsetting); iface, fmt->altsetting);
return err; return err;
} }
...@@ -226,7 +226,7 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep) ...@@ -226,7 +226,7 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep)
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;
snd_printdd(KERN_DEBUG "Starting data EP @%p\n", ep); dev_dbg(&subs->dev->dev, "Starting data EP @%p\n", ep);
ep->data_subs = subs; ep->data_subs = subs;
err = snd_usb_endpoint_start(ep, can_sleep); err = snd_usb_endpoint_start(ep, can_sleep);
...@@ -247,16 +247,15 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep) ...@@ -247,16 +247,15 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep)
subs->sync_endpoint->altsetting); subs->sync_endpoint->altsetting);
if (err < 0) { if (err < 0) {
clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags);
snd_printk(KERN_ERR dev_err(&subs->dev->dev,
"%d:%d:%d: cannot set interface (%d)\n", "%d:%d: cannot set interface (%d)\n",
subs->dev->devnum,
subs->sync_endpoint->iface, subs->sync_endpoint->iface,
subs->sync_endpoint->altsetting, err); subs->sync_endpoint->altsetting, err);
return -EIO; return -EIO;
} }
} }
snd_printdd(KERN_DEBUG "Starting sync EP @%p\n", ep); dev_dbg(&subs->dev->dev, "Starting sync EP @%p\n", ep);
ep->sync_slave = subs->data_endpoint; ep->sync_slave = subs->data_endpoint;
err = snd_usb_endpoint_start(ep, can_sleep); err = snd_usb_endpoint_start(ep, can_sleep);
...@@ -410,8 +409,9 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, ...@@ -410,8 +409,9 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
if ((get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC || if ((get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC ||
(get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
get_endpoint(alts, 1)->bSynchAddress != 0)) { get_endpoint(alts, 1)->bSynchAddress != 0)) {
snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. bmAttributes %02x, bLength %d, bSynchAddress %02x\n", dev_err(&dev->dev,
dev->devnum, fmt->iface, fmt->altsetting, "%d:%d : invalid sync pipe. bmAttributes %02x, bLength %d, bSynchAddress %02x\n",
fmt->iface, fmt->altsetting,
get_endpoint(alts, 1)->bmAttributes, get_endpoint(alts, 1)->bmAttributes,
get_endpoint(alts, 1)->bLength, get_endpoint(alts, 1)->bLength,
get_endpoint(alts, 1)->bSynchAddress); get_endpoint(alts, 1)->bSynchAddress);
...@@ -421,8 +421,9 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, ...@@ -421,8 +421,9 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) || ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) ||
(!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) { (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) {
snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n", dev_err(&dev->dev,
dev->devnum, fmt->iface, fmt->altsetting, "%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n",
fmt->iface, fmt->altsetting,
is_playback, ep, get_endpoint(alts, 0)->bSynchAddress); is_playback, ep, get_endpoint(alts, 0)->bSynchAddress);
return -EINVAL; return -EINVAL;
} }
...@@ -469,8 +470,9 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) ...@@ -469,8 +470,9 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
if (subs->interface >= 0 && subs->interface != fmt->iface) { if (subs->interface >= 0 && subs->interface != fmt->iface) {
err = usb_set_interface(subs->dev, subs->interface, 0); err = usb_set_interface(subs->dev, subs->interface, 0);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "%d:%d:%d: return to setting 0 failed (%d)\n", dev_err(&dev->dev,
dev->devnum, fmt->iface, fmt->altsetting, err); "%d:%d: return to setting 0 failed (%d)\n",
fmt->iface, fmt->altsetting, err);
return -EIO; return -EIO;
} }
subs->interface = -1; subs->interface = -1;
...@@ -482,12 +484,13 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) ...@@ -482,12 +484,13 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
subs->altset_idx != fmt->altset_idx) { subs->altset_idx != fmt->altset_idx) {
err = usb_set_interface(dev, fmt->iface, fmt->altsetting); err = usb_set_interface(dev, fmt->iface, fmt->altsetting);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "%d:%d:%d: usb_set_interface failed (%d)\n", dev_err(&dev->dev,
dev->devnum, fmt->iface, fmt->altsetting, err); "%d:%d: usb_set_interface failed (%d)\n",
fmt->iface, fmt->altsetting, err);
return -EIO; return -EIO;
} }
snd_printdd(KERN_INFO "setting usb interface %d:%d\n", dev_dbg(&dev->dev, "setting usb interface %d:%d\n",
fmt->iface, fmt->altsetting); fmt->iface, fmt->altsetting);
subs->interface = fmt->iface; subs->interface = fmt->iface;
subs->altset_idx = fmt->altset_idx; subs->altset_idx = fmt->altset_idx;
...@@ -523,20 +526,23 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) ...@@ -523,20 +526,23 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
* - Requested PCM format is not supported. * - Requested PCM format is not supported.
* - Requested sample rate is not supported. * - Requested sample rate is not supported.
*/ */
static int match_endpoint_audioformats(struct audioformat *fp, static int match_endpoint_audioformats(struct snd_usb_substream *subs,
struct audioformat *match, int rate, struct audioformat *fp,
snd_pcm_format_t pcm_format) struct audioformat *match, int rate,
snd_pcm_format_t pcm_format)
{ {
int i; int i;
int score = 0; int score = 0;
if (fp->channels < 1) { if (fp->channels < 1) {
snd_printdd("%s: (fmt @%p) no channels\n", __func__, fp); dev_dbg(&subs->dev->dev,
"%s: (fmt @%p) no channels\n", __func__, fp);
return 0; return 0;
} }
if (!(fp->formats & pcm_format_to_bits(pcm_format))) { if (!(fp->formats & pcm_format_to_bits(pcm_format))) {
snd_printdd("%s: (fmt @%p) no match for format %d\n", __func__, dev_dbg(&subs->dev->dev,
"%s: (fmt @%p) no match for format %d\n", __func__,
fp, pcm_format); fp, pcm_format);
return 0; return 0;
} }
...@@ -548,7 +554,8 @@ static int match_endpoint_audioformats(struct audioformat *fp, ...@@ -548,7 +554,8 @@ static int match_endpoint_audioformats(struct audioformat *fp,
} }
} }
if (!score) { if (!score) {
snd_printdd("%s: (fmt @%p) no match for rate %d\n", __func__, dev_dbg(&subs->dev->dev,
"%s: (fmt @%p) no match for rate %d\n", __func__,
fp, rate); fp, rate);
return 0; return 0;
} }
...@@ -556,7 +563,8 @@ static int match_endpoint_audioformats(struct audioformat *fp, ...@@ -556,7 +563,8 @@ static int match_endpoint_audioformats(struct audioformat *fp,
if (fp->channels == match->channels) if (fp->channels == match->channels)
score++; score++;
snd_printdd("%s: (fmt @%p) score %d\n", __func__, fp, score); dev_dbg(&subs->dev->dev,
"%s: (fmt @%p) score %d\n", __func__, fp, score);
return score; return score;
} }
...@@ -587,7 +595,8 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs) ...@@ -587,7 +595,8 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs)
/* Try to find the best matching audioformat. */ /* Try to find the best matching audioformat. */
list_for_each_entry(fp, &sync_subs->fmt_list, list) { list_for_each_entry(fp, &sync_subs->fmt_list, list) {
int score = match_endpoint_audioformats(fp, subs->cur_audiofmt, int score = match_endpoint_audioformats(subs,
fp, subs->cur_audiofmt,
subs->cur_rate, subs->pcm_format); subs->cur_rate, subs->pcm_format);
if (score > cur_score) { if (score > cur_score) {
...@@ -597,7 +606,8 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs) ...@@ -597,7 +606,8 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs)
} }
if (unlikely(sync_fp == NULL)) { if (unlikely(sync_fp == NULL)) {
snd_printk(KERN_ERR "%s: no valid audioformat for sync ep %x found\n", dev_err(&subs->dev->dev,
"%s: no valid audioformat for sync ep %x found\n",
__func__, sync_subs->ep_num); __func__, sync_subs->ep_num);
return -EINVAL; return -EINVAL;
} }
...@@ -609,7 +619,8 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs) ...@@ -609,7 +619,8 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs)
if (sync_fp->channels != subs->channels) { if (sync_fp->channels != subs->channels) {
sync_period_bytes = (subs->period_bytes / subs->channels) * sync_period_bytes = (subs->period_bytes / subs->channels) *
sync_fp->channels; sync_fp->channels;
snd_printdd("%s: adjusted sync ep period bytes (%d -> %d)\n", dev_dbg(&subs->dev->dev,
"%s: adjusted sync ep period bytes (%d -> %d)\n",
__func__, subs->period_bytes, sync_period_bytes); __func__, subs->period_bytes, sync_period_bytes);
} }
...@@ -685,7 +696,8 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, ...@@ -685,7 +696,8 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
fmt = find_format(subs); fmt = find_format(subs);
if (!fmt) { if (!fmt) {
snd_printd(KERN_DEBUG "cannot set format: format = %#x, rate = %d, channels = %d\n", dev_dbg(&subs->dev->dev,
"cannot set format: format = %#x, rate = %d, channels = %d\n",
subs->pcm_format, subs->cur_rate, subs->channels); subs->pcm_format, subs->cur_rate, subs->channels);
return -EINVAL; return -EINVAL;
} }
...@@ -742,7 +754,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -742,7 +754,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
int ret; int ret;
if (! subs->cur_audiofmt) { if (! subs->cur_audiofmt) {
snd_printk(KERN_ERR "usbaudio: no format is specified!\n"); dev_err(&subs->dev->dev, "no format is specified!\n");
return -ENXIO; return -ENXIO;
} }
...@@ -1235,7 +1247,8 @@ static void retire_capture_urb(struct snd_usb_substream *subs, ...@@ -1235,7 +1247,8 @@ static void retire_capture_urb(struct snd_usb_substream *subs,
for (i = 0; i < urb->number_of_packets; i++) { for (i = 0; i < urb->number_of_packets; i++) {
cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset + subs->pkt_offset_adj; cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset + subs->pkt_offset_adj;
if (urb->iso_frame_desc[i].status && printk_ratelimit()) { if (urb->iso_frame_desc[i].status && printk_ratelimit()) {
snd_printdd(KERN_ERR "frame %d active: %d\n", i, urb->iso_frame_desc[i].status); dev_dbg(&subs->dev->dev, "frame %d active: %d\n",
i, urb->iso_frame_desc[i].status);
// continue; // continue;
} }
bytes = urb->iso_frame_desc[i].actual_length; bytes = urb->iso_frame_desc[i].actual_length;
...@@ -1245,7 +1258,8 @@ static void retire_capture_urb(struct snd_usb_substream *subs, ...@@ -1245,7 +1258,8 @@ static void retire_capture_urb(struct snd_usb_substream *subs,
if (bytes % (runtime->sample_bits >> 3) != 0) { if (bytes % (runtime->sample_bits >> 3) != 0) {
int oldbytes = bytes; int oldbytes = bytes;
bytes = frames * stride; bytes = frames * stride;
snd_printdd(KERN_ERR "Corrected urb data len. %d->%d\n", dev_warn(&subs->dev->dev,
"Corrected urb data len. %d->%d\n",
oldbytes, bytes); oldbytes, bytes);
} }
/* update the current pointer */ /* update the current pointer */
...@@ -1488,7 +1502,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs, ...@@ -1488,7 +1502,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
* on two reads of a counter updated every ms. * on two reads of a counter updated every ms.
*/ */
if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2) if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n", dev_dbg(&subs->dev->dev,
"delay: estimated %d, actual %d\n",
est_delay, subs->last_delay); est_delay, subs->last_delay);
if (!subs->running) { if (!subs->running) {
......
...@@ -110,7 +110,7 @@ static int create_standard_audio_quirk(struct snd_usb_audio *chip, ...@@ -110,7 +110,7 @@ static int create_standard_audio_quirk(struct snd_usb_audio *chip,
altsd = get_iface_desc(alts); altsd = get_iface_desc(alts);
err = snd_usb_parse_audio_interface(chip, altsd->bInterfaceNumber); err = snd_usb_parse_audio_interface(chip, altsd->bInterfaceNumber);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "cannot setup if %d: error %d\n", usb_audio_err(chip, "cannot setup if %d: error %d\n",
altsd->bInterfaceNumber, err); altsd->bInterfaceNumber, err);
return err; return err;
} }
...@@ -135,7 +135,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, ...@@ -135,7 +135,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL); fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL);
if (!fp) { if (!fp) {
snd_printk(KERN_ERR "cannot memdup\n"); usb_audio_err(chip, "cannot memdup\n");
return -ENOMEM; return -ENOMEM;
} }
if (fp->nr_rates > MAX_NR_RATES) { if (fp->nr_rates > MAX_NR_RATES) {
...@@ -464,7 +464,7 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, ...@@ -464,7 +464,7 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip,
fp->rate_max = fp->rate_min = 96000; fp->rate_max = fp->rate_min = 96000;
break; break;
default: default:
snd_printk(KERN_ERR "unknown sample rate\n"); usb_audio_err(chip, "unknown sample rate\n");
kfree(fp); kfree(fp);
return -ENXIO; return -ENXIO;
} }
...@@ -536,7 +536,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, ...@@ -536,7 +536,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
if (quirk->type < QUIRK_TYPE_COUNT) { if (quirk->type < QUIRK_TYPE_COUNT) {
return quirk_funcs[quirk->type](chip, iface, driver, quirk); return quirk_funcs[quirk->type](chip, iface, driver, quirk);
} else { } else {
snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); usb_audio_err(chip, "invalid quirk type %d\n", quirk->type);
return -ENXIO; return -ENXIO;
} }
} }
...@@ -555,18 +555,21 @@ static int snd_usb_extigy_boot_quirk(struct usb_device *dev, struct usb_interfac ...@@ -555,18 +555,21 @@ static int snd_usb_extigy_boot_quirk(struct usb_device *dev, struct usb_interfac
if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD || if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD ||
le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_NEW) { le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_NEW) {
snd_printdd("sending Extigy boot sequence...\n"); dev_dbg(&dev->dev, "sending Extigy boot sequence...\n");
/* Send message to force it to reconnect with full interface. */ /* Send message to force it to reconnect with full interface. */
err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev,0), err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev,0),
0x10, 0x43, 0x0001, 0x000a, NULL, 0); 0x10, 0x43, 0x0001, 0x000a, NULL, 0);
if (err < 0) snd_printdd("error sending boot message: %d\n", err); if (err < 0)
dev_dbg(&dev->dev, "error sending boot message: %d\n", err);
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
&dev->descriptor, sizeof(dev->descriptor)); &dev->descriptor, sizeof(dev->descriptor));
config = dev->actconfig; config = dev->actconfig;
if (err < 0) snd_printdd("error usb_get_descriptor: %d\n", err); if (err < 0)
dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err);
err = usb_reset_configuration(dev); err = usb_reset_configuration(dev);
if (err < 0) snd_printdd("error usb_reset_configuration: %d\n", err); if (err < 0)
snd_printdd("extigy_boot: new boot length = %d\n", dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err);
dev_dbg(&dev->dev, "extigy_boot: new boot length = %d\n",
le16_to_cpu(get_cfg_desc(config)->wTotalLength)); le16_to_cpu(get_cfg_desc(config)->wTotalLength));
return -ENODEV; /* quit this anyway */ return -ENODEV; /* quit this anyway */
} }
...@@ -594,7 +597,7 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev) ...@@ -594,7 +597,7 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev)
int err; int err;
if (dev->actconfig->desc.bConfigurationValue == 1) { if (dev->actconfig->desc.bConfigurationValue == 1) {
snd_printk(KERN_INFO "usb-audio: " dev_info(&dev->dev,
"Fast Track Pro switching to config #2\n"); "Fast Track Pro switching to config #2\n");
/* This function has to be available by the usb core module. /* This function has to be available by the usb core module.
* if it is not avialable the boot quirk has to be left out * if it is not avialable the boot quirk has to be left out
...@@ -603,14 +606,15 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev) ...@@ -603,14 +606,15 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev)
*/ */
err = usb_driver_set_configuration(dev, 2); err = usb_driver_set_configuration(dev, 2);
if (err < 0) if (err < 0)
snd_printdd("error usb_driver_set_configuration: %d\n", dev_dbg(&dev->dev,
err); "error usb_driver_set_configuration: %d\n",
err);
/* Always return an error, so that we stop creating a device /* Always return an error, so that we stop creating a device
that will just be destroyed and recreated with a new that will just be destroyed and recreated with a new
configuration */ configuration */
return -ENODEV; return -ENODEV;
} else } else
snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); dev_info(&dev->dev, "Fast Track Pro config OK\n");
return 0; return 0;
} }
...@@ -779,11 +783,11 @@ static int snd_usb_mbox2_boot_quirk(struct usb_device *dev) ...@@ -779,11 +783,11 @@ static int snd_usb_mbox2_boot_quirk(struct usb_device *dev)
fwsize = le16_to_cpu(get_cfg_desc(config)->wTotalLength); fwsize = le16_to_cpu(get_cfg_desc(config)->wTotalLength);
if (fwsize != MBOX2_FIRMWARE_SIZE) { if (fwsize != MBOX2_FIRMWARE_SIZE) {
snd_printk(KERN_ERR "usb-audio: Invalid firmware size=%d.\n", fwsize); dev_err(&dev->dev, "Invalid firmware size=%d.\n", fwsize);
return -ENODEV; return -ENODEV;
} }
snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n"); dev_dbg(&dev->dev, "Sending Digidesign Mbox 2 boot sequence...\n");
count = 0; count = 0;
bootresponse[0] = MBOX2_BOOT_LOADING; bootresponse[0] = MBOX2_BOOT_LOADING;
...@@ -794,32 +798,32 @@ static int snd_usb_mbox2_boot_quirk(struct usb_device *dev) ...@@ -794,32 +798,32 @@ static int snd_usb_mbox2_boot_quirk(struct usb_device *dev)
0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012); 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012);
if (bootresponse[0] == MBOX2_BOOT_READY) if (bootresponse[0] == MBOX2_BOOT_READY)
break; break;
snd_printd("usb-audio: device not ready, resending boot sequence...\n"); dev_dbg(&dev->dev, "device not ready, resending boot sequence...\n");
count++; count++;
} }
if (bootresponse[0] != MBOX2_BOOT_READY) { if (bootresponse[0] != MBOX2_BOOT_READY) {
snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]); dev_err(&dev->dev, "Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]);
return -ENODEV; return -ENODEV;
} }
snd_printdd("usb-audio: device initialised!\n"); dev_dbg(&dev->dev, "device initialised!\n");
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
&dev->descriptor, sizeof(dev->descriptor)); &dev->descriptor, sizeof(dev->descriptor));
config = dev->actconfig; config = dev->actconfig;
if (err < 0) if (err < 0)
snd_printd("error usb_get_descriptor: %d\n", err); dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err);
err = usb_reset_configuration(dev); err = usb_reset_configuration(dev);
if (err < 0) if (err < 0)
snd_printd("error usb_reset_configuration: %d\n", err); dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err);
snd_printdd("mbox2_boot: new boot length = %d\n", dev_dbg(&dev->dev, "mbox2_boot: new boot length = %d\n",
le16_to_cpu(get_cfg_desc(config)->wTotalLength)); le16_to_cpu(get_cfg_desc(config)->wTotalLength));
mbox2_setup_48_24_magic(dev); mbox2_setup_48_24_magic(dev);
snd_printk(KERN_INFO "usb-audio: Digidesign Mbox 2: 24bit 48kHz"); dev_info(&dev->dev, "Digidesign Mbox 2: 24bit 48kHz");
return 0; /* Successful boot */ return 0; /* Successful boot */
} }
...@@ -865,7 +869,7 @@ static int quattro_skip_setting_quirk(struct snd_usb_audio *chip, ...@@ -865,7 +869,7 @@ static int quattro_skip_setting_quirk(struct snd_usb_audio *chip,
return 1; /* skip this altsetting */ return 1; /* skip this altsetting */
} }
} }
snd_printdd(KERN_INFO usb_audio_dbg(chip,
"using altsetting %d for interface %d config %d\n", "using altsetting %d for interface %d config %d\n",
altno, iface, chip->setup); altno, iface, chip->setup);
return 0; /* keep this altsetting */ return 0; /* keep this altsetting */
...@@ -932,7 +936,7 @@ static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip, ...@@ -932,7 +936,7 @@ static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip,
return 1; return 1;
} }
snd_printdd(KERN_INFO usb_audio_dbg(chip,
"using altsetting %d for interface %d config %d\n", "using altsetting %d for interface %d config %d\n",
altno, iface, chip->setup); altno, iface, chip->setup);
return 0; /* keep this altsetting */ return 0; /* keep this altsetting */
......
...@@ -411,10 +411,9 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip, ...@@ -411,10 +411,9 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
if (!csep || csep->bLength < 7 || if (!csep || csep->bLength < 7 ||
csep->bDescriptorSubtype != UAC_EP_GENERAL) { csep->bDescriptorSubtype != UAC_EP_GENERAL) {
snd_printk(KERN_WARNING "%d:%u:%d : no or invalid" usb_audio_warn(chip,
" class specific endpoint descriptor\n", "%u:%d : no or invalid class specific endpoint descriptor\n",
chip->dev->devnum, iface_no, iface_no, altsd->bAlternateSetting);
altsd->bAlternateSetting);
return 0; return 0;
} }
...@@ -533,8 +532,8 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) ...@@ -533,8 +532,8 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
/* get audio formats */ /* get audio formats */
switch (protocol) { switch (protocol) {
default: default:
snd_printdd(KERN_WARNING "%d:%u:%d: unknown interface protocol %#02x, assuming v1\n", dev_dbg(&dev->dev, "%u:%d: unknown interface protocol %#02x, assuming v1\n",
dev->devnum, iface_no, altno, protocol); iface_no, altno, protocol);
protocol = UAC_VERSION_1; protocol = UAC_VERSION_1;
/* fall through */ /* fall through */
...@@ -544,14 +543,16 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) ...@@ -544,14 +543,16 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
struct uac_input_terminal_descriptor *iterm; struct uac_input_terminal_descriptor *iterm;
if (!as) { if (!as) {
snd_printk(KERN_ERR "%d:%u:%d : UAC_AS_GENERAL descriptor not found\n", dev_err(&dev->dev,
dev->devnum, iface_no, altno); "%u:%d : UAC_AS_GENERAL descriptor not found\n",
iface_no, altno);
continue; continue;
} }
if (as->bLength < sizeof(*as)) { if (as->bLength < sizeof(*as)) {
snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_AS_GENERAL desc\n", dev_err(&dev->dev,
dev->devnum, iface_no, altno); "%u:%d : invalid UAC_AS_GENERAL desc\n",
iface_no, altno);
continue; continue;
} }
...@@ -574,14 +575,16 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) ...@@ -574,14 +575,16 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL); snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);
if (!as) { if (!as) {
snd_printk(KERN_ERR "%d:%u:%d : UAC_AS_GENERAL descriptor not found\n", dev_err(&dev->dev,
dev->devnum, iface_no, altno); "%u:%d : UAC_AS_GENERAL descriptor not found\n",
iface_no, altno);
continue; continue;
} }
if (as->bLength < sizeof(*as)) { if (as->bLength < sizeof(*as)) {
snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_AS_GENERAL desc\n", dev_err(&dev->dev,
dev->devnum, iface_no, altno); "%u:%d : invalid UAC_AS_GENERAL desc\n",
iface_no, altno);
continue; continue;
} }
...@@ -607,8 +610,9 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) ...@@ -607,8 +610,9 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
break; break;
} }
snd_printk(KERN_ERR "%d:%u:%d : bogus bTerminalLink %d\n", dev_err(&dev->dev,
dev->devnum, iface_no, altno, as->bTerminalLink); "%u:%d : bogus bTerminalLink %d\n",
iface_no, altno, as->bTerminalLink);
continue; continue;
} }
} }
...@@ -616,14 +620,16 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) ...@@ -616,14 +620,16 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
/* get format type */ /* get format type */
fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_FORMAT_TYPE); fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_FORMAT_TYPE);
if (!fmt) { if (!fmt) {
snd_printk(KERN_ERR "%d:%u:%d : no UAC_FORMAT_TYPE desc\n", dev_err(&dev->dev,
dev->devnum, iface_no, altno); "%u:%d : no UAC_FORMAT_TYPE desc\n",
iface_no, altno);
continue; continue;
} }
if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) || if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) ||
((protocol == UAC_VERSION_2) && (fmt->bLength < 6))) { ((protocol == UAC_VERSION_2) && (fmt->bLength < 6))) {
snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", dev_err(&dev->dev,
dev->devnum, iface_no, altno); "%u:%d : invalid UAC_FORMAT_TYPE desc\n",
iface_no, altno);
continue; continue;
} }
...@@ -644,7 +650,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) ...@@ -644,7 +650,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
fp = kzalloc(sizeof(*fp), GFP_KERNEL); fp = kzalloc(sizeof(*fp), GFP_KERNEL);
if (! fp) { if (! fp) {
snd_printk(KERN_ERR "cannot malloc\n"); dev_err(&dev->dev, "cannot malloc\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -707,7 +713,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) ...@@ -707,7 +713,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
chconfig = 0; chconfig = 0;
fp->chmap = convert_chmap(fp->channels, chconfig, protocol); fp->chmap = convert_chmap(fp->channels, chconfig, protocol);
snd_printdd(KERN_INFO "%d:%u:%d: add audio endpoint %#x\n", dev->devnum, iface_no, altno, fp->endpoint); dev_dbg(&dev->dev, "%u:%d: add audio endpoint %#x\n", iface_no, altno, fp->endpoint);
err = snd_usb_add_audio_stream(chip, stream, fp); err = snd_usb_add_audio_stream(chip, stream, fp);
if (err < 0) { if (err < 0) {
kfree(fp->rate_table); kfree(fp->rate_table);
......
...@@ -60,6 +60,15 @@ struct snd_usb_audio { ...@@ -60,6 +60,15 @@ struct snd_usb_audio {
struct usb_host_interface *ctrl_intf; /* the audio control interface */ struct usb_host_interface *ctrl_intf; /* the audio control interface */
}; };
#define usb_audio_err(chip, fmt, args...) \
dev_err(&(chip)->dev->dev, fmt, ##args)
#define usb_audio_warn(chip, fmt, args...) \
dev_warn(&(chip)->dev->dev, fmt, ##args)
#define usb_audio_info(chip, fmt, args...) \
dev_info(&(chip)->dev->dev, fmt, ##args)
#define usb_audio_dbg(chip, fmt, args...) \
dev_dbg(&(chip)->dev->dev, fmt, ##args)
/* /*
* Information about devices with broken descriptors * Information about devices with broken descriptors
*/ */
......
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