/* Return the PPP unit number to which a channel is connected.  */
int ppp_unit_number(struct ppp_channel *chan)
/* Return the PPP unit number to which a channel is connected.  */
int ppp_unit_number(struct ppp_channel *chan)
{
	struct channel *pch = chan->ppp;
	int unit = -1;
	if (pch) {
		read_lock_bh(&pch->upl);
		if (pch->ppp)
			unit = pch->ppp->file.index;
		read_unlock_bh(&pch->upl);
	}
	return unit;
}