return error;
}
+ regulator_haptic_toggle(haptic, !!magnitude);
+
return 0;
}
{
struct regulator_haptic *haptic = container_of(work,
struct regulator_haptic, work);
- unsigned int magnitude;
- int error;
mutex_lock(&haptic->mutex);
- if (haptic->suspended)
- goto out;
-
- magnitude = ACCESS_ONCE(haptic->magnitude);
+ if (!haptic->suspended)
+ regulator_haptic_set_voltage(haptic, haptic->magnitude);
- error = regulator_haptic_set_voltage(haptic, magnitude);
- if (error)
- goto out;
-
- regulator_haptic_toggle(haptic, magnitude != 0);
-
-out:
mutex_unlock(&haptic->mutex);
}
cancel_work_sync(&haptic->work);
regulator_haptic_set_voltage(haptic, 0);
- regulator_haptic_toggle(haptic, false);
}
static int __maybe_unused
return error;
regulator_haptic_set_voltage(haptic, 0);
- regulator_haptic_toggle(haptic, false);
haptic->suspended = true;
haptic->suspended = false;
magnitude = ACCESS_ONCE(haptic->magnitude);
- if (magnitude) {
+ if (magnitude)
regulator_haptic_set_voltage(haptic, magnitude);
- regulator_haptic_toggle(haptic, true);
- }
mutex_unlock(&haptic->mutex);