pwm: mxs: Avoid a division in mxs_pwm_apply()
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Fri, 4 Oct 2019 13:32:06 +0000 (15:32 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Wed, 8 Jan 2020 12:35:12 +0000 (13:35 +0100)
commit3c64ed74d619c25c65abb1fcafcb1aff835867d5
treeae8772eeac8e186dbc916dcfef04a2fae3fc77b1
parent366486e0afaa115ec456db124fc07d824a1c1fb1
pwm: mxs: Avoid a division in mxs_pwm_apply()

Since the divisor is not a compile-time constant (unless gcc somehow
decided to unroll the loop PERIOD_CDIV_MAX times), this does a
somewhat expensive 32/32 division. Replace that with a right shift.

We still have a 64/32 division just below, but at least in that
case the divisor is compile-time constant.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-mxs.c