Ejemplo n.º 1
0
/*------------------------------------------------------------------------*
 *	ucom_unref
 *
 * This function will decrement the super UCOM reference count.
 *
 * Return values:
 * 0: UCOM structures are still referenced.
 * Else: UCOM structures are no longer referenced.
 *------------------------------------------------------------------------*/
int
ucom_unref(struct ucom_super_softc *ssc)
{
	int retval;

	mtx_lock(&ucom_mtx);
	retval = (ssc->sc_refs < 2);
	ssc->sc_refs--;
	mtx_unlock(&ucom_mtx);

	if (retval)
		ucom_free_unit(ssc);

	return (retval);
}
Ejemplo n.º 2
0
/*------------------------------------------------------------------------*
 *	ucom_unref
 *
 * This function will decrement the super UCOM reference count.
 *
 * Return values:
 * 0: UCOM structures are still referenced.
 * Else: UCOM structures are no longer referenced.
 *------------------------------------------------------------------------*/
int
ucom_unref(struct ucom_super_softc *ssc)
{
	int retval;

	lockmgr(&ucom_lock, LK_EXCLUSIVE);
	retval = (ssc->sc_refs < 2);
	ssc->sc_refs--;
	lockmgr(&ucom_lock, LK_RELEASE);

	if (retval)
		ucom_free_unit(ssc);

	return (retval);
}