/* Toneport device disconnected. */ void line6_toneport_disconnect(struct usb_interface *interface) { struct usb_line6_toneport *toneport; if (interface == NULL) return; toneport = usb_get_intfdata(interface); del_timer_sync(&toneport->timer); if (toneport_has_led(toneport->line6.usbdev->descriptor.idProduct)) { device_remove_file(&interface->dev, &dev_attr_led_red); device_remove_file(&interface->dev, &dev_attr_led_green); } if (toneport != NULL) { struct snd_line6_pcm *line6pcm = toneport->line6.line6pcm; if (line6pcm != NULL) { line6_pcm_stop(line6pcm, MASK_PCM_MONITOR); line6_pcm_disconnect(line6pcm); } } toneport_destruct(interface); }
/* Line 6 device disconnected. */ void line6_disconnect(struct usb_interface *interface) { struct usb_line6 *line6 = usb_get_intfdata(interface); struct usb_device *usbdev = interface_to_usbdev(interface); if (!line6) return; if (WARN_ON(usbdev != line6->usbdev)) return; if (line6->urb_listen != NULL) line6_stop_listen(line6); snd_card_disconnect(line6->card); if (line6->line6pcm) line6_pcm_disconnect(line6->line6pcm); if (line6->disconnect) line6->disconnect(line6); dev_info(&interface->dev, "Line 6 %s now disconnected\n", line6->properties->name); /* make sure the device isn't destructed twice: */ usb_set_intfdata(interface, NULL); snd_card_free_when_closed(line6->card); }
/* Suspend Line6 device. */ static int line6_suspend(struct usb_interface *interface, pm_message_t message) { struct usb_line6 *line6 = usb_get_intfdata(interface); struct snd_line6_pcm *line6pcm = line6->line6pcm; snd_power_change_state(line6->card, SNDRV_CTL_POWER_D3hot); if (line6->properties->capabilities & LINE6_BIT_CONTROL) line6_stop_listen(line6); if (line6pcm != NULL) { snd_pcm_suspend_all(line6pcm->pcm); line6_pcm_disconnect(line6pcm); line6pcm->flags = 0; } return 0; }