@@ -92,7 +92,6 @@ struct sti_pwm_chip {
92
92
struct pwm_device * cur ;
93
93
unsigned long configured ;
94
94
unsigned int en_count ;
95
- struct mutex sti_pwm_lock ; /* To sync between enable/disable calls */
96
95
void __iomem * mmio ;
97
96
};
98
97
@@ -244,55 +243,46 @@ static int sti_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
244
243
{
245
244
struct sti_pwm_chip * pc = to_sti_pwmchip (chip );
246
245
struct device * dev = pc -> dev ;
247
- int ret = 0 ;
246
+ int ret ;
248
247
249
248
/*
250
249
* Since we have a common enable for all PWM devices, do not enable if
251
250
* already enabled.
252
251
*/
253
- mutex_lock (& pc -> sti_pwm_lock );
254
252
255
253
if (!pc -> en_count ) {
256
254
ret = clk_enable (pc -> pwm_clk );
257
255
if (ret )
258
- goto out ;
256
+ return ret ;
259
257
260
258
ret = clk_enable (pc -> cpt_clk );
261
259
if (ret )
262
- goto out ;
260
+ return ret ;
263
261
264
262
ret = regmap_field_write (pc -> pwm_out_en , 1 );
265
263
if (ret ) {
266
264
dev_err (dev , "failed to enable PWM device %u: %d\n" ,
267
265
pwm -> hwpwm , ret );
268
- goto out ;
266
+ return ret ;
269
267
}
270
268
}
271
269
272
270
pc -> en_count ++ ;
273
271
274
- out :
275
- mutex_unlock (& pc -> sti_pwm_lock );
276
- return ret ;
272
+ return 0 ;
277
273
}
278
274
279
275
static void sti_pwm_disable (struct pwm_chip * chip , struct pwm_device * pwm )
280
276
{
281
277
struct sti_pwm_chip * pc = to_sti_pwmchip (chip );
282
278
283
- mutex_lock (& pc -> sti_pwm_lock );
284
-
285
- if (-- pc -> en_count ) {
286
- mutex_unlock (& pc -> sti_pwm_lock );
279
+ if (-- pc -> en_count )
287
280
return ;
288
- }
289
281
290
282
regmap_field_write (pc -> pwm_out_en , 0 );
291
283
292
284
clk_disable (pc -> pwm_clk );
293
285
clk_disable (pc -> cpt_clk );
294
-
295
- mutex_unlock (& pc -> sti_pwm_lock );
296
286
}
297
287
298
288
static void sti_pwm_free (struct pwm_chip * chip , struct pwm_device * pwm )
@@ -594,7 +584,6 @@ static int sti_pwm_probe(struct platform_device *pdev)
594
584
595
585
pc -> dev = dev ;
596
586
pc -> en_count = 0 ;
597
- mutex_init (& pc -> sti_pwm_lock );
598
587
599
588
ret = sti_pwm_probe_regmap (pc );
600
589
if (ret )
0 commit comments