Exemple #1
0
/*===========================================================================
METHOD:
   GobiNetDriverUnbind (Public Method)

DESCRIPTION:
   Deregisters QMI device (Registration happened in the probe function)

PARAMETERS
   pDev           [ I ] - Pointer to usbnet device
   pIntfUnused    [ I ] - Pointer to interface

RETURN VALUE:
   None
===========================================================================*/
static void GobiNetDriverUnbind(
   struct usbnet *         pDev,
   struct usb_interface *  pIntf)
{
   sGobiUSBNet * pGobiDev = (sGobiUSBNet *)pDev->data[0];

   // Should already be down, but just in case...
   netif_carrier_off( pDev->net );

   DeregisterQMIDevice( pGobiDev );

#if (LINUX_VERSION_CODE >= KERNEL_VERSION( 2,6,29 ))
   kfree( pDev->net->netdev_ops );
   pDev->net->netdev_ops = NULL;
#endif

#if (LINUX_VERSION_CODE <= KERNEL_VERSION( 2,6,23 ))
   pIntf->dev.platform_data = NULL;
#endif

#if (LINUX_VERSION_CODE >= KERNEL_VERSION( 2,6,19 ))
   pIntf->needs_remote_wakeup = 0;
#endif

   kfree( pGobiDev );
   pGobiDev = NULL;
}
Exemple #2
0
void Gobinet_disconnect (struct usb_interface *pIntf)
{
	struct usbnet * pDev;
	sGobiUSBNet * pGobiDev;

	if (pIntf == 0)
	{
	  return -ENOMEM;
	}

#if (LINUX_VERSION_CODE > KERNEL_VERSION( 2,6,23 ))
	pDev = usb_get_intfdata( pIntf );
#else
	pDev = (struct usbnet *)pIntf->dev.platform_data;
#endif

	if (pDev == NULL || pDev->net == NULL)
	{
	  DBG( "failed to get netdevice\n" );
	  return -ENXIO;
	}

	pGobiDev = (sGobiUSBNet *)pDev->data[0];
	if (pGobiDev == NULL)
	{
	  DBG( "failed to get QMIDevice\n" );
	  return -ENXIO;
	}
#if 1
	DeregisterQMIDevice(pGobiDev);
#else
	cdev_del(&pGobiDev->mQMIDev.mCdev);
#endif
	usbnet_disconnect(pIntf);
}