diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2009-11-16 06:26:30 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-24 04:20:09 -0500 |
commit | a014bbadb53121e243cac254593e79e3ca89742d (patch) | |
tree | 1bfd7f4106b9041839ff7944dfcf12d79f1397fd /sound/usb/usx2y/us122l.c | |
parent | d82af9f9aab69e82b86450272588c861364f8879 (diff) |
sound: usxxx: cleanup chip field
The chip field is no longer needed. Move those of its fields that are
actually used to the device structure itself.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/usx2y/us122l.c')
-rw-r--r-- | sound/usb/usx2y/us122l.c | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 0ad061e5728b..f71cd28eca6b 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -59,7 +59,7 @@ static int us122l_create_usbmidi(struct snd_card *card) | |||
59 | .type = QUIRK_MIDI_US122L, | 59 | .type = QUIRK_MIDI_US122L, |
60 | .data = &quirk_data | 60 | .data = &quirk_data |
61 | }; | 61 | }; |
62 | struct usb_device *dev = US122L(card)->chip.dev; | 62 | struct usb_device *dev = US122L(card)->dev; |
63 | struct usb_interface *iface = usb_ifnum_to_if(dev, 1); | 63 | struct usb_interface *iface = usb_ifnum_to_if(dev, 1); |
64 | 64 | ||
65 | return snd_usbmidi_create(card, iface, | 65 | return snd_usbmidi_create(card, iface, |
@@ -81,7 +81,7 @@ static int us144_create_usbmidi(struct snd_card *card) | |||
81 | .type = QUIRK_MIDI_US122L, | 81 | .type = QUIRK_MIDI_US122L, |
82 | .data = &quirk_data | 82 | .data = &quirk_data |
83 | }; | 83 | }; |
84 | struct usb_device *dev = US122L(card)->chip.dev; | 84 | struct usb_device *dev = US122L(card)->dev; |
85 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); | 85 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); |
86 | 86 | ||
87 | return snd_usbmidi_create(card, iface, | 87 | return snd_usbmidi_create(card, iface, |
@@ -194,11 +194,11 @@ static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file) | |||
194 | if (!us122l->first) | 194 | if (!us122l->first) |
195 | us122l->first = file; | 195 | us122l->first = file; |
196 | 196 | ||
197 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 197 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
198 | iface = usb_ifnum_to_if(us122l->chip.dev, 0); | 198 | iface = usb_ifnum_to_if(us122l->dev, 0); |
199 | usb_autopm_get_interface(iface); | 199 | usb_autopm_get_interface(iface); |
200 | } | 200 | } |
201 | iface = usb_ifnum_to_if(us122l->chip.dev, 1); | 201 | iface = usb_ifnum_to_if(us122l->dev, 1); |
202 | usb_autopm_get_interface(iface); | 202 | usb_autopm_get_interface(iface); |
203 | return 0; | 203 | return 0; |
204 | } | 204 | } |
@@ -209,11 +209,11 @@ static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file) | |||
209 | struct usb_interface *iface; | 209 | struct usb_interface *iface; |
210 | snd_printdd(KERN_DEBUG "%p %p\n", hw, file); | 210 | snd_printdd(KERN_DEBUG "%p %p\n", hw, file); |
211 | 211 | ||
212 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 212 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
213 | iface = usb_ifnum_to_if(us122l->chip.dev, 0); | 213 | iface = usb_ifnum_to_if(us122l->dev, 0); |
214 | usb_autopm_put_interface(iface); | 214 | usb_autopm_put_interface(iface); |
215 | } | 215 | } |
216 | iface = usb_ifnum_to_if(us122l->chip.dev, 1); | 216 | iface = usb_ifnum_to_if(us122l->dev, 1); |
217 | usb_autopm_put_interface(iface); | 217 | usb_autopm_put_interface(iface); |
218 | if (us122l->first == file) | 218 | if (us122l->first == file) |
219 | us122l->first = NULL; | 219 | us122l->first = NULL; |
@@ -330,7 +330,7 @@ static bool us122l_start(struct us122l *us122l, | |||
330 | unsigned use_packsize = 0; | 330 | unsigned use_packsize = 0; |
331 | bool success = false; | 331 | bool success = false; |
332 | 332 | ||
333 | if (us122l->chip.dev->speed == USB_SPEED_HIGH) { | 333 | if (us122l->dev->speed == USB_SPEED_HIGH) { |
334 | /* The us-122l's descriptor defaults to iso max_packsize 78, | 334 | /* The us-122l's descriptor defaults to iso max_packsize 78, |
335 | which isn't needed for samplerates <= 48000. | 335 | which isn't needed for samplerates <= 48000. |
336 | Lets save some memory: | 336 | Lets save some memory: |
@@ -347,11 +347,11 @@ static bool us122l_start(struct us122l *us122l, | |||
347 | break; | 347 | break; |
348 | } | 348 | } |
349 | } | 349 | } |
350 | if (!usb_stream_new(&us122l->sk, us122l->chip.dev, 1, 2, | 350 | if (!usb_stream_new(&us122l->sk, us122l->dev, 1, 2, |
351 | rate, use_packsize, period_frames, 6)) | 351 | rate, use_packsize, period_frames, 6)) |
352 | goto out; | 352 | goto out; |
353 | 353 | ||
354 | err = us122l_set_sample_rate(us122l->chip.dev, rate); | 354 | err = us122l_set_sample_rate(us122l->dev, rate); |
355 | if (err < 0) { | 355 | if (err < 0) { |
356 | us122l_stop(us122l); | 356 | us122l_stop(us122l); |
357 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); | 357 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); |
@@ -390,7 +390,7 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, | |||
390 | err = -ENXIO; | 390 | err = -ENXIO; |
391 | goto free; | 391 | goto free; |
392 | } | 392 | } |
393 | high_speed = us122l->chip.dev->speed == USB_SPEED_HIGH; | 393 | high_speed = us122l->dev->speed == USB_SPEED_HIGH; |
394 | if ((cfg->sample_rate != 44100 && cfg->sample_rate != 48000 && | 394 | if ((cfg->sample_rate != 44100 && cfg->sample_rate != 48000 && |
395 | (!high_speed || | 395 | (!high_speed || |
396 | (cfg->sample_rate != 88200 && cfg->sample_rate != 96000))) || | 396 | (cfg->sample_rate != 88200 && cfg->sample_rate != 96000))) || |
@@ -450,7 +450,7 @@ static int usb_stream_hwdep_new(struct snd_card *card) | |||
450 | { | 450 | { |
451 | int err; | 451 | int err; |
452 | struct snd_hwdep *hw; | 452 | struct snd_hwdep *hw; |
453 | struct usb_device *dev = US122L(card)->chip.dev; | 453 | struct usb_device *dev = US122L(card)->dev; |
454 | 454 | ||
455 | err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw); | 455 | err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw); |
456 | if (err < 0) | 456 | if (err < 0) |
@@ -476,26 +476,26 @@ static bool us122l_create_card(struct snd_card *card) | |||
476 | int err; | 476 | int err; |
477 | struct us122l *us122l = US122L(card); | 477 | struct us122l *us122l = US122L(card); |
478 | 478 | ||
479 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 479 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
480 | err = usb_set_interface(us122l->chip.dev, 0, 1); | 480 | err = usb_set_interface(us122l->dev, 0, 1); |
481 | if (err) { | 481 | if (err) { |
482 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 482 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
483 | return false; | 483 | return false; |
484 | } | 484 | } |
485 | } | 485 | } |
486 | err = usb_set_interface(us122l->chip.dev, 1, 1); | 486 | err = usb_set_interface(us122l->dev, 1, 1); |
487 | if (err) { | 487 | if (err) { |
488 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 488 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
489 | return false; | 489 | return false; |
490 | } | 490 | } |
491 | 491 | ||
492 | pt_info_set(us122l->chip.dev, 0x11); | 492 | pt_info_set(us122l->dev, 0x11); |
493 | pt_info_set(us122l->chip.dev, 0x10); | 493 | pt_info_set(us122l->dev, 0x10); |
494 | 494 | ||
495 | if (!us122l_start(us122l, 44100, 256)) | 495 | if (!us122l_start(us122l, 44100, 256)) |
496 | return false; | 496 | return false; |
497 | 497 | ||
498 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) | 498 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) |
499 | err = us144_create_usbmidi(card); | 499 | err = us144_create_usbmidi(card); |
500 | else | 500 | else |
501 | err = us122l_create_usbmidi(card); | 501 | err = us122l_create_usbmidi(card); |
@@ -520,7 +520,7 @@ static bool us122l_create_card(struct snd_card *card) | |||
520 | static void snd_us122l_free(struct snd_card *card) | 520 | static void snd_us122l_free(struct snd_card *card) |
521 | { | 521 | { |
522 | struct us122l *us122l = US122L(card); | 522 | struct us122l *us122l = US122L(card); |
523 | int index = us122l->chip.index; | 523 | int index = us122l->card_index; |
524 | if (index >= 0 && index < SNDRV_CARDS) | 524 | if (index >= 0 && index < SNDRV_CARDS) |
525 | snd_us122l_card_used[index] = 0; | 525 | snd_us122l_card_used[index] = 0; |
526 | } | 526 | } |
@@ -540,10 +540,9 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
540 | sizeof(struct us122l), &card); | 540 | sizeof(struct us122l), &card); |
541 | if (err < 0) | 541 | if (err < 0) |
542 | return err; | 542 | return err; |
543 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; | 543 | snd_us122l_card_used[US122L(card)->card_index = dev] = 1; |
544 | card->private_free = snd_us122l_free; | 544 | card->private_free = snd_us122l_free; |
545 | US122L(card)->chip.dev = device; | 545 | US122L(card)->dev = device; |
546 | US122L(card)->chip.card = card; | ||
547 | mutex_init(&US122L(card)->mutex); | 546 | mutex_init(&US122L(card)->mutex); |
548 | init_waitqueue_head(&US122L(card)->sk.sleep); | 547 | init_waitqueue_head(&US122L(card)->sk.sleep); |
549 | INIT_LIST_HEAD(&US122L(card)->midi_list); | 548 | INIT_LIST_HEAD(&US122L(card)->midi_list); |
@@ -554,8 +553,8 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
554 | le16_to_cpu(device->descriptor.idVendor), | 553 | le16_to_cpu(device->descriptor.idVendor), |
555 | le16_to_cpu(device->descriptor.idProduct), | 554 | le16_to_cpu(device->descriptor.idProduct), |
556 | 0, | 555 | 0, |
557 | US122L(card)->chip.dev->bus->busnum, | 556 | US122L(card)->dev->bus->busnum, |
558 | US122L(card)->chip.dev->devnum | 557 | US122L(card)->dev->devnum |
559 | ); | 558 | ); |
560 | *cardp = card; | 559 | *cardp = card; |
561 | return 0; | 560 | return 0; |
@@ -635,16 +634,15 @@ static void snd_us122l_disconnect(struct usb_interface *intf) | |||
635 | mutex_lock(&us122l->mutex); | 634 | mutex_lock(&us122l->mutex); |
636 | us122l_stop(us122l); | 635 | us122l_stop(us122l); |
637 | mutex_unlock(&us122l->mutex); | 636 | mutex_unlock(&us122l->mutex); |
638 | us122l->chip.shutdown = 1; | ||
639 | 637 | ||
640 | /* release the midi resources */ | 638 | /* release the midi resources */ |
641 | list_for_each(p, &us122l->midi_list) { | 639 | list_for_each(p, &us122l->midi_list) { |
642 | snd_usbmidi_disconnect(p); | 640 | snd_usbmidi_disconnect(p); |
643 | } | 641 | } |
644 | 642 | ||
645 | usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 0)); | 643 | usb_put_intf(usb_ifnum_to_if(us122l->dev, 0)); |
646 | usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 1)); | 644 | usb_put_intf(usb_ifnum_to_if(us122l->dev, 1)); |
647 | usb_put_dev(us122l->chip.dev); | 645 | usb_put_dev(us122l->dev); |
648 | 646 | ||
649 | while (atomic_read(&us122l->mmap_count)) | 647 | while (atomic_read(&us122l->mmap_count)) |
650 | msleep(500); | 648 | msleep(500); |
@@ -694,23 +692,23 @@ static int snd_us122l_resume(struct usb_interface *intf) | |||
694 | 692 | ||
695 | mutex_lock(&us122l->mutex); | 693 | mutex_lock(&us122l->mutex); |
696 | /* needed, doesn't restart without: */ | 694 | /* needed, doesn't restart without: */ |
697 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 695 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
698 | err = usb_set_interface(us122l->chip.dev, 0, 1); | 696 | err = usb_set_interface(us122l->dev, 0, 1); |
699 | if (err) { | 697 | if (err) { |
700 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 698 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
701 | goto unlock; | 699 | goto unlock; |
702 | } | 700 | } |
703 | } | 701 | } |
704 | err = usb_set_interface(us122l->chip.dev, 1, 1); | 702 | err = usb_set_interface(us122l->dev, 1, 1); |
705 | if (err) { | 703 | if (err) { |
706 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 704 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
707 | goto unlock; | 705 | goto unlock; |
708 | } | 706 | } |
709 | 707 | ||
710 | pt_info_set(us122l->chip.dev, 0x11); | 708 | pt_info_set(us122l->dev, 0x11); |
711 | pt_info_set(us122l->chip.dev, 0x10); | 709 | pt_info_set(us122l->dev, 0x10); |
712 | 710 | ||
713 | err = us122l_set_sample_rate(us122l->chip.dev, | 711 | err = us122l_set_sample_rate(us122l->dev, |
714 | us122l->sk.s->cfg.sample_rate); | 712 | us122l->sk.s->cfg.sample_rate); |
715 | if (err < 0) { | 713 | if (err < 0) { |
716 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); | 714 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); |