Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pwm-sun4i: Convert "next_period" to local variable

Its value is calculated in sun4i_pwm_apply() and is used only there.

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

authored by

Max Kellermann and committed by
Thierry Reding
c7078972 b2d229d4

+4 -5
+4 -5
drivers/pwm/pwm-sun4i.c
··· 89 89 void __iomem *base; 90 90 spinlock_t ctrl_lock; 91 91 const struct sun4i_pwm_data *data; 92 - unsigned long next_period[2]; 93 92 }; 94 93 95 94 static inline struct sun4i_pwm_chip *to_sun4i_pwm_chip(struct pwm_chip *chip) ··· 236 237 int ret; 237 238 unsigned int delay_us, prescaler = 0; 238 239 unsigned long now; 240 + unsigned long next_period; 239 241 bool bypass; 240 242 241 243 pwm_get_state(pwm, &cstate); ··· 284 284 285 285 val = (duty & PWM_DTY_MASK) | PWM_PRD(period); 286 286 sun4i_pwm_writel(sun4i_pwm, val, PWM_CH_PRD(pwm->hwpwm)); 287 - sun4i_pwm->next_period[pwm->hwpwm] = jiffies + 287 + next_period = jiffies + 288 288 nsecs_to_jiffies(cstate.period + 1000); 289 289 290 290 if (state->polarity != PWM_POLARITY_NORMAL) ··· 306 306 307 307 /* We need a full period to elapse before disabling the channel. */ 308 308 now = jiffies; 309 - if (time_before(now, sun4i_pwm->next_period[pwm->hwpwm])) { 310 - delay_us = jiffies_to_usecs(sun4i_pwm->next_period[pwm->hwpwm] - 311 - now); 309 + if (time_before(now, next_period)) { 310 + delay_us = jiffies_to_usecs(next_period - now); 312 311 if ((delay_us / 500) > MAX_UDELAY_MS) 313 312 msleep(delay_us / 1000 + 1); 314 313 else