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

Configure Feed

Select the types of activity you want to include in your feed.

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 <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/6d6ef0376ea0058b040eec3b257e324493a083f1.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
9470e7d1 33d73bde

+1 -16
+1 -16
drivers/pwm/pwm-microchip-core.c
··· 36 36 #include <linux/ktime.h> 37 37 #include <linux/math.h> 38 38 #include <linux/module.h> 39 - #include <linux/mutex.h> 40 39 #include <linux/of.h> 41 40 #include <linux/platform_device.h> 42 41 #include <linux/pwm.h> ··· 55 56 struct mchp_core_pwm_chip { 56 57 struct clk *clk; 57 58 void __iomem *base; 58 - struct mutex lock; /* protects the shared period */ 59 59 ktime_t update_timestamp; 60 60 u32 sync_update_mask; 61 61 u16 channel_enabled; ··· 358 360 const struct pwm_state *state) 359 361 { 360 362 struct mchp_core_pwm_chip *mchp_core_pwm = to_mchp_core_pwm(chip); 361 - int ret; 362 - 363 - mutex_lock(&mchp_core_pwm->lock); 364 363 365 364 mchp_core_pwm_wait_for_sync_update(mchp_core_pwm, pwm->hwpwm); 366 365 367 - ret = mchp_core_pwm_apply_locked(chip, pwm, state); 368 - 369 - mutex_unlock(&mchp_core_pwm->lock); 370 - 371 - return ret; 366 + return mchp_core_pwm_apply_locked(chip, pwm, state); 372 367 } 373 368 374 369 static int mchp_core_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ··· 371 380 u64 rate; 372 381 u16 prescale, period_steps; 373 382 u8 duty_steps, posedge, negedge; 374 - 375 - mutex_lock(&mchp_core_pwm->lock); 376 383 377 384 mchp_core_pwm_wait_for_sync_update(mchp_core_pwm, pwm->hwpwm); 378 385 ··· 403 414 404 415 posedge = readb_relaxed(mchp_core_pwm->base + MCHPCOREPWM_POSEDGE(pwm->hwpwm)); 405 416 negedge = readb_relaxed(mchp_core_pwm->base + MCHPCOREPWM_NEGEDGE(pwm->hwpwm)); 406 - 407 - mutex_unlock(&mchp_core_pwm->lock); 408 417 409 418 if (negedge == posedge) { 410 419 state->duty_cycle = state->period; ··· 455 468 if (of_property_read_u32(pdev->dev.of_node, "microchip,sync-update-mask", 456 469 &mchp_core_pwm->sync_update_mask)) 457 470 mchp_core_pwm->sync_update_mask = 0; 458 - 459 - mutex_init(&mchp_core_pwm->lock); 460 471 461 472 chip->ops = &mchp_core_pwm_ops; 462 473