Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+325 -254
+22 -19
sound/usb/card.c
··· 139 139 struct usb_interface *iface = usb_ifnum_to_if(dev, interface); 140 140 141 141 if (!iface) { 142 - snd_printk(KERN_ERR "%d:%u:%d : does not exist\n", 143 - dev->devnum, ctrlif, interface); 142 + dev_err(&dev->dev, "%u:%d : does not exist\n", 143 + ctrlif, interface); 144 144 return -EINVAL; 145 145 } 146 146 ··· 165 165 } 166 166 167 167 if (usb_interface_claimed(iface)) { 168 - snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n", 169 - dev->devnum, ctrlif, interface); 168 + dev_dbg(&dev->dev, "%d:%d: skipping, already claimed\n", 169 + ctrlif, interface); 170 170 return -EINVAL; 171 171 } 172 172 ··· 176 176 int err = snd_usbmidi_create(chip->card, iface, 177 177 &chip->midi_list, NULL); 178 178 if (err < 0) { 179 - snd_printk(KERN_ERR "%d:%u:%d: cannot create sequencer device\n", 180 - dev->devnum, ctrlif, interface); 179 + dev_err(&dev->dev, 180 + "%u:%d: cannot create sequencer device\n", 181 + ctrlif, interface); 181 182 return -EINVAL; 182 183 } 183 184 usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L); ··· 189 188 if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && 190 189 altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || 191 190 altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING) { 192 - snd_printdd(KERN_ERR "%d:%u:%d: skipping non-supported interface %d\n", 193 - dev->devnum, ctrlif, interface, altsd->bInterfaceClass); 191 + dev_dbg(&dev->dev, 192 + "%u:%d: skipping non-supported interface %d\n", 193 + ctrlif, interface, altsd->bInterfaceClass); 194 194 /* skip non-supported classes */ 195 195 return -EINVAL; 196 196 } 197 197 198 198 if (snd_usb_get_speed(dev) == USB_SPEED_LOW) { 199 - snd_printk(KERN_ERR "low speed audio streaming not supported\n"); 199 + dev_err(&dev->dev, "low speed audio streaming not supported\n"); 200 200 return -EINVAL; 201 201 } 202 202 ··· 230 228 protocol = altsd->bInterfaceProtocol; 231 229 232 230 if (!control_header) { 233 - snd_printk(KERN_ERR "cannot find UAC_HEADER\n"); 231 + dev_err(&dev->dev, "cannot find UAC_HEADER\n"); 234 232 return -EINVAL; 235 233 } 236 234 237 235 switch (protocol) { 238 236 default: 239 - snd_printdd(KERN_WARNING "unknown interface protocol %#02x, assuming v1\n", 240 - protocol); 237 + dev_warn(&dev->dev, 238 + "unknown interface protocol %#02x, assuming v1\n", 239 + protocol); 241 240 /* fall through */ 242 241 243 242 case UAC_VERSION_1: { 244 243 struct uac1_ac_header_descriptor *h1 = control_header; 245 244 246 245 if (!h1->bInCollection) { 247 - snd_printk(KERN_INFO "skipping empty audio interface (v1)\n"); 246 + dev_info(&dev->dev, "skipping empty audio interface (v1)\n"); 248 247 return -EINVAL; 249 248 } 250 249 251 250 if (h1->bLength < sizeof(*h1) + h1->bInCollection) { 252 - snd_printk(KERN_ERR "invalid UAC_HEADER (v1)\n"); 251 + dev_err(&dev->dev, "invalid UAC_HEADER (v1)\n"); 253 252 return -EINVAL; 254 253 } 255 254 ··· 280 277 } 281 278 282 279 if (!assoc) { 283 - snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n"); 280 + dev_err(&dev->dev, "Audio class v2 interfaces need an interface association\n"); 284 281 return -EINVAL; 285 282 } 286 283 ··· 354 351 case USB_SPEED_SUPER: 355 352 break; 356 353 default: 357 - snd_printk(KERN_ERR "unknown device speed %d\n", snd_usb_get_speed(dev)); 354 + dev_err(&dev->dev, "unknown device speed %d\n", snd_usb_get_speed(dev)); 358 355 return -ENXIO; 359 356 } 360 357 361 358 err = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE, 362 359 0, &card); 363 360 if (err < 0) { 364 - snd_printk(KERN_ERR "cannot create card instance %d\n", idx); 361 + dev_err(&dev->dev, "cannot create card instance %d\n", idx); 365 362 return err; 366 363 } 367 364 ··· 502 499 for (i = 0; i < SNDRV_CARDS; i++) { 503 500 if (usb_chip[i] && usb_chip[i]->dev == dev) { 504 501 if (usb_chip[i]->shutdown) { 505 - snd_printk(KERN_ERR "USB device is in the shutdown state, cannot create a card instance\n"); 502 + dev_err(&dev->dev, "USB device is in the shutdown state, cannot create a card instance\n"); 506 503 goto __error; 507 504 } 508 505 chip = usb_chip[i]; ··· 526 523 break; 527 524 } 528 525 if (!chip) { 529 - printk(KERN_ERR "no available usb audio device\n"); 526 + dev_err(&dev->dev, "no available usb audio device\n"); 530 527 goto __error; 531 528 } 532 529 }
+34 -31
sound/usb/clock.c
··· 115 115 return ret; 116 116 117 117 if (ret != sizeof(pin)) { 118 - snd_printk(KERN_ERR 119 - "usb-audio:%d: setting selector (id %d) unexpected length %d\n", 120 - chip->dev->devnum, selector_id, ret); 118 + usb_audio_err(chip, 119 + "setting selector (id %d) unexpected length %d\n", 120 + selector_id, ret); 121 121 return -EINVAL; 122 122 } 123 123 ··· 126 126 return ret; 127 127 128 128 if (ret != pin) { 129 - snd_printk(KERN_ERR 130 - "usb-audio:%d: setting selector (id %d) to %x failed (current: %d)\n", 131 - chip->dev->devnum, selector_id, pin, ret); 129 + usb_audio_err(chip, 130 + "setting selector (id %d) to %x failed (current: %d)\n", 131 + selector_id, pin, ret); 132 132 return -EINVAL; 133 133 } 134 134 ··· 158 158 &data, sizeof(data)); 159 159 160 160 if (err < 0) { 161 - snd_printk(KERN_WARNING "%s(): cannot get clock validity for id %d\n", 161 + dev_warn(&dev->dev, 162 + "%s(): cannot get clock validity for id %d\n", 162 163 __func__, source_id); 163 164 return 0; 164 165 } ··· 178 177 entity_id &= 0xff; 179 178 180 179 if (test_and_set_bit(entity_id, visited)) { 181 - snd_printk(KERN_WARNING 182 - "%s(): recursive clock topology detected, id %d.\n", 183 - __func__, entity_id); 180 + usb_audio_warn(chip, 181 + "%s(): recursive clock topology detected, id %d.\n", 182 + __func__, entity_id); 184 183 return -EINVAL; 185 184 } 186 185 ··· 189 188 if (source) { 190 189 entity_id = source->bClockID; 191 190 if (validate && !uac_clock_source_is_valid(chip, entity_id)) { 192 - snd_printk(KERN_ERR "usb-audio:%d: clock source %d is not valid, cannot use\n", 193 - chip->dev->devnum, entity_id); 191 + usb_audio_err(chip, 192 + "clock source %d is not valid, cannot use\n", 193 + entity_id); 194 194 return -ENXIO; 195 195 } 196 196 return entity_id; ··· 210 208 /* Selector values are one-based */ 211 209 212 210 if (ret > selector->bNrInPins || ret < 1) { 213 - snd_printk(KERN_ERR 211 + usb_audio_err(chip, 214 212 "%s(): selector reported illegal value, id %d, ret %d\n", 215 213 __func__, selector->bClockID, ret); 216 214 ··· 239 237 if (err < 0) 240 238 continue; 241 239 242 - snd_printk(KERN_INFO 243 - "usb-audio:%d: found and selected valid clock source %d\n", 244 - chip->dev->devnum, ret); 240 + usb_audio_info(chip, 241 + "found and selected valid clock source %d\n", 242 + ret); 245 243 return ret; 246 244 } 247 245 ··· 298 296 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, 299 297 UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, 300 298 data, sizeof(data))) < 0) { 301 - snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d to ep %#x\n", 302 - dev->devnum, iface, fmt->altsetting, rate, ep); 299 + dev_err(&dev->dev, "%d:%d: cannot set freq %d to ep %#x\n", 300 + iface, fmt->altsetting, rate, ep); 303 301 return err; 304 302 } 305 303 ··· 307 305 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN, 308 306 UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, 309 307 data, sizeof(data))) < 0) { 310 - snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq at ep %#x\n", 311 - dev->devnum, iface, fmt->altsetting, ep); 308 + dev_err(&dev->dev, "%d:%d: cannot get freq at ep %#x\n", 309 + iface, fmt->altsetting, ep); 312 310 return 0; /* some devices don't support reading */ 313 311 } 314 312 315 313 crate = data[0] | (data[1] << 8) | (data[2] << 16); 316 314 if (crate != rate) { 317 - snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate); 315 + dev_warn(&dev->dev, "current rate %d is different from the runtime rate %d\n", crate, rate); 318 316 // runtime->rate = crate; 319 317 } 320 318 ··· 334 332 snd_usb_ctrl_intf(chip) | (clock << 8), 335 333 &data, sizeof(data)); 336 334 if (err < 0) { 337 - snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2): err %d\n", 338 - dev->devnum, iface, altsetting, err); 335 + dev_warn(&dev->dev, "%d:%d: cannot get freq (v2): err %d\n", 336 + iface, altsetting, err); 339 337 return 0; 340 338 } 341 339 ··· 371 369 snd_usb_ctrl_intf(chip) | (clock << 8), 372 370 &data, sizeof(data)); 373 371 if (err < 0) { 374 - snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d (v2): err %d\n", 375 - dev->devnum, iface, fmt->altsetting, rate, err); 372 + usb_audio_err(chip, 373 + "%d:%d: cannot set freq %d (v2): err %d\n", 374 + iface, fmt->altsetting, rate, err); 376 375 return err; 377 376 } 378 377 ··· 384 381 385 382 if (cur_rate != rate) { 386 383 if (!writeable) { 387 - snd_printk(KERN_WARNING 388 - "%d:%d:%d: freq mismatch (RO clock): req %d, clock runs @%d\n", 389 - dev->devnum, iface, fmt->altsetting, rate, cur_rate); 384 + usb_audio_warn(chip, 385 + "%d:%d: freq mismatch (RO clock): req %d, clock runs @%d\n", 386 + iface, fmt->altsetting, rate, cur_rate); 390 387 return -ENXIO; 391 388 } 392 - snd_printd(KERN_WARNING 393 - "current rate %d is different from the runtime rate %d\n", 394 - cur_rate, rate); 389 + usb_audio_dbg(chip, 390 + "current rate %d is different from the runtime rate %d\n", 391 + cur_rate, rate); 395 392 } 396 393 397 394 /* Some devices doesn't respond to sample rate changes while the
+19 -13
sound/usb/endpoint.c
··· 333 333 334 334 err = usb_submit_urb(ctx->urb, GFP_ATOMIC); 335 335 if (err < 0) 336 - snd_printk(KERN_ERR "Unable to submit urb #%d: %d (urb %p)\n", 337 - ctx->index, err, ctx->urb); 336 + usb_audio_err(ep->chip, 337 + "Unable to submit urb #%d: %d (urb %p)\n", 338 + ctx->index, err, ctx->urb); 338 339 else 339 340 set_bit(ctx->index, &ep->active_mask); 340 341 } ··· 388 387 if (err == 0) 389 388 return; 390 389 391 - snd_printk(KERN_ERR "cannot submit urb (err = %d)\n", err); 390 + usb_audio_err(ep->chip, "cannot submit urb (err = %d)\n", err); 392 391 //snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); 393 392 394 393 exit_clear: ··· 427 426 if (ep->ep_num == ep_num && 428 427 ep->iface == alts->desc.bInterfaceNumber && 429 428 ep->altsetting == alts->desc.bAlternateSetting) { 430 - snd_printdd(KERN_DEBUG "Re-using EP %x in iface %d,%d @%p\n", 429 + usb_audio_dbg(ep->chip, 430 + "Re-using EP %x in iface %d,%d @%p\n", 431 431 ep_num, ep->iface, ep->altsetting, ep); 432 432 goto __exit_unlock; 433 433 } 434 434 } 435 435 436 - snd_printdd(KERN_DEBUG "Creating new %s %s endpoint #%x\n", 436 + usb_audio_dbg(chip, "Creating new %s %s endpoint #%x\n", 437 437 is_playback ? "playback" : "capture", 438 438 type == SND_USB_ENDPOINT_TYPE_DATA ? "data" : "sync", 439 439 ep_num); ··· 498 496 } while (time_before(jiffies, end_time)); 499 497 500 498 if (alive) 501 - snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n", 502 - alive, ep->ep_num); 499 + usb_audio_err(ep->chip, 500 + "timeout: still %d active urbs on EP #%x\n", 501 + alive, ep->ep_num); 503 502 clear_bit(EP_FLAG_STOPPING, &ep->flags); 504 503 505 504 return 0; ··· 797 794 int err; 798 795 799 796 if (ep->use_count != 0) { 800 - snd_printk(KERN_WARNING "Unable to change format on ep #%x: already in use\n", 801 - ep->ep_num); 797 + usb_audio_warn(ep->chip, 798 + "Unable to change format on ep #%x: already in use\n", 799 + ep->ep_num); 802 800 return -EBUSY; 803 801 } 804 802 ··· 834 830 err = -EINVAL; 835 831 } 836 832 837 - snd_printdd(KERN_DEBUG "Setting params for ep #%x (type %d, %d urbs), ret=%d\n", 838 - ep->ep_num, ep->type, ep->nurbs, err); 833 + usb_audio_dbg(ep->chip, 834 + "Setting params for ep #%x (type %d, %d urbs), ret=%d\n", 835 + ep->ep_num, ep->type, ep->nurbs, err); 839 836 840 837 return err; 841 838 } ··· 911 906 912 907 err = usb_submit_urb(urb, GFP_ATOMIC); 913 908 if (err < 0) { 914 - snd_printk(KERN_ERR "cannot submit urb %d, error %d: %s\n", 915 - i, err, usb_error_string(err)); 909 + usb_audio_err(ep->chip, 910 + "cannot submit urb %d, error %d: %s\n", 911 + i, err, usb_error_string(err)); 916 912 goto __error; 917 913 } 918 914 set_bit(i, &ep->active_mask);
+39 -29
sound/usb/format.c
··· 74 74 if ((pcm_formats == 0) && 75 75 (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) { 76 76 /* some devices don't define this correctly... */ 77 - snd_printdd(KERN_INFO "%d:%u:%d : format type 0 is detected, processed as PCM\n", 78 - chip->dev->devnum, fp->iface, fp->altsetting); 77 + usb_audio_info(chip, "%u:%d : format type 0 is detected, processed as PCM\n", 78 + fp->iface, fp->altsetting); 79 79 format = 1 << UAC_FORMAT_TYPE_I_PCM; 80 80 } 81 81 if (format & (1 << UAC_FORMAT_TYPE_I_PCM)) { ··· 83 83 sample_width == 24 && sample_bytes == 2) 84 84 sample_bytes = 3; 85 85 else if (sample_width > sample_bytes * 8) { 86 - snd_printk(KERN_INFO "%d:%u:%d : sample bitwidth %d in over sample bytes %d\n", 87 - chip->dev->devnum, fp->iface, fp->altsetting, 88 - sample_width, sample_bytes); 86 + usb_audio_info(chip, "%u:%d : sample bitwidth %d in over sample bytes %d\n", 87 + fp->iface, fp->altsetting, 88 + sample_width, sample_bytes); 89 89 } 90 90 /* check the format byte size */ 91 91 switch (sample_bytes) { ··· 108 108 pcm_formats |= SNDRV_PCM_FMTBIT_S32_LE; 109 109 break; 110 110 default: 111 - snd_printk(KERN_INFO "%d:%u:%d : unsupported sample bitwidth %d in %d bytes\n", 112 - chip->dev->devnum, fp->iface, fp->altsetting, 113 - sample_width, sample_bytes); 111 + usb_audio_info(chip, 112 + "%u:%d : unsupported sample bitwidth %d in %d bytes\n", 113 + fp->iface, fp->altsetting, 114 + sample_width, sample_bytes); 114 115 break; 115 116 } 116 117 } ··· 133 132 pcm_formats |= SNDRV_PCM_FMTBIT_MU_LAW; 134 133 } 135 134 if (format & ~0x3f) { 136 - snd_printk(KERN_INFO "%d:%u:%d : unsupported format bits %#x\n", 137 - chip->dev->devnum, fp->iface, fp->altsetting, format); 135 + usb_audio_info(chip, 136 + "%u:%d : unsupported format bits %#x\n", 137 + fp->iface, fp->altsetting, format); 138 138 } 139 139 140 140 pcm_formats |= snd_usb_interface_dsd_format_quirks(chip, fp, sample_bytes); ··· 160 158 int nr_rates = fmt[offset]; 161 159 162 160 if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) { 163 - snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", 164 - chip->dev->devnum, fp->iface, fp->altsetting); 161 + usb_audio_err(chip, 162 + "%u:%d : invalid UAC_FORMAT_TYPE desc\n", 163 + fp->iface, fp->altsetting); 165 164 return -EINVAL; 166 165 } 167 166 ··· 174 171 175 172 fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); 176 173 if (fp->rate_table == NULL) { 177 - snd_printk(KERN_ERR "cannot malloc\n"); 174 + usb_audio_err(chip, "cannot malloc\n"); 178 175 return -ENOMEM; 179 176 } 180 177 ··· 225 222 * get to know how many sample rates we have to expect. 226 223 * Then fp->rate_table can be allocated and filled. 227 224 */ 228 - static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets, 225 + static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip, 226 + struct audioformat *fp, int nr_triplets, 229 227 const unsigned char *data) 230 228 { 231 229 int i, nr_rates = 0; ··· 265 261 266 262 nr_rates++; 267 263 if (nr_rates >= MAX_NR_RATES) { 268 - snd_printk(KERN_ERR "invalid uac2 rates\n"); 264 + usb_audio_err(chip, "invalid uac2 rates\n"); 269 265 break; 270 266 } 271 267 ··· 291 287 int clock = snd_usb_clock_find_source(chip, fp->clock, false); 292 288 293 289 if (clock < 0) { 294 - snd_printk(KERN_ERR "%s(): unable to find clock source (clock %d)\n", 290 + dev_err(&dev->dev, 291 + "%s(): unable to find clock source (clock %d)\n", 295 292 __func__, clock); 296 293 goto err; 297 294 } ··· 305 300 tmp, sizeof(tmp)); 306 301 307 302 if (ret < 0) { 308 - snd_printk(KERN_ERR "%s(): unable to retrieve number of sample rates (clock %d)\n", 303 + dev_err(&dev->dev, 304 + "%s(): unable to retrieve number of sample rates (clock %d)\n", 309 305 __func__, clock); 310 306 goto err; 311 307 } ··· 327 321 data, data_size); 328 322 329 323 if (ret < 0) { 330 - snd_printk(KERN_ERR "%s(): unable to retrieve sample rate range (clock %d)\n", 324 + dev_err(&dev->dev, 325 + "%s(): unable to retrieve sample rate range (clock %d)\n", 331 326 __func__, clock); 332 327 ret = -EINVAL; 333 328 goto err_free; ··· 339 332 * will have to deal with. */ 340 333 kfree(fp->rate_table); 341 334 fp->rate_table = NULL; 342 - fp->nr_rates = parse_uac2_sample_rate_range(fp, nr_triplets, data); 335 + fp->nr_rates = parse_uac2_sample_rate_range(chip, fp, nr_triplets, data); 343 336 344 337 if (fp->nr_rates == 0) { 345 338 /* SNDRV_PCM_RATE_CONTINUOUS */ ··· 355 348 356 349 /* Call the triplet parser again, but this time, fp->rate_table is 357 350 * allocated, so the rates will be stored */ 358 - parse_uac2_sample_rate_range(fp, nr_triplets, data); 351 + parse_uac2_sample_rate_range(chip, fp, nr_triplets, data); 359 352 360 353 err_free: 361 354 kfree(data); ··· 415 408 } 416 409 417 410 if (fp->channels < 1) { 418 - snd_printk(KERN_ERR "%d:%u:%d : invalid channels %d\n", 419 - chip->dev->devnum, fp->iface, fp->altsetting, fp->channels); 411 + usb_audio_err(chip, 412 + "%u:%d : invalid channels %d\n", 413 + fp->iface, fp->altsetting, fp->channels); 420 414 return -EINVAL; 421 415 } 422 416 ··· 443 435 fp->formats = SNDRV_PCM_FMTBIT_MPEG; 444 436 break; 445 437 default: 446 - snd_printd(KERN_INFO "%d:%u:%d : unknown format tag %#x is detected. processed as MPEG.\n", 447 - chip->dev->devnum, fp->iface, fp->altsetting, format); 438 + usb_audio_info(chip, 439 + "%u:%d : unknown format tag %#x is detected. processed as MPEG.\n", 440 + fp->iface, fp->altsetting, format); 448 441 fp->formats = SNDRV_PCM_FMTBIT_MPEG; 449 442 break; 450 443 } ··· 458 449 struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; 459 450 brate = le16_to_cpu(fmt->wMaxBitRate); 460 451 framesize = le16_to_cpu(fmt->wSamplesPerFrame); 461 - snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); 452 + usb_audio_info(chip, "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); 462 453 fp->frame_size = framesize; 463 454 ret = parse_audio_format_rates_v1(chip, fp, _fmt, 8); /* fmt[8..] sample rates */ 464 455 break; ··· 467 458 struct uac_format_type_ii_ext_descriptor *fmt = _fmt; 468 459 brate = le16_to_cpu(fmt->wMaxBitRate); 469 460 framesize = le16_to_cpu(fmt->wSamplesPerFrame); 470 - snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); 461 + usb_audio_info(chip, "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); 471 462 fp->frame_size = framesize; 472 463 ret = parse_audio_format_rates_v2(chip, fp); 473 464 break; ··· 493 484 err = parse_audio_format_ii(chip, fp, format, fmt); 494 485 break; 495 486 default: 496 - snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n", 497 - chip->dev->devnum, fp->iface, fp->altsetting, 498 - fmt->bFormatType); 487 + usb_audio_info(chip, 488 + "%u:%d : format type %d is not supported yet\n", 489 + fp->iface, fp->altsetting, 490 + fmt->bFormatType); 499 491 return -ENOTSUPP; 500 492 } 501 493 fp->fmt_type = fmt->bFormatType;
+24 -21
sound/usb/midi.c
··· 191 191 { 192 192 int err = usb_submit_urb(urb, flags); 193 193 if (err < 0 && err != -ENODEV) 194 - snd_printk(KERN_ERR "usb_submit_urb: %d\n", err); 194 + dev_err(&urb->dev->dev, "usb_submit_urb: %d\n", err); 195 195 return err; 196 196 } 197 197 198 198 /* 199 199 * Error handling for URB completion functions. 200 200 */ 201 - static int snd_usbmidi_urb_error(int status) 201 + static int snd_usbmidi_urb_error(const struct urb *urb) 202 202 { 203 - switch (status) { 203 + switch (urb->status) { 204 204 /* manually unlinked, or device gone */ 205 205 case -ENOENT: 206 206 case -ECONNRESET: ··· 213 213 case -EILSEQ: 214 214 return -EIO; 215 215 default: 216 - snd_printk(KERN_ERR "urb status %d\n", status); 216 + dev_err(&urb->dev->dev, "urb status %d\n", urb->status); 217 217 return 0; /* continue */ 218 218 } 219 219 } ··· 227 227 struct usbmidi_in_port* port = &ep->ports[portidx]; 228 228 229 229 if (!port->substream) { 230 - snd_printd("unexpected port %d!\n", portidx); 230 + dev_dbg(&ep->umidi->dev->dev, "unexpected port %d!\n", portidx); 231 231 return; 232 232 } 233 233 if (!test_bit(port->substream->number, &ep->umidi->input_triggered)) ··· 259 259 ep->umidi->usb_protocol_ops->input(ep, urb->transfer_buffer, 260 260 urb->actual_length); 261 261 } else { 262 - int err = snd_usbmidi_urb_error(urb->status); 262 + int err = snd_usbmidi_urb_error(urb); 263 263 if (err < 0) { 264 264 if (err != -ENODEV) { 265 265 ep->error_resubmit = 1; ··· 289 289 } 290 290 spin_unlock(&ep->buffer_lock); 291 291 if (urb->status < 0) { 292 - int err = snd_usbmidi_urb_error(urb->status); 292 + int err = snd_usbmidi_urb_error(urb); 293 293 if (err < 0) { 294 294 if (err != -ENODEV) 295 295 mod_timer(&ep->umidi->error_timer, ··· 1668 1668 1669 1669 struct snd_rawmidi_substream *substream = snd_usbmidi_find_substream(umidi, stream, number); 1670 1670 if (!substream) { 1671 - snd_printd(KERN_ERR "substream %d:%d not found\n", stream, number); 1671 + dev_err(&umidi->dev->dev, "substream %d:%d not found\n", stream, number); 1672 1672 return; 1673 1673 } 1674 1674 ··· 1717 1717 } 1718 1718 } 1719 1719 } 1720 - snd_printdd(KERN_INFO "created %d output and %d input ports\n", 1720 + dev_dbg(&umidi->dev->dev, "created %d output and %d input ports\n", 1721 1721 out_ports, in_ports); 1722 1722 return 0; 1723 1723 } ··· 1747 1747 ms_header->bLength >= 7 && 1748 1748 ms_header->bDescriptorType == USB_DT_CS_INTERFACE && 1749 1749 ms_header->bDescriptorSubtype == UAC_HEADER) 1750 - snd_printdd(KERN_INFO "MIDIStreaming version %02x.%02x\n", 1750 + dev_dbg(&umidi->dev->dev, "MIDIStreaming version %02x.%02x\n", 1751 1751 ms_header->bcdMSC[1], ms_header->bcdMSC[0]); 1752 1752 else 1753 - snd_printk(KERN_WARNING "MIDIStreaming interface descriptor not found\n"); 1753 + dev_warn(&umidi->dev->dev, 1754 + "MIDIStreaming interface descriptor not found\n"); 1754 1755 1755 1756 epidx = 0; 1756 1757 for (i = 0; i < intfd->bNumEndpoints; ++i) { ··· 1768 1767 if (usb_endpoint_dir_out(ep)) { 1769 1768 if (endpoints[epidx].out_ep) { 1770 1769 if (++epidx >= MIDI_MAX_ENDPOINTS) { 1771 - snd_printk(KERN_WARNING "too many endpoints\n"); 1770 + dev_warn(&umidi->dev->dev, 1771 + "too many endpoints\n"); 1772 1772 break; 1773 1773 } 1774 1774 } ··· 1784 1782 */ 1785 1783 endpoints[epidx].out_interval = 1; 1786 1784 endpoints[epidx].out_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; 1787 - snd_printdd(KERN_INFO "EP %02X: %d jack(s)\n", 1785 + dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n", 1788 1786 ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack); 1789 1787 } else { 1790 1788 if (endpoints[epidx].in_ep) { 1791 1789 if (++epidx >= MIDI_MAX_ENDPOINTS) { 1792 - snd_printk(KERN_WARNING "too many endpoints\n"); 1790 + dev_warn(&umidi->dev->dev, 1791 + "too many endpoints\n"); 1793 1792 break; 1794 1793 } 1795 1794 } ··· 1800 1797 else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW) 1801 1798 endpoints[epidx].in_interval = 1; 1802 1799 endpoints[epidx].in_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; 1803 - snd_printdd(KERN_INFO "EP %02X: %d jack(s)\n", 1800 + dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n", 1804 1801 ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack); 1805 1802 } 1806 1803 } ··· 1868 1865 (get_endpoint(hostif, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) 1869 1866 return; 1870 1867 1871 - snd_printdd(KERN_INFO "switching to altsetting %d with int ep\n", 1868 + dev_dbg(&umidi->dev->dev, "switching to altsetting %d with int ep\n", 1872 1869 intfd->bAlternateSetting); 1873 1870 usb_set_interface(umidi->dev, intfd->bInterfaceNumber, 1874 1871 intfd->bAlternateSetting); ··· 2050 2047 * input bulk endpoints (at indices 1 and 3) which aren't used. 2051 2048 */ 2052 2049 if (intfd->bNumEndpoints < (endpoint->out_cables > 0x0001 ? 5 : 3)) { 2053 - snd_printdd(KERN_ERR "not enough endpoints\n"); 2050 + dev_dbg(&umidi->dev->dev, "not enough endpoints\n"); 2054 2051 return -ENOENT; 2055 2052 } 2056 2053 2057 2054 epd = get_endpoint(hostif, 0); 2058 2055 if (!usb_endpoint_dir_in(epd) || !usb_endpoint_xfer_int(epd)) { 2059 - snd_printdd(KERN_ERR "endpoint[0] isn't interrupt\n"); 2056 + dev_dbg(&umidi->dev->dev, "endpoint[0] isn't interrupt\n"); 2060 2057 return -ENXIO; 2061 2058 } 2062 2059 epd = get_endpoint(hostif, 2); 2063 2060 if (!usb_endpoint_dir_out(epd) || !usb_endpoint_xfer_bulk(epd)) { 2064 - snd_printdd(KERN_ERR "endpoint[2] isn't bulk output\n"); 2061 + dev_dbg(&umidi->dev->dev, "endpoint[2] isn't bulk output\n"); 2065 2062 return -ENXIO; 2066 2063 } 2067 2064 if (endpoint->out_cables > 0x0001) { 2068 2065 epd = get_endpoint(hostif, 4); 2069 2066 if (!usb_endpoint_dir_out(epd) || 2070 2067 !usb_endpoint_xfer_bulk(epd)) { 2071 - snd_printdd(KERN_ERR "endpoint[4] isn't bulk output\n"); 2068 + dev_dbg(&umidi->dev->dev, "endpoint[4] isn't bulk output\n"); 2072 2069 return -ENXIO; 2073 2070 } 2074 2071 } ··· 2292 2289 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); 2293 2290 break; 2294 2291 default: 2295 - snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); 2292 + dev_err(&umidi->dev->dev, "invalid quirk type %d\n", quirk->type); 2296 2293 err = -ENXIO; 2297 2294 break; 2298 2295 }
+68 -56
sound/usb/mixer.c
··· 305 305 goto out; 306 306 } 307 307 } 308 - snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", 309 - request, validx, idx, cval->val_type); 308 + usb_audio_dbg(chip, 309 + "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", 310 + request, validx, idx, cval->val_type); 310 311 err = -EINVAL; 311 312 312 313 out: ··· 352 351 353 352 if (ret < 0) { 354 353 error: 355 - snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", 356 - request, validx, idx, cval->val_type); 354 + usb_audio_err(chip, 355 + "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", 356 + request, validx, idx, cval->val_type); 357 357 return ret; 358 358 } 359 359 ··· 415 413 err = get_cur_mix_raw(cval, channel, value); 416 414 if (err < 0) { 417 415 if (!cval->mixer->ignore_ctl_error) 418 - snd_printd(KERN_ERR "cannot get current value for control %d ch %d: err = %d\n", 416 + usb_audio_dbg(cval->mixer->chip, 417 + "cannot get current value for control %d ch %d: err = %d\n", 419 418 cval->control, channel, err); 420 419 return err; 421 420 } ··· 447 444 448 445 /* FIXME */ 449 446 if (request != UAC_SET_CUR) { 450 - snd_printdd(KERN_WARNING "RANGE setting not yet supported\n"); 447 + usb_audio_dbg(chip, "RANGE setting not yet supported\n"); 451 448 return -EINVAL; 452 449 } 453 450 ··· 473 470 goto out; 474 471 } 475 472 } 476 - snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n", 473 + usb_audio_dbg(chip, "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n", 477 474 request, validx, idx, cval->val_type, buf[0], buf[1]); 478 475 err = -EINVAL; 479 476 ··· 497 494 cval->ch_readonly & (1 << (channel - 1)); 498 495 499 496 if (read_only) { 500 - snd_printdd(KERN_INFO "%s(): channel %d of control %d is read_only\n", 497 + usb_audio_dbg(cval->mixer->chip, 498 + "%s(): channel %d of control %d is read_only\n", 501 499 __func__, channel, cval->control); 502 500 return 0; 503 501 } ··· 564 560 while (snd_ctl_find_id(mixer->chip->card, &kctl->id)) 565 561 kctl->id.index++; 566 562 if ((err = snd_ctl_add(mixer->chip->card, kctl)) < 0) { 567 - snd_printd(KERN_ERR "cannot add control (err = %d)\n", err); 563 + usb_audio_dbg(mixer->chip, "cannot add control (err = %d)\n", err); 568 564 return err; 569 565 } 570 566 cval->elem_id = &kctl->id; ··· 811 807 static void volume_control_quirks(struct usb_mixer_elem_info *cval, 812 808 struct snd_kcontrol *kctl) 813 809 { 814 - switch (cval->mixer->chip->usb_id) { 810 + struct snd_usb_audio *chip = cval->mixer->chip; 811 + switch (chip->usb_id) { 815 812 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */ 816 813 case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ 817 814 if (strcmp(kctl->id.name, "Effect Duration") == 0) { ··· 844 839 case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */ 845 840 case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */ 846 841 if (strcmp(kctl->id.name, "Effect Duration") == 0) { 847 - snd_printk(KERN_INFO 848 - "usb-audio: set quirk for FTU Effect Duration\n"); 842 + usb_audio_info(chip, 843 + "set quirk for FTU Effect Duration\n"); 849 844 cval->min = 0x0000; 850 845 cval->max = 0x7f00; 851 846 cval->res = 0x0100; ··· 853 848 } 854 849 if (strcmp(kctl->id.name, "Effect Volume") == 0 || 855 850 strcmp(kctl->id.name, "Effect Feedback Volume") == 0) { 856 - snd_printk(KERN_INFO 857 - "usb-audio: set quirks for FTU Effect Feedback/Volume\n"); 851 + usb_audio_info(chip, 852 + "set quirks for FTU Effect Feedback/Volume\n"); 858 853 cval->min = 0x00; 859 854 cval->max = 0x7f; 860 855 break; ··· 872 867 */ 873 868 if (!strcmp(kctl->id.name, "PCM Playback Volume") && 874 869 cval->min == -15616) { 875 - snd_printk(KERN_INFO 870 + usb_audio_info(chip, 876 871 "set volume quirk for UDA1321/N101 chip\n"); 877 872 cval->max = -256; 878 873 } ··· 880 875 881 876 case USB_ID(0x046d, 0x09a4): 882 877 if (!strcmp(kctl->id.name, "Mic Capture Volume")) { 883 - snd_printk(KERN_INFO 878 + usb_audio_info(chip, 884 879 "set volume quirk for QuickCam E3500\n"); 885 880 cval->min = 6080; 886 881 cval->max = 8768; ··· 900 895 * Proboly there is some logitech magic behind this number --fishor 901 896 */ 902 897 if (!strcmp(kctl->id.name, "Mic Capture Volume")) { 903 - snd_printk(KERN_INFO 898 + usb_audio_info(chip, 904 899 "set resolution quirk: cval->res = 384\n"); 905 900 cval->res = 384; 906 901 } ··· 936 931 } 937 932 if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 || 938 933 get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) { 939 - snd_printd(KERN_ERR "%d:%d: cannot get min/max values for control %d (id %d)\n", 934 + usb_audio_err(cval->mixer->chip, 935 + "%d:%d: cannot get min/max values for control %d (id %d)\n", 940 936 cval->id, snd_usb_ctrl_intf(cval->mixer->chip), cval->control, cval->id); 941 937 return -EINVAL; 942 938 } ··· 1201 1195 1202 1196 cval = kzalloc(sizeof(*cval), GFP_KERNEL); 1203 1197 if (! cval) { 1204 - snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1198 + usb_audio_err(state->chip, "cannot malloc kcontrol\n"); 1205 1199 return; 1206 1200 } 1207 1201 cval->mixer = state->mixer; ··· 1230 1224 kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval); 1231 1225 1232 1226 if (! kctl) { 1233 - snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1227 + usb_audio_err(state->chip, "cannot malloc kcontrol\n"); 1234 1228 kfree(cval); 1235 1229 return; 1236 1230 } ··· 1304 1298 * devices. It will definitively catch all buggy Logitech devices. 1305 1299 */ 1306 1300 if (range > 384) { 1307 - snd_printk(KERN_WARNING "usb_audio: Warning! Unlikely big " 1301 + usb_audio_warn(state->chip, "Warning! Unlikely big " 1308 1302 "volume range (=%u), cval->res is probably wrong.", 1309 1303 range); 1310 - snd_printk(KERN_WARNING "usb_audio: [%d] FU [%s] ch = %d, " 1304 + usb_audio_warn(state->chip, "[%d] FU [%s] ch = %d, " 1311 1305 "val = %d/%d/%d", cval->id, 1312 1306 kctl->id.name, cval->channels, 1313 1307 cval->min, cval->max, cval->res); 1314 1308 } 1315 1309 1316 - snd_printdd(KERN_INFO "[%d] FU [%s] ch = %d, val = %d/%d/%d\n", 1310 + usb_audio_dbg(state->chip, "[%d] FU [%s] ch = %d, val = %d/%d/%d\n", 1317 1311 cval->id, kctl->id.name, cval->channels, cval->min, cval->max, cval->res); 1318 1312 snd_usb_mixer_add_control(state->mixer, kctl); 1319 1313 } ··· 1337 1331 if (state->mixer->protocol == UAC_VERSION_1) { 1338 1332 csize = hdr->bControlSize; 1339 1333 if (!csize) { 1340 - snd_printdd(KERN_ERR "usbaudio: unit %u: " 1341 - "invalid bControlSize == 0\n", unitid); 1334 + usb_audio_dbg(state->chip, 1335 + "unit %u: invalid bControlSize == 0\n", 1336 + unitid); 1342 1337 return -EINVAL; 1343 1338 } 1344 1339 channels = (hdr->bLength - 7) / csize - 1; 1345 1340 bmaControls = hdr->bmaControls; 1346 1341 if (hdr->bLength < 7 + csize) { 1347 - snd_printk(KERN_ERR "usbaudio: unit %u: " 1348 - "invalid UAC_FEATURE_UNIT descriptor\n", 1349 - unitid); 1342 + usb_audio_err(state->chip, 1343 + "unit %u: invalid UAC_FEATURE_UNIT descriptor\n", 1344 + unitid); 1350 1345 return -EINVAL; 1351 1346 } 1352 1347 } else { ··· 1356 1349 channels = (hdr->bLength - 6) / 4 - 1; 1357 1350 bmaControls = ftr->bmaControls; 1358 1351 if (hdr->bLength < 6 + csize) { 1359 - snd_printk(KERN_ERR "usbaudio: unit %u: " 1360 - "invalid UAC_FEATURE_UNIT descriptor\n", 1361 - unitid); 1352 + usb_audio_err(state->chip, 1353 + "unit %u: invalid UAC_FEATURE_UNIT descriptor\n", 1354 + unitid); 1362 1355 return -EINVAL; 1363 1356 } 1364 1357 } ··· 1376 1369 /* master configuration quirks */ 1377 1370 switch (state->chip->usb_id) { 1378 1371 case USB_ID(0x08bb, 0x2702): 1379 - snd_printk(KERN_INFO 1380 - "usbmixer: master volume quirk for PCM2702 chip\n"); 1372 + usb_audio_info(state->chip, 1373 + "usbmixer: master volume quirk for PCM2702 chip\n"); 1381 1374 /* disable non-functional volume control */ 1382 1375 master_bits &= ~UAC_CONTROL_BIT(UAC_FU_VOLUME); 1383 1376 break; 1384 1377 case USB_ID(0x1130, 0xf211): 1385 - snd_printk(KERN_INFO 1386 - "usbmixer: volume control quirk for Tenx TP6911 Audio Headset\n"); 1378 + usb_audio_info(state->chip, 1379 + "usbmixer: volume control quirk for Tenx TP6911 Audio Headset\n"); 1387 1380 /* disable non-functional volume control */ 1388 1381 channels = 0; 1389 1382 break; ··· 1485 1478 1486 1479 kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval); 1487 1480 if (! kctl) { 1488 - snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1481 + usb_audio_err(state->chip, "cannot malloc kcontrol\n"); 1489 1482 kfree(cval); 1490 1483 return; 1491 1484 } ··· 1498 1491 len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1); 1499 1492 append_ctl_name(kctl, " Volume"); 1500 1493 1501 - snd_printdd(KERN_INFO "[%d] MU [%s] ch = %d, val = %d/%d\n", 1494 + usb_audio_dbg(state->chip, "[%d] MU [%s] ch = %d, val = %d/%d\n", 1502 1495 cval->id, kctl->id.name, cval->channels, cval->min, cval->max); 1503 1496 snd_usb_mixer_add_control(state->mixer, kctl); 1504 1497 } ··· 1515 1508 int pin, ich, err; 1516 1509 1517 1510 if (desc->bLength < 11 || ! (input_pins = desc->bNrInPins) || ! (num_outs = uac_mixer_unit_bNrChannels(desc))) { 1518 - snd_printk(KERN_ERR "invalid MIXER UNIT descriptor %d\n", unitid); 1511 + usb_audio_err(state->chip, "invalid MIXER UNIT descriptor %d\n", unitid); 1519 1512 return -EINVAL; 1520 1513 } 1521 1514 /* no bmControls field (e.g. Maya44) -> ignore */ 1522 1515 if (desc->bLength <= 10 + input_pins) { 1523 - snd_printdd(KERN_INFO "MU %d has no bmControls field\n", unitid); 1516 + usb_audio_dbg(state->chip, "MU %d has no bmControls field\n", unitid); 1524 1517 return 0; 1525 1518 } 1526 1519 ··· 1719 1712 1720 1713 if (desc->bLength < 13 || desc->bLength < 13 + num_ins || 1721 1714 desc->bLength < num_ins + uac_processing_unit_bControlSize(desc, state->mixer->protocol)) { 1722 - snd_printk(KERN_ERR "invalid %s descriptor (id %d)\n", name, unitid); 1715 + usb_audio_err(state->chip, "invalid %s descriptor (id %d)\n", name, unitid); 1723 1716 return -EINVAL; 1724 1717 } 1725 1718 ··· 1745 1738 continue; 1746 1739 cval = kzalloc(sizeof(*cval), GFP_KERNEL); 1747 1740 if (! cval) { 1748 - snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1741 + usb_audio_err(state->chip, "cannot malloc kcontrol\n"); 1749 1742 return -ENOMEM; 1750 1743 } 1751 1744 cval->mixer = state->mixer; ··· 1777 1770 1778 1771 kctl = snd_ctl_new1(&mixer_procunit_ctl, cval); 1779 1772 if (! kctl) { 1780 - snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1773 + usb_audio_err(state->chip, "cannot malloc kcontrol\n"); 1781 1774 kfree(cval); 1782 1775 return -ENOMEM; 1783 1776 } ··· 1799 1792 append_ctl_name(kctl, " "); 1800 1793 append_ctl_name(kctl, valinfo->suffix); 1801 1794 1802 - snd_printdd(KERN_INFO "[%d] PU [%s] ch = %d, val = %d/%d\n", 1795 + usb_audio_dbg(state->chip, 1796 + "[%d] PU [%s] ch = %d, val = %d/%d\n", 1803 1797 cval->id, kctl->id.name, cval->channels, cval->min, cval->max); 1804 1798 if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0) 1805 1799 return err; ··· 1925 1917 char **namelist; 1926 1918 1927 1919 if (!desc->bNrInPins || desc->bLength < 5 + desc->bNrInPins) { 1928 - snd_printk(KERN_ERR "invalid SELECTOR UNIT descriptor %d\n", unitid); 1920 + usb_audio_err(state->chip, 1921 + "invalid SELECTOR UNIT descriptor %d\n", unitid); 1929 1922 return -EINVAL; 1930 1923 } 1931 1924 ··· 1944 1935 1945 1936 cval = kzalloc(sizeof(*cval), GFP_KERNEL); 1946 1937 if (! cval) { 1947 - snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1938 + usb_audio_err(state->chip, "cannot malloc kcontrol\n"); 1948 1939 return -ENOMEM; 1949 1940 } 1950 1941 cval->mixer = state->mixer; ··· 1963 1954 1964 1955 namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); 1965 1956 if (! namelist) { 1966 - snd_printk(KERN_ERR "cannot malloc\n"); 1957 + usb_audio_err(state->chip, "cannot malloc\n"); 1967 1958 kfree(cval); 1968 1959 return -ENOMEM; 1969 1960 } ··· 1973 1964 len = 0; 1974 1965 namelist[i] = kmalloc(MAX_ITEM_NAME_LEN, GFP_KERNEL); 1975 1966 if (! namelist[i]) { 1976 - snd_printk(KERN_ERR "cannot malloc\n"); 1967 + usb_audio_err(state->chip, "cannot malloc\n"); 1977 1968 while (i--) 1978 1969 kfree(namelist[i]); 1979 1970 kfree(namelist); ··· 1990 1981 1991 1982 kctl = snd_ctl_new1(&mixer_selectunit_ctl, cval); 1992 1983 if (! kctl) { 1993 - snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1984 + usb_audio_err(state->chip, "cannot malloc kcontrol\n"); 1994 1985 kfree(namelist); 1995 1986 kfree(cval); 1996 1987 return -ENOMEM; ··· 2018 2009 append_ctl_name(kctl, " Playback Source"); 2019 2010 } 2020 2011 2021 - snd_printdd(KERN_INFO "[%d] SU [%s] items = %d\n", 2012 + usb_audio_dbg(state->chip, "[%d] SU [%s] items = %d\n", 2022 2013 cval->id, kctl->id.name, desc->bNrInPins); 2023 2014 if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0) 2024 2015 return err; ··· 2040 2031 2041 2032 p1 = find_audio_control_unit(state, unitid); 2042 2033 if (!p1) { 2043 - snd_printk(KERN_ERR "usbaudio: unit %d not found!\n", unitid); 2034 + usb_audio_err(state->chip, "unit %d not found!\n", unitid); 2044 2035 return -EINVAL; 2045 2036 } 2046 2037 ··· 2070 2061 case UAC2_EXTENSION_UNIT_V2: 2071 2062 return parse_audio_extension_unit(state, unitid, p1); 2072 2063 default: 2073 - snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]); 2064 + usb_audio_err(state->chip, 2065 + "unit %u: unexpected type 0x%02x\n", unitid, p1[2]); 2074 2066 return -EINVAL; 2075 2067 } 2076 2068 } ··· 2219 2209 __u8 channel = value & 0xff; 2220 2210 2221 2211 if (channel >= MAX_CHANNELS) { 2222 - snd_printk(KERN_DEBUG "%s(): bogus channel number %d\n", 2223 - __func__, channel); 2212 + usb_audio_dbg(mixer->chip, 2213 + "%s(): bogus channel number %d\n", 2214 + __func__, channel); 2224 2215 return; 2225 2216 } 2226 2217 ··· 2250 2239 break; 2251 2240 2252 2241 default: 2253 - snd_printk(KERN_DEBUG "unknown attribute %d in interrupt\n", 2254 - attribute); 2242 + usb_audio_dbg(mixer->chip, 2243 + "unknown attribute %d in interrupt\n", 2244 + attribute); 2255 2245 break; 2256 2246 } /* switch */ 2257 2247 } ··· 2273 2261 for (status = urb->transfer_buffer; 2274 2262 len >= sizeof(*status); 2275 2263 len -= sizeof(*status), status++) { 2276 - snd_printd(KERN_DEBUG "status interrupt: %02x %02x\n", 2264 + dev_dbg(&urb->dev->dev, "status interrupt: %02x %02x\n", 2277 2265 status->bStatusType, 2278 2266 status->bOriginator); 2279 2267
+5 -5
sound/usb/mixer_quirks.c
··· 600 600 up_read(&mixer->chip->shutdown_rwsem); 601 601 602 602 if (ret < 0) { 603 - snd_printk(KERN_ERR 604 - "unable to issue vendor read request (ret = %d)", ret); 603 + dev_err(&dev->dev, 604 + "unable to issue vendor read request (ret = %d)", ret); 605 605 return ret; 606 606 } 607 607 ··· 631 631 up_read(&mixer->chip->shutdown_rwsem); 632 632 633 633 if (ret < 0) { 634 - snd_printk(KERN_ERR 635 - "unable to issue vendor write request (ret = %d)", ret); 634 + dev_err(&dev->dev, 635 + "unable to issue vendor write request (ret = %d)", ret); 636 636 return ret; 637 637 } 638 638 ··· 1699 1699 snd_usb_mixer_notify_id(mixer, mixer->rc_cfg->mute_mixer_id); 1700 1700 break; 1701 1701 default: 1702 - snd_printd(KERN_DEBUG "memory change in unknown unit %d\n", unitid); 1702 + usb_audio_dbg(mixer->chip, "memory change in unknown unit %d\n", unitid); 1703 1703 break; 1704 1704 } 1705 1705 }
+49 -34
sound/usb/pcm.c
··· 166 166 USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 167 167 UAC_EP_CS_ATTR_PITCH_CONTROL << 8, ep, 168 168 data, sizeof(data))) < 0) { 169 - snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH\n", 170 - dev->devnum, iface, ep); 169 + usb_audio_err(chip, "%d:%d: cannot set enable PITCH\n", 170 + iface, ep); 171 171 return err; 172 172 } 173 173 ··· 187 187 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, 188 188 UAC2_EP_CS_PITCH << 8, 0, 189 189 data, sizeof(data))) < 0) { 190 - snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH (v2)\n", 191 - dev->devnum, iface, fmt->altsetting); 190 + usb_audio_err(chip, "%d:%d: cannot set enable PITCH (v2)\n", 191 + iface, fmt->altsetting); 192 192 return err; 193 193 } 194 194 ··· 226 226 if (!test_and_set_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) { 227 227 struct snd_usb_endpoint *ep = subs->data_endpoint; 228 228 229 - snd_printdd(KERN_DEBUG "Starting data EP @%p\n", ep); 229 + dev_dbg(&subs->dev->dev, "Starting data EP @%p\n", ep); 230 230 231 231 ep->data_subs = subs; 232 232 err = snd_usb_endpoint_start(ep, can_sleep); ··· 247 247 subs->sync_endpoint->altsetting); 248 248 if (err < 0) { 249 249 clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); 250 - snd_printk(KERN_ERR 251 - "%d:%d:%d: cannot set interface (%d)\n", 252 - subs->dev->devnum, 250 + dev_err(&subs->dev->dev, 251 + "%d:%d: cannot set interface (%d)\n", 253 252 subs->sync_endpoint->iface, 254 253 subs->sync_endpoint->altsetting, err); 255 254 return -EIO; 256 255 } 257 256 } 258 257 259 - snd_printdd(KERN_DEBUG "Starting sync EP @%p\n", ep); 258 + dev_dbg(&subs->dev->dev, "Starting sync EP @%p\n", ep); 260 259 261 260 ep->sync_slave = subs->data_endpoint; 262 261 err = snd_usb_endpoint_start(ep, can_sleep); ··· 409 410 if ((get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC || 410 411 (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 411 412 get_endpoint(alts, 1)->bSynchAddress != 0)) { 412 - snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. bmAttributes %02x, bLength %d, bSynchAddress %02x\n", 413 - dev->devnum, fmt->iface, fmt->altsetting, 413 + dev_err(&dev->dev, 414 + "%d:%d : invalid sync pipe. bmAttributes %02x, bLength %d, bSynchAddress %02x\n", 415 + fmt->iface, fmt->altsetting, 414 416 get_endpoint(alts, 1)->bmAttributes, 415 417 get_endpoint(alts, 1)->bLength, 416 418 get_endpoint(alts, 1)->bSynchAddress); ··· 421 421 if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 422 422 ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) || 423 423 (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) { 424 - snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n", 425 - dev->devnum, fmt->iface, fmt->altsetting, 424 + dev_err(&dev->dev, 425 + "%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n", 426 + fmt->iface, fmt->altsetting, 426 427 is_playback, ep, get_endpoint(alts, 0)->bSynchAddress); 427 428 return -EINVAL; 428 429 } ··· 470 469 if (subs->interface >= 0 && subs->interface != fmt->iface) { 471 470 err = usb_set_interface(subs->dev, subs->interface, 0); 472 471 if (err < 0) { 473 - snd_printk(KERN_ERR "%d:%d:%d: return to setting 0 failed (%d)\n", 474 - dev->devnum, fmt->iface, fmt->altsetting, err); 472 + dev_err(&dev->dev, 473 + "%d:%d: return to setting 0 failed (%d)\n", 474 + fmt->iface, fmt->altsetting, err); 475 475 return -EIO; 476 476 } 477 477 subs->interface = -1; ··· 484 482 subs->altset_idx != fmt->altset_idx) { 485 483 err = usb_set_interface(dev, fmt->iface, fmt->altsetting); 486 484 if (err < 0) { 487 - snd_printk(KERN_ERR "%d:%d:%d: usb_set_interface failed (%d)\n", 488 - dev->devnum, fmt->iface, fmt->altsetting, err); 485 + dev_err(&dev->dev, 486 + "%d:%d: usb_set_interface failed (%d)\n", 487 + fmt->iface, fmt->altsetting, err); 489 488 return -EIO; 490 489 } 491 - snd_printdd(KERN_INFO "setting usb interface %d:%d\n", 492 - fmt->iface, fmt->altsetting); 490 + dev_dbg(&dev->dev, "setting usb interface %d:%d\n", 491 + fmt->iface, fmt->altsetting); 493 492 subs->interface = fmt->iface; 494 493 subs->altset_idx = fmt->altset_idx; 495 494 ··· 526 523 * - Requested PCM format is not supported. 527 524 * - Requested sample rate is not supported. 528 525 */ 529 - static int match_endpoint_audioformats(struct audioformat *fp, 530 - struct audioformat *match, int rate, 531 - snd_pcm_format_t pcm_format) 526 + static int match_endpoint_audioformats(struct snd_usb_substream *subs, 527 + struct audioformat *fp, 528 + struct audioformat *match, int rate, 529 + snd_pcm_format_t pcm_format) 532 530 { 533 531 int i; 534 532 int score = 0; 535 533 536 534 if (fp->channels < 1) { 537 - snd_printdd("%s: (fmt @%p) no channels\n", __func__, fp); 535 + dev_dbg(&subs->dev->dev, 536 + "%s: (fmt @%p) no channels\n", __func__, fp); 538 537 return 0; 539 538 } 540 539 541 540 if (!(fp->formats & pcm_format_to_bits(pcm_format))) { 542 - snd_printdd("%s: (fmt @%p) no match for format %d\n", __func__, 541 + dev_dbg(&subs->dev->dev, 542 + "%s: (fmt @%p) no match for format %d\n", __func__, 543 543 fp, pcm_format); 544 544 return 0; 545 545 } ··· 554 548 } 555 549 } 556 550 if (!score) { 557 - snd_printdd("%s: (fmt @%p) no match for rate %d\n", __func__, 551 + dev_dbg(&subs->dev->dev, 552 + "%s: (fmt @%p) no match for rate %d\n", __func__, 558 553 fp, rate); 559 554 return 0; 560 555 } ··· 563 556 if (fp->channels == match->channels) 564 557 score++; 565 558 566 - snd_printdd("%s: (fmt @%p) score %d\n", __func__, fp, score); 559 + dev_dbg(&subs->dev->dev, 560 + "%s: (fmt @%p) score %d\n", __func__, fp, score); 567 561 568 562 return score; 569 563 } ··· 595 587 596 588 /* Try to find the best matching audioformat. */ 597 589 list_for_each_entry(fp, &sync_subs->fmt_list, list) { 598 - int score = match_endpoint_audioformats(fp, subs->cur_audiofmt, 590 + int score = match_endpoint_audioformats(subs, 591 + fp, subs->cur_audiofmt, 599 592 subs->cur_rate, subs->pcm_format); 600 593 601 594 if (score > cur_score) { ··· 606 597 } 607 598 608 599 if (unlikely(sync_fp == NULL)) { 609 - snd_printk(KERN_ERR "%s: no valid audioformat for sync ep %x found\n", 600 + dev_err(&subs->dev->dev, 601 + "%s: no valid audioformat for sync ep %x found\n", 610 602 __func__, sync_subs->ep_num); 611 603 return -EINVAL; 612 604 } ··· 619 609 if (sync_fp->channels != subs->channels) { 620 610 sync_period_bytes = (subs->period_bytes / subs->channels) * 621 611 sync_fp->channels; 622 - snd_printdd("%s: adjusted sync ep period bytes (%d -> %d)\n", 612 + dev_dbg(&subs->dev->dev, 613 + "%s: adjusted sync ep period bytes (%d -> %d)\n", 623 614 __func__, subs->period_bytes, sync_period_bytes); 624 615 } 625 616 ··· 696 685 697 686 fmt = find_format(subs); 698 687 if (!fmt) { 699 - snd_printd(KERN_DEBUG "cannot set format: format = %#x, rate = %d, channels = %d\n", 688 + dev_dbg(&subs->dev->dev, 689 + "cannot set format: format = %#x, rate = %d, channels = %d\n", 700 690 subs->pcm_format, subs->cur_rate, subs->channels); 701 691 return -EINVAL; 702 692 } ··· 754 742 int ret; 755 743 756 744 if (! subs->cur_audiofmt) { 757 - snd_printk(KERN_ERR "usbaudio: no format is specified!\n"); 745 + dev_err(&subs->dev->dev, "no format is specified!\n"); 758 746 return -ENXIO; 759 747 } 760 748 ··· 1247 1235 for (i = 0; i < urb->number_of_packets; i++) { 1248 1236 cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset + subs->pkt_offset_adj; 1249 1237 if (urb->iso_frame_desc[i].status && printk_ratelimit()) { 1250 - snd_printdd(KERN_ERR "frame %d active: %d\n", i, urb->iso_frame_desc[i].status); 1238 + dev_dbg(&subs->dev->dev, "frame %d active: %d\n", 1239 + i, urb->iso_frame_desc[i].status); 1251 1240 // continue; 1252 1241 } 1253 1242 bytes = urb->iso_frame_desc[i].actual_length; ··· 1258 1245 if (bytes % (runtime->sample_bits >> 3) != 0) { 1259 1246 int oldbytes = bytes; 1260 1247 bytes = frames * stride; 1261 - snd_printdd(KERN_ERR "Corrected urb data len. %d->%d\n", 1248 + dev_warn(&subs->dev->dev, 1249 + "Corrected urb data len. %d->%d\n", 1262 1250 oldbytes, bytes); 1263 1251 } 1264 1252 /* update the current pointer */ ··· 1502 1488 * on two reads of a counter updated every ms. 1503 1489 */ 1504 1490 if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2) 1505 - snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n", 1491 + dev_dbg(&subs->dev->dev, 1492 + "delay: estimated %d, actual %d\n", 1506 1493 est_delay, subs->last_delay); 1507 1494 1508 1495 if (!subs->running) {
+28 -24
sound/usb/quirks.c
··· 110 110 altsd = get_iface_desc(alts); 111 111 err = snd_usb_parse_audio_interface(chip, altsd->bInterfaceNumber); 112 112 if (err < 0) { 113 - snd_printk(KERN_ERR "cannot setup if %d: error %d\n", 113 + usb_audio_err(chip, "cannot setup if %d: error %d\n", 114 114 altsd->bInterfaceNumber, err); 115 115 return err; 116 116 } ··· 135 135 136 136 fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL); 137 137 if (!fp) { 138 - snd_printk(KERN_ERR "cannot memdup\n"); 138 + usb_audio_err(chip, "cannot memdup\n"); 139 139 return -ENOMEM; 140 140 } 141 141 if (fp->nr_rates > MAX_NR_RATES) { ··· 464 464 fp->rate_max = fp->rate_min = 96000; 465 465 break; 466 466 default: 467 - snd_printk(KERN_ERR "unknown sample rate\n"); 467 + usb_audio_err(chip, "unknown sample rate\n"); 468 468 kfree(fp); 469 469 return -ENXIO; 470 470 } ··· 536 536 if (quirk->type < QUIRK_TYPE_COUNT) { 537 537 return quirk_funcs[quirk->type](chip, iface, driver, quirk); 538 538 } else { 539 - snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); 539 + usb_audio_err(chip, "invalid quirk type %d\n", quirk->type); 540 540 return -ENXIO; 541 541 } 542 542 } ··· 555 555 556 556 if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD || 557 557 le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_NEW) { 558 - snd_printdd("sending Extigy boot sequence...\n"); 558 + dev_dbg(&dev->dev, "sending Extigy boot sequence...\n"); 559 559 /* Send message to force it to reconnect with full interface. */ 560 560 err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev,0), 561 561 0x10, 0x43, 0x0001, 0x000a, NULL, 0); 562 - if (err < 0) snd_printdd("error sending boot message: %d\n", err); 562 + if (err < 0) 563 + dev_dbg(&dev->dev, "error sending boot message: %d\n", err); 563 564 err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, 564 565 &dev->descriptor, sizeof(dev->descriptor)); 565 566 config = dev->actconfig; 566 - if (err < 0) snd_printdd("error usb_get_descriptor: %d\n", err); 567 + if (err < 0) 568 + dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err); 567 569 err = usb_reset_configuration(dev); 568 - if (err < 0) snd_printdd("error usb_reset_configuration: %d\n", err); 569 - snd_printdd("extigy_boot: new boot length = %d\n", 570 + if (err < 0) 571 + dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err); 572 + dev_dbg(&dev->dev, "extigy_boot: new boot length = %d\n", 570 573 le16_to_cpu(get_cfg_desc(config)->wTotalLength)); 571 574 return -ENODEV; /* quit this anyway */ 572 575 } ··· 597 594 int err; 598 595 599 596 if (dev->actconfig->desc.bConfigurationValue == 1) { 600 - snd_printk(KERN_INFO "usb-audio: " 597 + dev_info(&dev->dev, 601 598 "Fast Track Pro switching to config #2\n"); 602 599 /* This function has to be available by the usb core module. 603 600 * if it is not avialable the boot quirk has to be left out ··· 606 603 */ 607 604 err = usb_driver_set_configuration(dev, 2); 608 605 if (err < 0) 609 - snd_printdd("error usb_driver_set_configuration: %d\n", 610 - err); 606 + dev_dbg(&dev->dev, 607 + "error usb_driver_set_configuration: %d\n", 608 + err); 611 609 /* Always return an error, so that we stop creating a device 612 610 that will just be destroyed and recreated with a new 613 611 configuration */ 614 612 return -ENODEV; 615 613 } else 616 - snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); 614 + dev_info(&dev->dev, "Fast Track Pro config OK\n"); 617 615 618 616 return 0; 619 617 } ··· 783 779 fwsize = le16_to_cpu(get_cfg_desc(config)->wTotalLength); 784 780 785 781 if (fwsize != MBOX2_FIRMWARE_SIZE) { 786 - snd_printk(KERN_ERR "usb-audio: Invalid firmware size=%d.\n", fwsize); 782 + dev_err(&dev->dev, "Invalid firmware size=%d.\n", fwsize); 787 783 return -ENODEV; 788 784 } 789 785 790 - snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n"); 786 + dev_dbg(&dev->dev, "Sending Digidesign Mbox 2 boot sequence...\n"); 791 787 792 788 count = 0; 793 789 bootresponse[0] = MBOX2_BOOT_LOADING; ··· 798 794 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012); 799 795 if (bootresponse[0] == MBOX2_BOOT_READY) 800 796 break; 801 - snd_printd("usb-audio: device not ready, resending boot sequence...\n"); 797 + dev_dbg(&dev->dev, "device not ready, resending boot sequence...\n"); 802 798 count++; 803 799 } 804 800 805 801 if (bootresponse[0] != MBOX2_BOOT_READY) { 806 - snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]); 802 + dev_err(&dev->dev, "Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]); 807 803 return -ENODEV; 808 804 } 809 805 810 - snd_printdd("usb-audio: device initialised!\n"); 806 + dev_dbg(&dev->dev, "device initialised!\n"); 811 807 812 808 err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, 813 809 &dev->descriptor, sizeof(dev->descriptor)); 814 810 config = dev->actconfig; 815 811 if (err < 0) 816 - snd_printd("error usb_get_descriptor: %d\n", err); 812 + dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err); 817 813 818 814 err = usb_reset_configuration(dev); 819 815 if (err < 0) 820 - snd_printd("error usb_reset_configuration: %d\n", err); 821 - snd_printdd("mbox2_boot: new boot length = %d\n", 816 + dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err); 817 + dev_dbg(&dev->dev, "mbox2_boot: new boot length = %d\n", 822 818 le16_to_cpu(get_cfg_desc(config)->wTotalLength)); 823 819 824 820 mbox2_setup_48_24_magic(dev); 825 821 826 - snd_printk(KERN_INFO "usb-audio: Digidesign Mbox 2: 24bit 48kHz"); 822 + dev_info(&dev->dev, "Digidesign Mbox 2: 24bit 48kHz"); 827 823 828 824 return 0; /* Successful boot */ 829 825 } ··· 869 865 return 1; /* skip this altsetting */ 870 866 } 871 867 } 872 - snd_printdd(KERN_INFO 868 + usb_audio_dbg(chip, 873 869 "using altsetting %d for interface %d config %d\n", 874 870 altno, iface, chip->setup); 875 871 return 0; /* keep this altsetting */ ··· 936 932 return 1; 937 933 } 938 934 939 - snd_printdd(KERN_INFO 935 + usb_audio_dbg(chip, 940 936 "using altsetting %d for interface %d config %d\n", 941 937 altno, iface, chip->setup); 942 938 return 0; /* keep this altsetting */
+28 -22
sound/usb/stream.c
··· 411 411 412 412 if (!csep || csep->bLength < 7 || 413 413 csep->bDescriptorSubtype != UAC_EP_GENERAL) { 414 - snd_printk(KERN_WARNING "%d:%u:%d : no or invalid" 415 - " class specific endpoint descriptor\n", 416 - chip->dev->devnum, iface_no, 417 - altsd->bAlternateSetting); 414 + usb_audio_warn(chip, 415 + "%u:%d : no or invalid class specific endpoint descriptor\n", 416 + iface_no, altsd->bAlternateSetting); 418 417 return 0; 419 418 } 420 419 ··· 532 533 /* get audio formats */ 533 534 switch (protocol) { 534 535 default: 535 - snd_printdd(KERN_WARNING "%d:%u:%d: unknown interface protocol %#02x, assuming v1\n", 536 - dev->devnum, iface_no, altno, protocol); 536 + dev_dbg(&dev->dev, "%u:%d: unknown interface protocol %#02x, assuming v1\n", 537 + iface_no, altno, protocol); 537 538 protocol = UAC_VERSION_1; 538 539 /* fall through */ 539 540 ··· 543 544 struct uac_input_terminal_descriptor *iterm; 544 545 545 546 if (!as) { 546 - snd_printk(KERN_ERR "%d:%u:%d : UAC_AS_GENERAL descriptor not found\n", 547 - dev->devnum, iface_no, altno); 547 + dev_err(&dev->dev, 548 + "%u:%d : UAC_AS_GENERAL descriptor not found\n", 549 + iface_no, altno); 548 550 continue; 549 551 } 550 552 551 553 if (as->bLength < sizeof(*as)) { 552 - snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_AS_GENERAL desc\n", 553 - dev->devnum, iface_no, altno); 554 + dev_err(&dev->dev, 555 + "%u:%d : invalid UAC_AS_GENERAL desc\n", 556 + iface_no, altno); 554 557 continue; 555 558 } 556 559 ··· 575 574 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL); 576 575 577 576 if (!as) { 578 - snd_printk(KERN_ERR "%d:%u:%d : UAC_AS_GENERAL descriptor not found\n", 579 - dev->devnum, iface_no, altno); 577 + dev_err(&dev->dev, 578 + "%u:%d : UAC_AS_GENERAL descriptor not found\n", 579 + iface_no, altno); 580 580 continue; 581 581 } 582 582 583 583 if (as->bLength < sizeof(*as)) { 584 - snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_AS_GENERAL desc\n", 585 - dev->devnum, iface_no, altno); 584 + dev_err(&dev->dev, 585 + "%u:%d : invalid UAC_AS_GENERAL desc\n", 586 + iface_no, altno); 586 587 continue; 587 588 } 588 589 ··· 610 607 break; 611 608 } 612 609 613 - snd_printk(KERN_ERR "%d:%u:%d : bogus bTerminalLink %d\n", 614 - dev->devnum, iface_no, altno, as->bTerminalLink); 610 + dev_err(&dev->dev, 611 + "%u:%d : bogus bTerminalLink %d\n", 612 + iface_no, altno, as->bTerminalLink); 615 613 continue; 616 614 } 617 615 } ··· 620 616 /* get format type */ 621 617 fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_FORMAT_TYPE); 622 618 if (!fmt) { 623 - snd_printk(KERN_ERR "%d:%u:%d : no UAC_FORMAT_TYPE desc\n", 624 - dev->devnum, iface_no, altno); 619 + dev_err(&dev->dev, 620 + "%u:%d : no UAC_FORMAT_TYPE desc\n", 621 + iface_no, altno); 625 622 continue; 626 623 } 627 624 if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) || 628 625 ((protocol == UAC_VERSION_2) && (fmt->bLength < 6))) { 629 - snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", 630 - dev->devnum, iface_no, altno); 626 + dev_err(&dev->dev, 627 + "%u:%d : invalid UAC_FORMAT_TYPE desc\n", 628 + iface_no, altno); 631 629 continue; 632 630 } 633 631 ··· 650 644 651 645 fp = kzalloc(sizeof(*fp), GFP_KERNEL); 652 646 if (! fp) { 653 - snd_printk(KERN_ERR "cannot malloc\n"); 647 + dev_err(&dev->dev, "cannot malloc\n"); 654 648 return -ENOMEM; 655 649 } 656 650 ··· 713 707 chconfig = 0; 714 708 fp->chmap = convert_chmap(fp->channels, chconfig, protocol); 715 709 716 - snd_printdd(KERN_INFO "%d:%u:%d: add audio endpoint %#x\n", dev->devnum, iface_no, altno, fp->endpoint); 710 + dev_dbg(&dev->dev, "%u:%d: add audio endpoint %#x\n", iface_no, altno, fp->endpoint); 717 711 err = snd_usb_add_audio_stream(chip, stream, fp); 718 712 if (err < 0) { 719 713 kfree(fp->rate_table);
+9
sound/usb/usbaudio.h
··· 60 60 struct usb_host_interface *ctrl_intf; /* the audio control interface */ 61 61 }; 62 62 63 + #define usb_audio_err(chip, fmt, args...) \ 64 + dev_err(&(chip)->dev->dev, fmt, ##args) 65 + #define usb_audio_warn(chip, fmt, args...) \ 66 + dev_warn(&(chip)->dev->dev, fmt, ##args) 67 + #define usb_audio_info(chip, fmt, args...) \ 68 + dev_info(&(chip)->dev->dev, fmt, ##args) 69 + #define usb_audio_dbg(chip, fmt, args...) \ 70 + dev_dbg(&(chip)->dev->dev, fmt, ##args) 71 + 63 72 /* 64 73 * Information about devices with broken descriptors 65 74 */