37
37
#include <linux/err.h>
38
38
#include <linux/kernel.h>
39
39
#include <linux/module.h>
40
- #include <linux/mutex.h>
41
40
#include <linux/of.h>
42
41
#include <linux/of_platform.h>
43
42
#include <clocksource/timer-ti-dm.h>
55
54
* struct pwm_omap_dmtimer_chip - Structure representing a pwm chip
56
55
* corresponding to omap dmtimer.
57
56
* @chip: PWM chip structure representing PWM controller
58
- * @mutex: Mutex to protect pwm apply state
59
57
* @dm_timer: Pointer to omap dm timer.
60
58
* @pdata: Pointer to omap dm timer ops.
61
59
* @dm_timer_pdev: Pointer to omap dm timer platform device
62
60
*/
63
61
struct pwm_omap_dmtimer_chip {
64
62
struct pwm_chip chip ;
65
63
/* Mutex to protect pwm apply state */
66
- struct mutex mutex ;
67
64
struct omap_dm_timer * dm_timer ;
68
65
const struct omap_dm_timer_ops * pdata ;
69
66
struct platform_device * dm_timer_pdev ;
@@ -277,13 +274,11 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip,
277
274
const struct pwm_state * state )
278
275
{
279
276
struct pwm_omap_dmtimer_chip * omap = to_pwm_omap_dmtimer_chip (chip );
280
- int ret = 0 ;
281
-
282
- mutex_lock (& omap -> mutex );
277
+ int ret ;
283
278
284
279
if (pwm_omap_dmtimer_is_enabled (omap ) && !state -> enabled ) {
285
280
omap -> pdata -> stop (omap -> dm_timer );
286
- goto unlock_mutex ;
281
+ return 0 ;
287
282
}
288
283
289
284
if (pwm_omap_dmtimer_polarity (omap ) != state -> polarity )
@@ -292,7 +287,7 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip,
292
287
ret = pwm_omap_dmtimer_config (chip , pwm , state -> duty_cycle ,
293
288
state -> period );
294
289
if (ret )
295
- goto unlock_mutex ;
290
+ return ret ;
296
291
297
292
if (!pwm_omap_dmtimer_is_enabled (omap ) && state -> enabled ) {
298
293
omap -> pdata -> set_pwm (omap -> dm_timer ,
@@ -303,10 +298,7 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip,
303
298
pwm_omap_dmtimer_start (omap );
304
299
}
305
300
306
- unlock_mutex :
307
- mutex_unlock (& omap -> mutex );
308
-
309
- return ret ;
301
+ return 0 ;
310
302
}
311
303
312
304
static const struct pwm_ops pwm_omap_dmtimer_ops = {
@@ -404,8 +396,6 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
404
396
omap -> chip .ops = & pwm_omap_dmtimer_ops ;
405
397
omap -> chip .npwm = 1 ;
406
398
407
- mutex_init (& omap -> mutex );
408
-
409
399
ret = pwmchip_add (& omap -> chip );
410
400
if (ret < 0 ) {
411
401
dev_err (& pdev -> dev , "failed to register PWM\n" );
@@ -452,8 +442,6 @@ static void pwm_omap_dmtimer_remove(struct platform_device *pdev)
452
442
omap -> pdata -> free (omap -> dm_timer );
453
443
454
444
put_device (& omap -> dm_timer_pdev -> dev );
455
-
456
- mutex_destroy (& omap -> mutex );
457
445
}
458
446
459
447
static const struct of_device_id pwm_omap_dmtimer_of_match [] = {
0 commit comments