Skip to content

Commit dce0df8

Browse files
ukleinekUwe Kleine-König
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/87b71c46b82b787959f0cea314d3010f16a50a29.1750788649.git.u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent d2c8bdc commit dce0df8

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

drivers/pwm/pwm-sun4i.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <linux/pwm.h>
2222
#include <linux/reset.h>
2323
#include <linux/slab.h>
24-
#include <linux/spinlock.h>
2524
#include <linux/time.h>
2625

2726
#define PWM_CTRL_REG 0x0
@@ -85,7 +84,6 @@ struct sun4i_pwm_chip {
8584
struct clk *clk;
8685
struct reset_control *rst;
8786
void __iomem *base;
88-
spinlock_t ctrl_lock;
8987
const struct sun4i_pwm_data *data;
9088
};
9189

@@ -258,15 +256,13 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
258256
return ret;
259257
}
260258

261-
spin_lock(&sun4ichip->ctrl_lock);
262259
ctrl = sun4i_pwm_readl(sun4ichip, PWM_CTRL_REG);
263260

264261
if (sun4ichip->data->has_direct_mod_clk_output) {
265262
if (bypass) {
266263
ctrl |= BIT_CH(PWM_BYPASS, pwm->hwpwm);
267264
/* We can skip other parameter */
268265
sun4i_pwm_writel(sun4ichip, ctrl, PWM_CTRL_REG);
269-
spin_unlock(&sun4ichip->ctrl_lock);
270266
return 0;
271267
}
272268

@@ -297,8 +293,6 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
297293

298294
sun4i_pwm_writel(sun4ichip, ctrl, PWM_CTRL_REG);
299295

300-
spin_unlock(&sun4ichip->ctrl_lock);
301-
302296
if (state->enabled)
303297
return 0;
304298

@@ -309,12 +303,10 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
309303
else
310304
usleep_range(delay_us, delay_us * 2);
311305

312-
spin_lock(&sun4ichip->ctrl_lock);
313306
ctrl = sun4i_pwm_readl(sun4ichip, PWM_CTRL_REG);
314307
ctrl &= ~BIT_CH(PWM_CLK_GATING, pwm->hwpwm);
315308
ctrl &= ~BIT_CH(PWM_EN, pwm->hwpwm);
316309
sun4i_pwm_writel(sun4ichip, ctrl, PWM_CTRL_REG);
317-
spin_unlock(&sun4ichip->ctrl_lock);
318310

319311
clk_disable_unprepare(sun4ichip->clk);
320312

@@ -456,8 +448,6 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
456448

457449
chip->ops = &sun4i_pwm_ops;
458450

459-
spin_lock_init(&sun4ichip->ctrl_lock);
460-
461451
ret = pwmchip_add(chip);
462452
if (ret < 0) {
463453
dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret);

0 commit comments

Comments
 (0)