kernels/linux-2.4.0/drivers/net/ppp_generic.c
/*
 * Disconnect a channel from its ppp unit.
 */
Disconnect a channel from its ppp unit.
Disconnect a channel from its ppp unit .
static int
ppp_disconnect_channel(struct channel *pch)
{
	struct ppp *ppp;
	int err = -EINVAL;
	int dead;
	write_lock_bh(&pch->upl);
	ppp = pch->ppp;
	if (ppp != 0) {
		pch->ppp = NULL;
		ppp_lock(ppp);
		list_del(&pch->clist);
		--ppp->n_channels;
		dead = ppp->dev == 0 && ppp->n_channels == 0;
		ppp_unlock(ppp);
		if (dead)
			kfree(ppp);
		err = 0;
	}
	write_unlock_bh(&pch->upl);
	return err;
}
static int ppp_disconnect_channel ( struct channel * pch ) { struct ppp * ppp ; int err = - EINVAL ; int dead ; write_lock_bh ( & pch -> upl ) ; ppp = pch -> ppp ; if ( ppp != 0 ) { pch -> ppp = NULL ; ppp_lock ( ppp ) ; list_del ( & pch -> clist ) ; -- ppp -> n_channels ; dead = ppp -> dev == 0 && ppp -> n_channels == 0 ; ppp_unlock ( ppp ) ; if ( dead ) kfree ( ppp ) ; err = 0 ; } write_unlock_bh ( & pch -> upl ) ; return err ; }
Disconnect a channel from its ppp unit.
Disconnect a channel from its ppp unit .
/* remove it from the ppp unit's list */ /* Last disconnect from a ppp unit
			   that is already dead: free it. */