Skip to content

Commit 9470e7d

Browse files
ukleinekUwe Kleine-König
authored andcommitted
pwm: microchip-core: Drop driver local locking
The pwm core already serializes .apply() and .get_state(), so the driver local lock is always free and adds no protection. Drop it. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/6d6ef0376ea0058b040eec3b257e324493a083f1.1750788649.git.u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent 33d73bd commit 9470e7d

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

drivers/pwm/pwm-microchip-core.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <linux/ktime.h>
3737
#include <linux/math.h>
3838
#include <linux/module.h>
39-
#include <linux/mutex.h>
4039
#include <linux/of.h>
4140
#include <linux/platform_device.h>
4241
#include <linux/pwm.h>
@@ -56,7 +55,6 @@
5655
struct mchp_core_pwm_chip {
5756
struct clk *clk;
5857
void __iomem *base;
59-
struct mutex lock; /* protects the shared period */
6058
ktime_t update_timestamp;
6159
u32 sync_update_mask;
6260
u16 channel_enabled;
@@ -360,17 +358,10 @@ static int mchp_core_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
360358
const struct pwm_state *state)
361359
{
362360
struct mchp_core_pwm_chip *mchp_core_pwm = to_mchp_core_pwm(chip);
363-
int ret;
364-
365-
mutex_lock(&mchp_core_pwm->lock);
366361

367362
mchp_core_pwm_wait_for_sync_update(mchp_core_pwm, pwm->hwpwm);
368363

369-
ret = mchp_core_pwm_apply_locked(chip, pwm, state);
370-
371-
mutex_unlock(&mchp_core_pwm->lock);
372-
373-
return ret;
364+
return mchp_core_pwm_apply_locked(chip, pwm, state);
374365
}
375366

376367
static int mchp_core_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
@@ -381,8 +372,6 @@ static int mchp_core_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm
381372
u16 prescale, period_steps;
382373
u8 duty_steps, posedge, negedge;
383374

384-
mutex_lock(&mchp_core_pwm->lock);
385-
386375
mchp_core_pwm_wait_for_sync_update(mchp_core_pwm, pwm->hwpwm);
387376

388377
if (mchp_core_pwm->channel_enabled & (1 << pwm->hwpwm))
@@ -415,8 +404,6 @@ static int mchp_core_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm
415404
posedge = readb_relaxed(mchp_core_pwm->base + MCHPCOREPWM_POSEDGE(pwm->hwpwm));
416405
negedge = readb_relaxed(mchp_core_pwm->base + MCHPCOREPWM_NEGEDGE(pwm->hwpwm));
417406

418-
mutex_unlock(&mchp_core_pwm->lock);
419-
420407
if (negedge == posedge) {
421408
state->duty_cycle = state->period;
422409
state->period *= 2;
@@ -469,8 +456,6 @@ static int mchp_core_pwm_probe(struct platform_device *pdev)
469456
&mchp_core_pwm->sync_update_mask))
470457
mchp_core_pwm->sync_update_mask = 0;
471458

472-
mutex_init(&mchp_core_pwm->lock);
473-
474459
chip->ops = &mchp_core_pwm_ops;
475460

476461
mchp_core_pwm->channel_enabled = readb_relaxed(mchp_core_pwm->base + MCHPCOREPWM_EN(0));

0 commit comments

Comments
 (0)