Skip to content

Commit 33d73bd

Browse files
ukleinekUwe Kleine-König
authored andcommitted
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 1cc2e1f ("pwm: Add more locking") the mutexes have no effect apart from runtime overhead. Drop them. Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Vladimir Zapolskiy <[email protected]> Link: https://lore.kernel.org/r/4f7a2da37adbfe4743564245119045826d86eca6.1750788649.git.u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent 7c1a529 commit 33d73bd

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

drivers/pwm/pwm-lpc18xx-sct.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ struct lpc18xx_pwm_chip {
100100
u64 max_period_ns;
101101
unsigned int period_event;
102102
unsigned long event_map;
103-
struct mutex res_lock;
104-
struct mutex period_lock;
105103
struct lpc18xx_pwm_data channeldata[LPC18XX_NUM_PWMS];
106104
};
107105

@@ -129,8 +127,6 @@ static void lpc18xx_pwm_set_conflict_res(struct lpc18xx_pwm_chip *lpc18xx_pwm,
129127
{
130128
u32 val;
131129

132-
mutex_lock(&lpc18xx_pwm->res_lock);
133-
134130
/*
135131
* Simultaneous set and clear may happen on an output, that is the case
136132
* when duty_ns == period_ns. LPC18xx SCT allows to set a conflict
@@ -140,8 +136,6 @@ static void lpc18xx_pwm_set_conflict_res(struct lpc18xx_pwm_chip *lpc18xx_pwm,
140136
val &= ~LPC18XX_PWM_RES_MASK(pwm->hwpwm);
141137
val |= LPC18XX_PWM_RES(pwm->hwpwm, action);
142138
lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_RES_BASE, val);
143-
144-
mutex_unlock(&lpc18xx_pwm->res_lock);
145139
}
146140

147141
static void lpc18xx_pwm_config_period(struct pwm_chip *chip, u64 period_ns)
@@ -200,8 +194,6 @@ static int lpc18xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
200194
return -ERANGE;
201195
}
202196

203-
mutex_lock(&lpc18xx_pwm->period_lock);
204-
205197
requested_events = bitmap_weight(&lpc18xx_pwm->event_map,
206198
LPC18XX_PWM_EVENT_MAX);
207199

@@ -214,7 +206,6 @@ static int lpc18xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
214206
lpc18xx_pwm->period_ns) {
215207
dev_err(pwmchip_parent(chip), "conflicting period requested for PWM %u\n",
216208
pwm->hwpwm);
217-
mutex_unlock(&lpc18xx_pwm->period_lock);
218209
return -EBUSY;
219210
}
220211

@@ -224,8 +215,6 @@ static int lpc18xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
224215
lpc18xx_pwm_config_period(chip, period_ns);
225216
}
226217

227-
mutex_unlock(&lpc18xx_pwm->period_lock);
228-
229218
lpc18xx_pwm_config_duty(chip, pwm, duty_ns);
230219

231220
return 0;
@@ -377,9 +366,6 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)
377366
if (lpc18xx_pwm->clk_rate > NSEC_PER_SEC)
378367
return dev_err_probe(&pdev->dev, -EINVAL, "pwm clock to fast\n");
379368

380-
mutex_init(&lpc18xx_pwm->res_lock);
381-
mutex_init(&lpc18xx_pwm->period_lock);
382-
383369
lpc18xx_pwm->max_period_ns =
384370
mul_u64_u64_div_u64(NSEC_PER_SEC, LPC18XX_PWM_TIMER_MAX, lpc18xx_pwm->clk_rate);
385371

0 commit comments

Comments
 (0)