//**************************************************************************** // remove device resources // static int pcan_usb_cleanup(struct pcandev *dev) { USB_PORT *u = &dev->port.usb; DPRINTK(KERN_DEBUG "%s: %s(CAN#%d)\n", DEVICE_NAME, __FUNCTION__, u->dev_ctrl_index); if (dev) { kfree(u->write_buffer_addr); switch(dev->wInitStep) { case 4: #ifdef NETDEV_SUPPORT pcan_netdev_unregister(dev); #endif case 3: usb_devices--; pcan_drv.wDeviceCount--; case 2: list_del(&dev->list); case 1: case 0: pcan_delete_filter_chain(dev->filter); dev->filter = NULL; } } return 0; }
// release and probe functions static int pcan_dongle_cleanup(struct pcandev *dev) { DPRINTK(KERN_DEBUG "%s: pcan_dongle_cleanup()\n", DEVICE_NAME); switch(dev->wInitStep) { case 4: pcan_dongle_free_irq(dev); case 3: if (dev->wType == HW_DONGLE_SJA) sp_devices--; else epp_devices--; dng_devices = sp_devices + epp_devices; case 2: #ifndef PARPORT_SUBSYSTEM if (dev->wType == HW_DONGLE_SJA_EPP) release_region(dev->port.dng.wEcr, ECR_PORT_SIZE); #endif case 1: #ifdef PARPORT_SUBSYSTEM PARPORT_UNREGISTER_DEVICE(); #else release_region(dev->port.dng.dwPort, DNG_PORT_SIZE); #endif case 0: pcan_delete_filter_chain(dev->filter); dev->filter = NULL; dev->wInitStep = 0; } return 0; }
// release and probe function static int pcan_isa_cleanup(struct pcandev *dev) { DPRINTK(KERN_DEBUG "%s: pcan_isa_cleanup()\n", DEVICE_NAME); switch(dev->wInitStep) { case 4: pcan_isa_free_irq(dev); case 3: isa_devices--; case 2: case 1: release_region(dev->port.isa.dwPort, ISA_PORT_SIZE); case 0: pcan_delete_filter_chain(dev->filter); dev->filter = NULL; dev->wInitStep = 0; } return 0; }
//**************************************************************************** // remove device resources // static int pcan_usb_cleanup(struct pcandev *dev) { if (dev) { USB_PORT *u = &dev->port.usb; DPRINTK(KERN_DEBUG "%s: %s(CAN#%d)\n", DEVICE_NAME, __func__, u->dev_ctrl_index); kfree(u->write_buffer_addr); u->write_buffer_addr = NULL; switch(dev->wInitStep) { case 4: #if 1 /* New: unlock any waiting task */ dev->ucPhysicallyInstalled = 0; wake_up_interruptible(&dev->write_queue); wake_up_interruptible(&dev->read_queue); #endif #ifdef NETDEV_SUPPORT pcan_netdev_unregister(dev); #endif case 3: usb_devices--; case 2: pcan_del_device_from_list(dev); case 1: case 0: pcan_delete_filter_chain(dev->filter); dev->filter = NULL; } /* just to be sure not doing twice one of the above */ dev->wInitStep = 0xff; } else { DPRINTK(KERN_DEBUG "%s: %s(NULL dev)\n", DEVICE_NAME, __func__); } return 0; }