/* Called when any of the devices which participates into thermal management is going away.  */
static int therm_pm72_remove(struct i2c_client *client)
/* Called when any of the devices which participates into thermal management is going away.  */
static int therm_pm72_remove(struct i2c_client *client)
{
	struct i2c_adapter *adapter = client->adapter;
	mutex_lock(&driver_lock);
	if (state != state_detached)
		state = state_detaching;
	DBG("stopping control loops\n");
	mutex_unlock(&driver_lock);
	stop_control_loops();
	mutex_lock(&driver_lock);
	if (u3_0 != NULL && !strcmp(adapter->name, "u3 0")) {
		DBG("lost U3-0, disposing control loops\n");
		dispose_control_loops();
		u3_0 = NULL;
	}
	if (u3_1 != NULL && !strcmp(adapter->name, "u3 1")) {
		DBG("lost U3-1, detaching FCU\n");
		detach_fcu();
		u3_1 = NULL;
	}
	if (u3_0 == NULL && u3_1 == NULL)
		state = state_detached;
	mutex_unlock(&driver_lock);
	return 0;
}