aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/card.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-26 07:02:17 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-26 10:45:34 -0500
commit0ba41d917eeb87f608cf147f870ff2f4c1056bab (patch)
treee848ad3bb355ec92150b7f22eab66e88d7eee34b /sound/usb/card.c
parent6436bcf6a4a35ae83af9ff3c250435e5fd001205 (diff)
ALSA: usb-audio: Use standard printk helpers
Convert with dev_err() and co from snd_printk(), etc. As there are too deep indirections (e.g. ep->chip->dev->dev), a few new local macros, usb_audio_err() & co, are introduced. Also, the device numbers in some messages are dropped, as they are shown in the prefix automatically. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/card.c')
-rw-r--r--sound/usb/card.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 0cfdc2d3b631..893d5a1afc3c 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -139,8 +139,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
139 struct usb_interface *iface = usb_ifnum_to_if(dev, interface); 139 struct usb_interface *iface = usb_ifnum_to_if(dev, interface);
140 140
141 if (!iface) { 141 if (!iface) {
142 snd_printk(KERN_ERR "%d:%u:%d : does not exist\n", 142 dev_err(&dev->dev, "%u:%d : does not exist\n",
143 dev->devnum, ctrlif, interface); 143 ctrlif, interface);
144 return -EINVAL; 144 return -EINVAL;
145 } 145 }
146 146
@@ -165,8 +165,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
165 } 165 }
166 166
167 if (usb_interface_claimed(iface)) { 167 if (usb_interface_claimed(iface)) {
168 snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n", 168 dev_dbg(&dev->dev, "%d:%d: skipping, already claimed\n",
169 dev->devnum, ctrlif, interface); 169 ctrlif, interface);
170 return -EINVAL; 170 return -EINVAL;
171 } 171 }
172 172
@@ -176,8 +176,9 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
176 int err = snd_usbmidi_create(chip->card, iface, 176 int err = snd_usbmidi_create(chip->card, iface,
177 &chip->midi_list, NULL); 177 &chip->midi_list, NULL);
178 if (err < 0) { 178 if (err < 0) {
179 snd_printk(KERN_ERR "%d:%u:%d: cannot create sequencer device\n", 179 dev_err(&dev->dev,
180 dev->devnum, ctrlif, interface); 180 "%u:%d: cannot create sequencer device\n",
181 ctrlif, interface);
181 return -EINVAL; 182 return -EINVAL;
182 } 183 }
183 usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L); 184 usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
@@ -188,14 +189,15 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
188 if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && 189 if ((altsd->bInterfaceClass != USB_CLASS_AUDIO &&
189 altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || 190 altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) ||
190 altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING) { 191 altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING) {
191 snd_printdd(KERN_ERR "%d:%u:%d: skipping non-supported interface %d\n", 192 dev_dbg(&dev->dev,
192 dev->devnum, ctrlif, interface, altsd->bInterfaceClass); 193 "%u:%d: skipping non-supported interface %d\n",
194 ctrlif, interface, altsd->bInterfaceClass);
193 /* skip non-supported classes */ 195 /* skip non-supported classes */
194 return -EINVAL; 196 return -EINVAL;
195 } 197 }
196 198
197 if (snd_usb_get_speed(dev) == USB_SPEED_LOW) { 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 return -EINVAL; 201 return -EINVAL;
200 } 202 }
201 203
@@ -228,26 +230,27 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
228 protocol = altsd->bInterfaceProtocol; 230 protocol = altsd->bInterfaceProtocol;
229 231
230 if (!control_header) { 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 return -EINVAL; 234 return -EINVAL;
233 } 235 }
234 236
235 switch (protocol) { 237 switch (protocol) {
236 default: 238 default:
237 snd_printdd(KERN_WARNING "unknown interface protocol %#02x, assuming v1\n", 239 dev_warn(&dev->dev,
238 protocol); 240 "unknown interface protocol %#02x, assuming v1\n",
241 protocol);
239 /* fall through */ 242 /* fall through */
240 243
241 case UAC_VERSION_1: { 244 case UAC_VERSION_1: {
242 struct uac1_ac_header_descriptor *h1 = control_header; 245 struct uac1_ac_header_descriptor *h1 = control_header;
243 246
244 if (!h1->bInCollection) { 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 return -EINVAL; 249 return -EINVAL;
247 } 250 }
248 251
249 if (h1->bLength < sizeof(*h1) + h1->bInCollection) { 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 return -EINVAL; 254 return -EINVAL;
252 } 255 }
253 256
@@ -277,7 +280,7 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
277 } 280 }
278 281
279 if (!assoc) { 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 return -EINVAL; 284 return -EINVAL;
282 } 285 }
283 286
@@ -351,14 +354,14 @@ static int snd_usb_audio_create(struct usb_interface *intf,
351 case USB_SPEED_SUPER: 354 case USB_SPEED_SUPER:
352 break; 355 break;
353 default: 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 return -ENXIO; 358 return -ENXIO;
356 } 359 }
357 360
358 err = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE, 361 err = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE,
359 0, &card); 362 0, &card);
360 if (err < 0) { 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 return err; 365 return err;
363 } 366 }
364 367
@@ -499,7 +502,7 @@ snd_usb_audio_probe(struct usb_device *dev,
499 for (i = 0; i < SNDRV_CARDS; i++) { 502 for (i = 0; i < SNDRV_CARDS; i++) {
500 if (usb_chip[i] && usb_chip[i]->dev == dev) { 503 if (usb_chip[i] && usb_chip[i]->dev == dev) {
501 if (usb_chip[i]->shutdown) { 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 goto __error; 506 goto __error;
504 } 507 }
505 chip = usb_chip[i]; 508 chip = usb_chip[i];
@@ -523,7 +526,7 @@ snd_usb_audio_probe(struct usb_device *dev,
523 break; 526 break;
524 } 527 }
525 if (!chip) { 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 goto __error; 530 goto __error;
528 } 531 }
529 } 532 }