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