]> git.baikalelectronics.ru Git - kernel.git/commitdiff
pwm: clps711x: Fix period calculation
authorAlexander Shiyan <shc_work@mail.ru>
Wed, 19 Dec 2018 10:39:24 +0000 (13:39 +0300)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 24 Dec 2018 11:06:55 +0000 (12:06 +0100)
Commit d46d79b43e31 ("pwm: Introduce the pwm_args concept") has
changed the variable for the period for clps711x-pwm driver, so now
pwm_get/set_period() works with pwm->state.period variable instead
of pwm->args.period.
This patch changes the period variable in other places where it is used.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-clps711x.c

index 26ec24e457b12414cb9ca3a7cbe049f8a49f70e9..7e16b7def0dcb6ee6f32b4ab9b2a9689081c6cd7 100644 (file)
@@ -48,7 +48,7 @@ static void clps711x_pwm_update_val(struct clps711x_chip *priv, u32 n, u32 v)
 static unsigned int clps711x_get_duty(struct pwm_device *pwm, unsigned int v)
 {
        /* Duty cycle 0..15 max */
-       return DIV_ROUND_CLOSEST(v * 0xf, pwm_get_period(pwm));
+       return DIV_ROUND_CLOSEST(v * 0xf, pwm->args.period);
 }
 
 static int clps711x_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
@@ -71,7 +71,7 @@ static int clps711x_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
        struct clps711x_chip *priv = to_clps711x_chip(chip);
        unsigned int duty;
 
-       if (period_ns != pwm_get_period(pwm))
+       if (period_ns != pwm->args.period)
                return -EINVAL;
 
        duty = clps711x_get_duty(pwm, duty_ns);