kernels/linux-2.4.0/drivers/net/ppp_generic.c
/*
 * Free up all the resources used by a ppp interface unit.
 */
Free up all the resources used by a ppp interface unit.
Free up all the resources used by a ppp interface unit .
static void ppp_destroy_interface(struct ppp *ppp)
{
	struct net_device *dev;
	spin_lock(&all_ppp_lock);
	list_del(&ppp->file.list);
	ppp_lock(ppp);
	ppp_ccp_closed(ppp);
	if (ppp->vj) {
		slhc_free(ppp->vj);
		ppp->vj = 0;
	}
	skb_queue_purge(&ppp->file.xq);
	skb_queue_purge(&ppp->file.rq);
#ifdef CONFIG_PPP_MULTILINK
	skb_queue_purge(&ppp->mrq);
#endif 
	dev = ppp->dev;
	ppp->dev = 0;
	ppp_unlock(ppp);
	if (dev) {
		rtnl_lock();
		dev_close(dev);
		unregister_netdevice(dev);
		rtnl_unlock();
	}
	if (ppp->n_channels == 0)
		kfree(ppp);
	spin_unlock(&all_ppp_lock);
}
static void ppp_destroy_interface ( struct ppp * ppp ) { struct net_device * dev ; spin_lock ( & all_ppp_lock ) ; list_del ( & ppp -> file . list ) ; ppp_lock ( ppp ) ; ppp_ccp_closed ( ppp ) ; if ( ppp -> vj ) { slhc_free ( ppp -> vj ) ; ppp -> vj = 0 ; } skb_queue_purge ( & ppp -> file . xq ) ; skb_queue_purge ( & ppp -> file . rq ) ; #ifdef CONFIG_PPP_MULTILINK skb_queue_purge ( & ppp -> mrq ) ; #endif dev = ppp -> dev ; ppp -> dev = 0 ; ppp_unlock ( ppp ) ; if ( dev ) { rtnl_lock ( ) ; dev_close ( dev ) ; unregister_netdevice ( dev ) ; rtnl_unlock ( ) ; } if ( ppp -> n_channels == 0 ) kfree ( ppp ) ; spin_unlock ( & all_ppp_lock ) ; }
Free up all the resources used by a ppp interface unit.
Free up all the resources used by a ppp interface unit .
/* Last fd open to this ppp unit is being closed or detached:
	   mark the interface down, free the ppp unit */ /* CONFIG_PPP_MULTILINK */ /*
	 * We can't acquire any new channels (since we have the
	 * all_ppp_lock) so if n_channels is 0, we can free the
	 * ppp structure.  Otherwise we leave it around until the
	 * last channel disconnects from it.
	 */