Ejemplo n.º 1
0
//****************************************************************************
// 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;
}
Ejemplo n.º 2
0
static void pcan_usb_plugout_netdev(struct pcandev *dev)
{
	struct net_device *ndev = dev->netdev;

	if (ndev) 
	{
		netif_stop_queue(ndev);
		pcan_netdev_unregister(dev);
	}
}
Ejemplo n.º 3
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;
}