diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-01-29 08:22:20 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-02-12 05:18:00 -0500 |
commit | 874b8d422e26e21dd432657e25f679c75440c1bc (patch) | |
tree | e88cbcfc629fc791e9310a968cdcd90bddbc4f10 /sound | |
parent | 60c5772b50fe8ce947685cfe3a80b9bf6ea92831 (diff) |
ALSA: usb: Convert to snd_card_new() with a device pointer
Also remove superfluous snd_card_set_dev() calls.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/6fire/chip.c | 5 | ||||
-rw-r--r-- | sound/usb/caiaq/device.c | 6 | ||||
-rw-r--r-- | sound/usb/card.c | 10 | ||||
-rw-r--r-- | sound/usb/hiface/chip.c | 10 | ||||
-rw-r--r-- | sound/usb/misc/ua101.c | 7 | ||||
-rw-r--r-- | sound/usb/usx2y/us122l.c | 11 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.c | 11 |
7 files changed, 31 insertions, 29 deletions
diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c index 66edc4a7917f..e0fe0d92db8c 100644 --- a/sound/usb/6fire/chip.c +++ b/sound/usb/6fire/chip.c | |||
@@ -124,8 +124,8 @@ static int usb6fire_chip_probe(struct usb_interface *intf, | |||
124 | snd_printk(KERN_ERR PREFIX "can't set first interface.\n"); | 124 | snd_printk(KERN_ERR PREFIX "can't set first interface.\n"); |
125 | return -EIO; | 125 | return -EIO; |
126 | } | 126 | } |
127 | ret = snd_card_create(index[regidx], id[regidx], THIS_MODULE, | 127 | ret = snd_card_new(&intf->dev, index[regidx], id[regidx], |
128 | sizeof(struct sfire_chip), &card); | 128 | THIS_MODULE, sizeof(struct sfire_chip), &card); |
129 | if (ret < 0) { | 129 | if (ret < 0) { |
130 | snd_printk(KERN_ERR PREFIX "cannot create alsa card.\n"); | 130 | snd_printk(KERN_ERR PREFIX "cannot create alsa card.\n"); |
131 | return ret; | 131 | return ret; |
@@ -134,7 +134,6 @@ static int usb6fire_chip_probe(struct usb_interface *intf, | |||
134 | strcpy(card->shortname, "TerraTec DMX6FireUSB"); | 134 | strcpy(card->shortname, "TerraTec DMX6FireUSB"); |
135 | sprintf(card->longname, "%s at %d:%d", card->shortname, | 135 | sprintf(card->longname, "%s at %d:%d", card->shortname, |
136 | device->bus->busnum, device->devnum); | 136 | device->bus->busnum, device->devnum); |
137 | snd_card_set_dev(card, &intf->dev); | ||
138 | 137 | ||
139 | chip = card->private_data; | 138 | chip = card->private_data; |
140 | chips[regidx] = chip; | 139 | chips[regidx] = chip; |
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index bc55f708a696..b871ba407e4e 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c | |||
@@ -418,8 +418,9 @@ static int create_card(struct usb_device *usb_dev, | |||
418 | if (devnum >= SNDRV_CARDS) | 418 | if (devnum >= SNDRV_CARDS) |
419 | return -ENODEV; | 419 | return -ENODEV; |
420 | 420 | ||
421 | err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, | 421 | err = snd_card_new(&intf->dev, |
422 | sizeof(struct snd_usb_caiaqdev), &card); | 422 | index[devnum], id[devnum], THIS_MODULE, |
423 | sizeof(struct snd_usb_caiaqdev), &card); | ||
423 | if (err < 0) | 424 | if (err < 0) |
424 | return err; | 425 | return err; |
425 | 426 | ||
@@ -429,7 +430,6 @@ static int create_card(struct usb_device *usb_dev, | |||
429 | cdev->chip.usb_id = USB_ID(le16_to_cpu(usb_dev->descriptor.idVendor), | 430 | cdev->chip.usb_id = USB_ID(le16_to_cpu(usb_dev->descriptor.idVendor), |
430 | le16_to_cpu(usb_dev->descriptor.idProduct)); | 431 | le16_to_cpu(usb_dev->descriptor.idProduct)); |
431 | spin_lock_init(&cdev->spinlock); | 432 | spin_lock_init(&cdev->spinlock); |
432 | snd_card_set_dev(card, &intf->dev); | ||
433 | 433 | ||
434 | *cardp = card; | 434 | *cardp = card; |
435 | return 0; | 435 | return 0; |
diff --git a/sound/usb/card.c b/sound/usb/card.c index 025224136129..0cfdc2d3b631 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -328,7 +328,8 @@ static void remove_trailing_spaces(char *str) | |||
328 | /* | 328 | /* |
329 | * create a chip instance and set its names. | 329 | * create a chip instance and set its names. |
330 | */ | 330 | */ |
331 | static int snd_usb_audio_create(struct usb_device *dev, int idx, | 331 | static int snd_usb_audio_create(struct usb_interface *intf, |
332 | struct usb_device *dev, int idx, | ||
332 | const struct snd_usb_audio_quirk *quirk, | 333 | const struct snd_usb_audio_quirk *quirk, |
333 | struct snd_usb_audio **rchip) | 334 | struct snd_usb_audio **rchip) |
334 | { | 335 | { |
@@ -354,7 +355,8 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
354 | return -ENXIO; | 355 | return -ENXIO; |
355 | } | 356 | } |
356 | 357 | ||
357 | err = snd_card_create(index[idx], id[idx], THIS_MODULE, 0, &card); | 358 | err = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE, |
359 | 0, &card); | ||
358 | if (err < 0) { | 360 | if (err < 0) { |
359 | snd_printk(KERN_ERR "cannot create card instance %d\n", idx); | 361 | snd_printk(KERN_ERR "cannot create card instance %d\n", idx); |
360 | return err; | 362 | return err; |
@@ -513,10 +515,10 @@ snd_usb_audio_probe(struct usb_device *dev, | |||
513 | if (enable[i] && ! usb_chip[i] && | 515 | if (enable[i] && ! usb_chip[i] && |
514 | (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) && | 516 | (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) && |
515 | (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) { | 517 | (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) { |
516 | if (snd_usb_audio_create(dev, i, quirk, &chip) < 0) { | 518 | if (snd_usb_audio_create(intf, dev, i, quirk, |
519 | &chip) < 0) { | ||
517 | goto __error; | 520 | goto __error; |
518 | } | 521 | } |
519 | snd_card_set_dev(chip->card, &intf->dev); | ||
520 | chip->pm_intf = intf; | 522 | chip->pm_intf = intf; |
521 | break; | 523 | break; |
522 | } | 524 | } |
diff --git a/sound/usb/hiface/chip.c b/sound/usb/hiface/chip.c index b0dcb3924ce5..2670d646bda9 100644 --- a/sound/usb/hiface/chip.c +++ b/sound/usb/hiface/chip.c | |||
@@ -64,7 +64,8 @@ struct hiface_vendor_quirk { | |||
64 | u8 extra_freq; | 64 | u8 extra_freq; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static int hiface_chip_create(struct usb_device *device, int idx, | 67 | static int hiface_chip_create(struct usb_interface *intf, |
68 | struct usb_device *device, int idx, | ||
68 | const struct hiface_vendor_quirk *quirk, | 69 | const struct hiface_vendor_quirk *quirk, |
69 | struct hiface_chip **rchip) | 70 | struct hiface_chip **rchip) |
70 | { | 71 | { |
@@ -76,7 +77,8 @@ static int hiface_chip_create(struct usb_device *device, int idx, | |||
76 | *rchip = NULL; | 77 | *rchip = NULL; |
77 | 78 | ||
78 | /* if we are here, card can be registered in alsa. */ | 79 | /* if we are here, card can be registered in alsa. */ |
79 | ret = snd_card_create(index[idx], id[idx], THIS_MODULE, sizeof(*chip), &card); | 80 | ret = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE, |
81 | sizeof(*chip), &card); | ||
80 | if (ret < 0) { | 82 | if (ret < 0) { |
81 | dev_err(&device->dev, "cannot create alsa card.\n"); | 83 | dev_err(&device->dev, "cannot create alsa card.\n"); |
82 | return ret; | 84 | return ret; |
@@ -132,12 +134,10 @@ static int hiface_chip_probe(struct usb_interface *intf, | |||
132 | goto err; | 134 | goto err; |
133 | } | 135 | } |
134 | 136 | ||
135 | ret = hiface_chip_create(device, i, quirk, &chip); | 137 | ret = hiface_chip_create(intf, device, i, quirk, &chip); |
136 | if (ret < 0) | 138 | if (ret < 0) |
137 | goto err; | 139 | goto err; |
138 | 140 | ||
139 | snd_card_set_dev(chip->card, &intf->dev); | ||
140 | |||
141 | ret = hiface_pcm_init(chip, quirk ? quirk->extra_freq : 0); | 141 | ret = hiface_pcm_init(chip, quirk ? quirk->extra_freq : 0); |
142 | if (ret < 0) | 142 | if (ret < 0) |
143 | goto err_chip_destroy; | 143 | goto err_chip_destroy; |
diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c index 509315937f25..a1bab149df4d 100644 --- a/sound/usb/misc/ua101.c +++ b/sound/usb/misc/ua101.c | |||
@@ -1243,8 +1243,9 @@ static int ua101_probe(struct usb_interface *interface, | |||
1243 | mutex_unlock(&devices_mutex); | 1243 | mutex_unlock(&devices_mutex); |
1244 | return -ENOENT; | 1244 | return -ENOENT; |
1245 | } | 1245 | } |
1246 | err = snd_card_create(index[card_index], id[card_index], THIS_MODULE, | 1246 | err = snd_card_new(&interface->dev, |
1247 | sizeof(*ua), &card); | 1247 | index[card_index], id[card_index], THIS_MODULE, |
1248 | sizeof(*ua), &card); | ||
1248 | if (err < 0) { | 1249 | if (err < 0) { |
1249 | mutex_unlock(&devices_mutex); | 1250 | mutex_unlock(&devices_mutex); |
1250 | return err; | 1251 | return err; |
@@ -1283,8 +1284,6 @@ static int ua101_probe(struct usb_interface *interface, | |||
1283 | } | 1284 | } |
1284 | } | 1285 | } |
1285 | 1286 | ||
1286 | snd_card_set_dev(card, &interface->dev); | ||
1287 | |||
1288 | err = detect_usb_format(ua); | 1287 | err = detect_usb_format(ua); |
1289 | if (err < 0) | 1288 | if (err < 0) |
1290 | goto probe_error; | 1289 | goto probe_error; |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 999550bbad40..cf5dc33f4a6d 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -535,7 +535,9 @@ static void snd_us122l_free(struct snd_card *card) | |||
535 | snd_us122l_card_used[index] = 0; | 535 | snd_us122l_card_used[index] = 0; |
536 | } | 536 | } |
537 | 537 | ||
538 | static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | 538 | static int usx2y_create_card(struct usb_device *device, |
539 | struct usb_interface *intf, | ||
540 | struct snd_card **cardp) | ||
539 | { | 541 | { |
540 | int dev; | 542 | int dev; |
541 | struct snd_card *card; | 543 | struct snd_card *card; |
@@ -546,8 +548,8 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
546 | break; | 548 | break; |
547 | if (dev >= SNDRV_CARDS) | 549 | if (dev >= SNDRV_CARDS) |
548 | return -ENODEV; | 550 | return -ENODEV; |
549 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, | 551 | err = snd_card_new(&intf->dev, index[dev], id[dev], THIS_MODULE, |
550 | sizeof(struct us122l), &card); | 552 | sizeof(struct us122l), &card); |
551 | if (err < 0) | 553 | if (err < 0) |
552 | return err; | 554 | return err; |
553 | snd_us122l_card_used[US122L(card)->card_index = dev] = 1; | 555 | snd_us122l_card_used[US122L(card)->card_index = dev] = 1; |
@@ -578,11 +580,10 @@ static int us122l_usb_probe(struct usb_interface *intf, | |||
578 | struct snd_card *card; | 580 | struct snd_card *card; |
579 | int err; | 581 | int err; |
580 | 582 | ||
581 | err = usx2y_create_card(device, &card); | 583 | err = usx2y_create_card(device, intf, &card); |
582 | if (err < 0) | 584 | if (err < 0) |
583 | return err; | 585 | return err; |
584 | 586 | ||
585 | snd_card_set_dev(card, &intf->dev); | ||
586 | if (!us122l_create_card(card)) { | 587 | if (!us122l_create_card(card)) { |
587 | snd_card_free(card); | 588 | snd_card_free(card); |
588 | return -EINVAL; | 589 | return -EINVAL; |
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index 5a51b18c50fe..e38c87302b15 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -332,7 +332,9 @@ static struct usb_device_id snd_usX2Y_usb_id_table[] = { | |||
332 | { /* terminator */ } | 332 | { /* terminator */ } |
333 | }; | 333 | }; |
334 | 334 | ||
335 | static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp) | 335 | static int usX2Y_create_card(struct usb_device *device, |
336 | struct usb_interface *intf, | ||
337 | struct snd_card **cardp) | ||
336 | { | 338 | { |
337 | int dev; | 339 | int dev; |
338 | struct snd_card * card; | 340 | struct snd_card * card; |
@@ -343,8 +345,8 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
343 | break; | 345 | break; |
344 | if (dev >= SNDRV_CARDS) | 346 | if (dev >= SNDRV_CARDS) |
345 | return -ENODEV; | 347 | return -ENODEV; |
346 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, | 348 | err = snd_card_new(&intf->dev, index[dev], id[dev], THIS_MODULE, |
347 | sizeof(struct usX2Ydev), &card); | 349 | sizeof(struct usX2Ydev), &card); |
348 | if (err < 0) | 350 | if (err < 0) |
349 | return err; | 351 | return err; |
350 | snd_usX2Y_card_used[usX2Y(card)->card_index = dev] = 1; | 352 | snd_usX2Y_card_used[usX2Y(card)->card_index = dev] = 1; |
@@ -382,10 +384,9 @@ static int usX2Y_usb_probe(struct usb_device *device, | |||
382 | le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428)) | 384 | le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428)) |
383 | return -EINVAL; | 385 | return -EINVAL; |
384 | 386 | ||
385 | err = usX2Y_create_card(device, &card); | 387 | err = usX2Y_create_card(device, intf, &card); |
386 | if (err < 0) | 388 | if (err < 0) |
387 | return err; | 389 | return err; |
388 | snd_card_set_dev(card, &intf->dev); | ||
389 | if ((err = usX2Y_hwdep_new(card, device)) < 0 || | 390 | if ((err = usX2Y_hwdep_new(card, device)) < 0 || |
390 | (err = snd_card_register(card)) < 0) { | 391 | (err = snd_card_register(card)) < 0) { |
391 | snd_card_free(card); | 392 | snd_card_free(card); |