diff options
author | Daniel Mack <zonque@gmail.com> | 2013-03-03 14:46:22 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-03-04 03:57:26 -0500 |
commit | f1f6b8f65ff08afed4532b88de1a3bbea773787f (patch) | |
tree | 239b592c8d087738c05d0ebe1d192330d4fa69db /sound/usb/caiaq/device.c | |
parent | 1c8470ce311c6b2b49a71a02961c360d04ed28b2 (diff) |
ALSA: snd-usb-caiaq: switch to dev_*() logging
Get rid of the proprietary functions log() and debug() and use the
generic dev_*() approach. A macro is needed to cast a cdev to a struct
device *.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/caiaq/device.c')
-rw-r--r-- | sound/usb/caiaq/device.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index 45c3853b2a65..d898f737c07e 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/moduleparam.h> | 22 | #include <linux/moduleparam.h> |
23 | #include <linux/device.h> | ||
23 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
24 | #include <linux/module.h> | 25 | #include <linux/module.h> |
25 | #include <linux/init.h> | 26 | #include <linux/init.h> |
@@ -159,10 +160,11 @@ static void usb_ep1_command_reply_dispatch (struct urb* urb) | |||
159 | { | 160 | { |
160 | int ret; | 161 | int ret; |
161 | struct snd_usb_caiaqdev *cdev = urb->context; | 162 | struct snd_usb_caiaqdev *cdev = urb->context; |
163 | struct device *dev = caiaqdev_to_dev(cdev); | ||
162 | unsigned char *buf = urb->transfer_buffer; | 164 | unsigned char *buf = urb->transfer_buffer; |
163 | 165 | ||
164 | if (urb->status || !cdev) { | 166 | if (urb->status || !cdev) { |
165 | log("received EP1 urb->status = %i\n", urb->status); | 167 | dev_warn(dev, "received EP1 urb->status = %i\n", urb->status); |
166 | return; | 168 | return; |
167 | } | 169 | } |
168 | 170 | ||
@@ -170,7 +172,7 @@ static void usb_ep1_command_reply_dispatch (struct urb* urb) | |||
170 | case EP1_CMD_GET_DEVICE_INFO: | 172 | case EP1_CMD_GET_DEVICE_INFO: |
171 | memcpy(&cdev->spec, buf+1, sizeof(struct caiaq_device_spec)); | 173 | memcpy(&cdev->spec, buf+1, sizeof(struct caiaq_device_spec)); |
172 | cdev->spec.fw_version = le16_to_cpu(cdev->spec.fw_version); | 174 | cdev->spec.fw_version = le16_to_cpu(cdev->spec.fw_version); |
173 | debug("device spec (firmware %d): audio: %d in, %d out, " | 175 | dev_dbg(dev, "device spec (firmware %d): audio: %d in, %d out, " |
174 | "MIDI: %d in, %d out, data alignment %d\n", | 176 | "MIDI: %d in, %d out, data alignment %d\n", |
175 | cdev->spec.fw_version, | 177 | cdev->spec.fw_version, |
176 | cdev->spec.num_analog_audio_in, | 178 | cdev->spec.num_analog_audio_in, |
@@ -209,7 +211,7 @@ static void usb_ep1_command_reply_dispatch (struct urb* urb) | |||
209 | cdev->ep1_in_urb.actual_length = 0; | 211 | cdev->ep1_in_urb.actual_length = 0; |
210 | ret = usb_submit_urb(&cdev->ep1_in_urb, GFP_ATOMIC); | 212 | ret = usb_submit_urb(&cdev->ep1_in_urb, GFP_ATOMIC); |
211 | if (ret < 0) | 213 | if (ret < 0) |
212 | log("unable to submit urb. OOM!?\n"); | 214 | dev_err(dev, "unable to submit urb. OOM!?\n"); |
213 | } | 215 | } |
214 | 216 | ||
215 | int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *cdev, | 217 | int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *cdev, |
@@ -239,6 +241,7 @@ int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *cdev, | |||
239 | { | 241 | { |
240 | int ret; | 242 | int ret; |
241 | char tmp[5]; | 243 | char tmp[5]; |
244 | struct device *dev = caiaqdev_to_dev(cdev); | ||
242 | 245 | ||
243 | switch (rate) { | 246 | switch (rate) { |
244 | case 44100: tmp[0] = SAMPLERATE_44100; break; | 247 | case 44100: tmp[0] = SAMPLERATE_44100; break; |
@@ -259,7 +262,7 @@ int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *cdev, | |||
259 | tmp[3] = bpp >> 8; | 262 | tmp[3] = bpp >> 8; |
260 | tmp[4] = 1; /* packets per microframe */ | 263 | tmp[4] = 1; /* packets per microframe */ |
261 | 264 | ||
262 | debug("setting audio params: %d Hz, %d bits, %d bpp\n", | 265 | dev_dbg(dev, "setting audio params: %d Hz, %d bits, %d bpp\n", |
263 | rate, depth, bpp); | 266 | rate, depth, bpp); |
264 | 267 | ||
265 | cdev->audio_parm_answer = -1; | 268 | cdev->audio_parm_answer = -1; |
@@ -274,7 +277,7 @@ int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *cdev, | |||
274 | return -EPIPE; | 277 | return -EPIPE; |
275 | 278 | ||
276 | if (cdev->audio_parm_answer != 1) | 279 | if (cdev->audio_parm_answer != 1) |
277 | debug("unable to set the device's audio params\n"); | 280 | dev_dbg(dev, "unable to set the device's audio params\n"); |
278 | else | 281 | else |
279 | cdev->bpp = bpp; | 282 | cdev->bpp = bpp; |
280 | 283 | ||
@@ -293,6 +296,7 @@ static void setup_card(struct snd_usb_caiaqdev *cdev) | |||
293 | { | 296 | { |
294 | int ret; | 297 | int ret; |
295 | char val[4]; | 298 | char val[4]; |
299 | struct device *dev = caiaqdev_to_dev(cdev); | ||
296 | 300 | ||
297 | /* device-specific startup specials */ | 301 | /* device-specific startup specials */ |
298 | switch (cdev->chip.usb_id) { | 302 | switch (cdev->chip.usb_id) { |
@@ -346,32 +350,32 @@ static void setup_card(struct snd_usb_caiaqdev *cdev) | |||
346 | cdev->spec.num_digital_audio_in > 0) { | 350 | cdev->spec.num_digital_audio_in > 0) { |
347 | ret = snd_usb_caiaq_audio_init(cdev); | 351 | ret = snd_usb_caiaq_audio_init(cdev); |
348 | if (ret < 0) | 352 | if (ret < 0) |
349 | log("Unable to set up audio system (ret=%d)\n", ret); | 353 | dev_err(dev, "Unable to set up audio system (ret=%d)\n", ret); |
350 | } | 354 | } |
351 | 355 | ||
352 | if (cdev->spec.num_midi_in + | 356 | if (cdev->spec.num_midi_in + |
353 | cdev->spec.num_midi_out > 0) { | 357 | cdev->spec.num_midi_out > 0) { |
354 | ret = snd_usb_caiaq_midi_init(cdev); | 358 | ret = snd_usb_caiaq_midi_init(cdev); |
355 | if (ret < 0) | 359 | if (ret < 0) |
356 | log("Unable to set up MIDI system (ret=%d)\n", ret); | 360 | dev_err(dev, "Unable to set up MIDI system (ret=%d)\n", ret); |
357 | } | 361 | } |
358 | 362 | ||
359 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT | 363 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT |
360 | ret = snd_usb_caiaq_input_init(cdev); | 364 | ret = snd_usb_caiaq_input_init(cdev); |
361 | if (ret < 0) | 365 | if (ret < 0) |
362 | log("Unable to set up input system (ret=%d)\n", ret); | 366 | dev_err(dev, "Unable to set up input system (ret=%d)\n", ret); |
363 | #endif | 367 | #endif |
364 | 368 | ||
365 | /* finally, register the card and all its sub-instances */ | 369 | /* finally, register the card and all its sub-instances */ |
366 | ret = snd_card_register(cdev->chip.card); | 370 | ret = snd_card_register(cdev->chip.card); |
367 | if (ret < 0) { | 371 | if (ret < 0) { |
368 | log("snd_card_register() returned %d\n", ret); | 372 | dev_err(dev, "snd_card_register() returned %d\n", ret); |
369 | snd_card_free(cdev->chip.card); | 373 | snd_card_free(cdev->chip.card); |
370 | } | 374 | } |
371 | 375 | ||
372 | ret = snd_usb_caiaq_control_init(cdev); | 376 | ret = snd_usb_caiaq_control_init(cdev); |
373 | if (ret < 0) | 377 | if (ret < 0) |
374 | log("Unable to set up control system (ret=%d)\n", ret); | 378 | dev_err(dev, "Unable to set up control system (ret=%d)\n", ret); |
375 | } | 379 | } |
376 | 380 | ||
377 | static int create_card(struct usb_device *usb_dev, | 381 | static int create_card(struct usb_device *usb_dev, |
@@ -412,10 +416,11 @@ static int init_card(struct snd_usb_caiaqdev *cdev) | |||
412 | char *c, usbpath[32]; | 416 | char *c, usbpath[32]; |
413 | struct usb_device *usb_dev = cdev->chip.dev; | 417 | struct usb_device *usb_dev = cdev->chip.dev; |
414 | struct snd_card *card = cdev->chip.card; | 418 | struct snd_card *card = cdev->chip.card; |
419 | struct device *dev = caiaqdev_to_dev(cdev); | ||
415 | int err, len; | 420 | int err, len; |
416 | 421 | ||
417 | if (usb_set_interface(usb_dev, 0, 1) != 0) { | 422 | if (usb_set_interface(usb_dev, 0, 1) != 0) { |
418 | log("can't set alt interface.\n"); | 423 | dev_err(dev, "can't set alt interface.\n"); |
419 | return -EIO; | 424 | return -EIO; |
420 | } | 425 | } |
421 | 426 | ||
@@ -473,8 +478,7 @@ static int init_card(struct snd_usb_caiaqdev *cdev) | |||
473 | } | 478 | } |
474 | 479 | ||
475 | usb_make_path(usb_dev, usbpath, sizeof(usbpath)); | 480 | usb_make_path(usb_dev, usbpath, sizeof(usbpath)); |
476 | snprintf(card->longname, sizeof(card->longname), | 481 | snprintf(card->longname, sizeof(card->longname), "%s %s (%s)", |
477 | "%s %s (%s)", | ||
478 | cdev->vendor_name, cdev->product_name, usbpath); | 482 | cdev->vendor_name, cdev->product_name, usbpath); |
479 | 483 | ||
480 | setup_card(cdev); | 484 | setup_card(cdev); |
@@ -496,7 +500,7 @@ static int snd_probe(struct usb_interface *intf, | |||
496 | usb_set_intfdata(intf, card); | 500 | usb_set_intfdata(intf, card); |
497 | ret = init_card(caiaqdev(card)); | 501 | ret = init_card(caiaqdev(card)); |
498 | if (ret < 0) { | 502 | if (ret < 0) { |
499 | log("unable to init card! (ret=%d)\n", ret); | 503 | dev_err(&usb_dev->dev, "unable to init card! (ret=%d)\n", ret); |
500 | snd_card_free(card); | 504 | snd_card_free(card); |
501 | return ret; | 505 | return ret; |
502 | } | 506 | } |
@@ -506,15 +510,16 @@ static int snd_probe(struct usb_interface *intf, | |||
506 | 510 | ||
507 | static void snd_disconnect(struct usb_interface *intf) | 511 | static void snd_disconnect(struct usb_interface *intf) |
508 | { | 512 | { |
509 | struct snd_usb_caiaqdev *cdev; | ||
510 | struct snd_card *card = usb_get_intfdata(intf); | 513 | struct snd_card *card = usb_get_intfdata(intf); |
511 | 514 | struct snd_usb_caiaqdev *cdev = caiaqdev(card); | |
512 | debug("%s(%p)\n", __func__, intf); | 515 | struct device *dev; |
513 | 516 | ||
514 | if (!card) | 517 | if (!card) |
515 | return; | 518 | return; |
516 | 519 | ||
517 | cdev = caiaqdev(card); | 520 | dev = caiaqdev_to_dev(cdev); |
521 | dev_dbg(dev, "%s(%p)\n", __func__, intf); | ||
522 | |||
518 | snd_card_disconnect(card); | 523 | snd_card_disconnect(card); |
519 | 524 | ||
520 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT | 525 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT |
@@ -539,4 +544,3 @@ static struct usb_driver snd_usb_driver = { | |||
539 | }; | 544 | }; |
540 | 545 | ||
541 | module_usb_driver(snd_usb_driver); | 546 | module_usb_driver(snd_usb_driver); |
542 | |||