/* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core.  */
static int detach(struct comedi_device *dev)
/* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core.  */
static int detach(struct comedi_device *dev)
{
	if (devpriv) {
		if (dev->subdevices && devpriv->attached_to_8255) {
			subdev_8255_cleanup(dev, dev->subdevices + 2);
			devpriv->attached_to_8255 = 0;
		}
		if (devpriv->pci_dev) {
			if (devpriv->registers) {
				comedi_pci_disable(devpriv->pci_dev);
			}
			pci_dev_put(devpriv->pci_dev);
		}
		if (devpriv->attached_successfully && thisboard)
			printk("comedi%d: %s: detached\n", dev->minor,
			       thisboard->name);
	}
	return 0;
}