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

pwm: lpc18xx-sct: Drop driver local locking

Both mutexes are only used in one function each. These functions are only
called by the .apply() callback. As the .apply() calls are serialized by
the core since commit 1cc2e1faafb3 ("pwm: Add more locking") the mutexes
have no effect apart from runtime overhead. Drop them.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Link: https://lore.kernel.org/r/4f7a2da37adbfe4743564245119045826d86eca6.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
33d73bde 7c1a529a

-14
-14
drivers/pwm/pwm-lpc18xx-sct.c
··· 100 100 u64 max_period_ns; 101 101 unsigned int period_event; 102 102 unsigned long event_map; 103 - struct mutex res_lock; 104 - struct mutex period_lock; 105 103 struct lpc18xx_pwm_data channeldata[LPC18XX_NUM_PWMS]; 106 104 }; 107 105 ··· 127 129 { 128 130 u32 val; 129 131 130 - mutex_lock(&lpc18xx_pwm->res_lock); 131 - 132 132 /* 133 133 * Simultaneous set and clear may happen on an output, that is the case 134 134 * when duty_ns == period_ns. LPC18xx SCT allows to set a conflict ··· 136 140 val &= ~LPC18XX_PWM_RES_MASK(pwm->hwpwm); 137 141 val |= LPC18XX_PWM_RES(pwm->hwpwm, action); 138 142 lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_RES_BASE, val); 139 - 140 - mutex_unlock(&lpc18xx_pwm->res_lock); 141 143 } 142 144 143 145 static void lpc18xx_pwm_config_period(struct pwm_chip *chip, u64 period_ns) ··· 194 200 return -ERANGE; 195 201 } 196 202 197 - mutex_lock(&lpc18xx_pwm->period_lock); 198 - 199 203 requested_events = bitmap_weight(&lpc18xx_pwm->event_map, 200 204 LPC18XX_PWM_EVENT_MAX); 201 205 ··· 206 214 lpc18xx_pwm->period_ns) { 207 215 dev_err(pwmchip_parent(chip), "conflicting period requested for PWM %u\n", 208 216 pwm->hwpwm); 209 - mutex_unlock(&lpc18xx_pwm->period_lock); 210 217 return -EBUSY; 211 218 } 212 219 ··· 214 223 lpc18xx_pwm->period_ns = period_ns; 215 224 lpc18xx_pwm_config_period(chip, period_ns); 216 225 } 217 - 218 - mutex_unlock(&lpc18xx_pwm->period_lock); 219 226 220 227 lpc18xx_pwm_config_duty(chip, pwm, duty_ns); 221 228 ··· 365 376 */ 366 377 if (lpc18xx_pwm->clk_rate > NSEC_PER_SEC) 367 378 return dev_err_probe(&pdev->dev, -EINVAL, "pwm clock to fast\n"); 368 - 369 - mutex_init(&lpc18xx_pwm->res_lock); 370 - mutex_init(&lpc18xx_pwm->period_lock); 371 379 372 380 lpc18xx_pwm->max_period_ns = 373 381 mul_u64_u64_div_u64(NSEC_PER_SEC, LPC18XX_PWM_TIMER_MAX, lpc18xx_pwm->clk_rate);