pwm: Mark free pwm IDs as used in alloc_pwms()
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 2 Dec 2022 18:35:11 +0000 (19:35 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Tue, 6 Dec 2022 11:46:06 +0000 (12:46 +0100)
commit4034e5944884dca1673e52cc392b07d0d35b6ff0
tree44bb994f69bcf77b9231811ecc1a66e65b6fb69d
parentc8135b5174145a65c72c4303f2752cc8cecf8d08
pwm: Mark free pwm IDs as used in alloc_pwms()

alloc_pwms() only identified a free range of IDs and this range was marked
as used only later by pwmchip_add(). Instead let alloc_pwms() already do
the marking (which makes the function actually allocating the range and so
justifies the function name). This way access to the allocated_pwms
bitfield is limited to two functions only.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221117211143.3817381-4-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/core.c