Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pwm: sun4i: Drop driver local locking

The pwm core serializes calls to .apply(), so the driver lock doesn't
add any protection and can safely be dropped.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/87b71c46b82b787959f0cea314d3010f16a50a29.1750788649.git.u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>

authored by

Uwe Kleine-König and committed by
Uwe Kleine-König
dce0df8a d2c8bdc7

-10
-10
drivers/pwm/pwm-sun4i.c
··· 21 21 #include <linux/pwm.h> 22 22 #include <linux/reset.h> 23 23 #include <linux/slab.h> 24 - #include <linux/spinlock.h> 25 24 #include <linux/time.h> 26 25 27 26 #define PWM_CTRL_REG 0x0 ··· 84 85 struct clk *clk; 85 86 struct reset_control *rst; 86 87 void __iomem *base; 87 - spinlock_t ctrl_lock; 88 88 const struct sun4i_pwm_data *data; 89 89 }; 90 90 ··· 256 258 return ret; 257 259 } 258 260 259 - spin_lock(&sun4ichip->ctrl_lock); 260 261 ctrl = sun4i_pwm_readl(sun4ichip, PWM_CTRL_REG); 261 262 262 263 if (sun4ichip->data->has_direct_mod_clk_output) { ··· 263 266 ctrl |= BIT_CH(PWM_BYPASS, pwm->hwpwm); 264 267 /* We can skip other parameter */ 265 268 sun4i_pwm_writel(sun4ichip, ctrl, PWM_CTRL_REG); 266 - spin_unlock(&sun4ichip->ctrl_lock); 267 269 return 0; 268 270 } 269 271 ··· 293 297 294 298 sun4i_pwm_writel(sun4ichip, ctrl, PWM_CTRL_REG); 295 299 296 - spin_unlock(&sun4ichip->ctrl_lock); 297 - 298 300 if (state->enabled) 299 301 return 0; 300 302 ··· 303 309 else 304 310 usleep_range(delay_us, delay_us * 2); 305 311 306 - spin_lock(&sun4ichip->ctrl_lock); 307 312 ctrl = sun4i_pwm_readl(sun4ichip, PWM_CTRL_REG); 308 313 ctrl &= ~BIT_CH(PWM_CLK_GATING, pwm->hwpwm); 309 314 ctrl &= ~BIT_CH(PWM_EN, pwm->hwpwm); 310 315 sun4i_pwm_writel(sun4ichip, ctrl, PWM_CTRL_REG); 311 - spin_unlock(&sun4ichip->ctrl_lock); 312 316 313 317 clk_disable_unprepare(sun4ichip->clk); 314 318 ··· 447 455 } 448 456 449 457 chip->ops = &sun4i_pwm_ops; 450 - 451 - spin_lock_init(&sun4ichip->ctrl_lock); 452 458 453 459 ret = pwmchip_add(chip); 454 460 if (ret < 0) {