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: NUwe Kleine-König <u.kleine-koenig@pengutronix.de> Tested-by: NEmil Renner Berthing <emil.renner.berthing@canonical.com> Signed-off-by: NThierry Reding <thierry.reding@gmail.com>
Showing
想要评论请 注册 或 登录