/* Under some conditions, a driver may wish to reset the entire device. Called from omap_device code. Returns -EINVAL on error or passes along the return value from _reset()/_enable().  */
int omap_hwmod_reset(struct omap_hwmod *oh)
/* Under some conditions, a driver may wish to reset the entire device. Called from omap_device code. Returns -EINVAL on error or passes along the return value from _reset()/_enable().  */
int omap_hwmod_reset(struct omap_hwmod *oh)
{
	int r;
	if (!oh || !(oh->_state & _HWMOD_STATE_ENABLED))
		return -EINVAL;
	mutex_lock(&omap_hwmod_mutex);
	r = _reset(oh);
	if (!r)
		r = _enable(oh);
	mutex_unlock(&omap_hwmod_mutex);
	return r;
}