pwm: sifive: Reduce time the controller lock is held
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 21 Jul 2022 10:31:25 +0000 (12:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 12:57:22 +0000 (13:57 +0100)
commit852703ed6d819c8c6db771f00c508ab32311897e
tree2e15656862a43261f33b3084834dc7198df10dc4
parent3a75866a5ceff5d4fdd5471e06c4c4d03e0298b3
pwm: sifive: Reduce time the controller lock is held

[ Upstream commit 0f02f491b786143f08eb19840f1cf4f12aec6dee ]

The lock is only to serialize access and update to user_count and
approx_period between different PWMs served by the same pwm_chip.
So the lock needs only to be taken during the check if the (chip global)
period can and/or needs to be changed.

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>
Stable-dep-of: 334c7b13d383 ("pwm: sifive: Always let the first pwm_apply_state succeed")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pwm/pwm-sifive.c