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

pwm: atmel: Drop driver local locking

The two functions making use of the lock are only called transitively from
.apply(). Calls to .apply() are already serialized by the pwm core so the
lock in the driver has no effect and can safely be dropped.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/5ad3417aecd4dc6eca9699e21691e3725ea0bb87.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
62df4991 0191c80e

-12
-12
drivers/pwm/pwm-atmel.c
··· 91 91 * hardware. 92 92 */ 93 93 u32 update_pending; 94 - 95 - /* Protects .update_pending */ 96 - spinlock_t lock; 97 94 }; 98 95 99 96 static inline struct atmel_pwm_chip *to_atmel_pwm_chip(struct pwm_chip *chip) ··· 142 145 143 146 static void atmel_pwm_set_pending(struct atmel_pwm_chip *chip, unsigned int ch) 144 147 { 145 - spin_lock(&chip->lock); 146 - 147 148 /* 148 149 * Clear pending flags in hardware because otherwise there might still 149 150 * be a stale flag in ISR. ··· 149 154 atmel_pwm_update_pending(chip); 150 155 151 156 chip->update_pending |= (1 << ch); 152 - 153 - spin_unlock(&chip->lock); 154 157 } 155 158 156 159 static int atmel_pwm_test_pending(struct atmel_pwm_chip *chip, unsigned int ch) 157 160 { 158 161 int ret = 0; 159 - 160 - spin_lock(&chip->lock); 161 162 162 163 if (chip->update_pending & (1 << ch)) { 163 164 atmel_pwm_update_pending(chip); ··· 161 170 if (chip->update_pending & (1 << ch)) 162 171 ret = 1; 163 172 } 164 - 165 - spin_unlock(&chip->lock); 166 173 167 174 return ret; 168 175 } ··· 498 509 atmel_pwm->data = of_device_get_match_data(&pdev->dev); 499 510 500 511 atmel_pwm->update_pending = 0; 501 - spin_lock_init(&atmel_pwm->lock); 502 512 503 513 atmel_pwm->base = devm_platform_ioremap_resource(pdev, 0); 504 514 if (IS_ERR(atmel_pwm->base))