diff options
author | Uwe Kleine-König <u.kleine-koenig@baylibre.com> | 2024-07-09 13:18:05 +0300 |
---|---|---|
committer | Uwe Kleine-König <ukleinek@kernel.org> | 2024-07-10 18:51:04 +0300 |
commit | 37f7707077f5ea2515bf4b1dc7fad43f8e12993e (patch) | |
tree | 90f97bd93a52b38895a567a991fe65a0df575117 /kernel/gcov | |
parent | 32207e9ddf7400a5676cb27559560cadee062577 (diff) | |
download | linux-37f7707077f5ea2515bf4b1dc7fad43f8e12993e.tar.xz |
pwm: atmel-tcb: Fix race condition and convert to guards
The hardware only supports a single period length for both PWM outputs. So
atmel_tcb_pwm_config() checks the configuration of the other output if it's
compatible with the currently requested setting. The register values are
then actually updated in atmel_tcb_pwm_enable(). To make this race free
the lock must be held during the whole process, so grab the lock in
.apply() instead of individually in atmel_tcb_pwm_disable() and
atmel_tcb_pwm_enable() which then also covers atmel_tcb_pwm_config().
To simplify handling, use the guard helper to let the compiler care for
unlocking. Otherwise unlocking would be more difficult as there is more
than one exit path in atmel_tcb_pwm_apply().
Fixes: 9421bade0765 ("pwm: atmel: add Timer Counter Block PWM driver")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Link: https://lore.kernel.org/r/20240709101806.52394-3-u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Diffstat (limited to 'kernel/gcov')
0 files changed, 0 insertions, 0 deletions