]> git.baikalelectronics.ru Git - kernel.git/commit
pwm: sifive: Simplify offset calculation for PWMCMP registers
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 21 Jul 2022 10:31:23 +0000 (12:31 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Fri, 29 Jul 2022 11:40:40 +0000 (13:40 +0200)
commit781ed1297dc3d067ef8bffe35e8050b077780539
tree8effd776b1e52377101ee03da9e5c2f97c0a5485
parentb82cdc94e3559bed1b50f414ce043835b5d88f64
pwm: sifive: Simplify offset calculation for PWMCMP registers

Instead of explicitly using PWM_SIFIVE_PWMCMP0 + pwm->hwpwm *
PWM_SIFIVE_SIZE_PWMCMP for each access to one of the PWMCMP registers,
introduce a macro that takes the hwpwm id as parameter.

For the register definition using a plain 4 instead of the cpp constant
PWM_SIFIVE_SIZE_PWMCMP is easier to read, so define the offset macro
without the constant. The latter can then be dropped as there are no
users left.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-sifive.c