OSDN Git Service

Merge branch 'next' into for-linus
[uclinux-h8/linux.git] / drivers / input / misc / max77693-haptic.c
index 0ee3e8b..157a1f5 100644 (file)
@@ -152,7 +152,7 @@ static void max77693_haptic_disable(struct max77693_haptic *haptic)
 {
        int error;
 
-       if (haptic->enabled)
+       if (!haptic->enabled)
                return;
 
        error = max77693_haptic_configure(haptic, false);
@@ -194,7 +194,7 @@ static int max77693_haptic_play_effect(struct input_dev *dev, void *data,
                                       struct ff_effect *effect)
 {
        struct max77693_haptic *haptic = input_get_drvdata(dev);
-       uint64_t period_mag_multi;
+       u64 period_mag_multi;
 
        haptic->magnitude = effect->u.rumble.strong_magnitude;
        if (!haptic->magnitude)
@@ -205,8 +205,7 @@ static int max77693_haptic_play_effect(struct input_dev *dev, void *data,
         * The formula to convert magnitude to pwm_duty as follows:
         * - pwm_duty = (magnitude * pwm_period) / MAX_MAGNITUDE(0xFFFF)
         */
-       period_mag_multi = (int64_t)(haptic->pwm_dev->period *
-                                               haptic->magnitude);
+       period_mag_multi = (u64)haptic->pwm_dev->period * haptic->magnitude;
        haptic->pwm_duty = (unsigned int)(period_mag_multi >>
                                                MAX_MAGNITUDE_SHIFT);