Commit 01b571fb authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Thierry Reding

pwm: omap-dmtimer: Drop locking

The pwm driver only provides a single PWM line, so there are no concurrent
calls of the callbacks from different consumers. A single consumer is
expected not to do concurrent calls into the pwm framework. So there is
nothing to serialize and the lock can go away.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 46cfec2a
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <clocksource/timer-ti-dm.h> #include <clocksource/timer-ti-dm.h>
...@@ -55,7 +54,6 @@ ...@@ -55,7 +54,6 @@
* struct pwm_omap_dmtimer_chip - Structure representing a pwm chip * struct pwm_omap_dmtimer_chip - Structure representing a pwm chip
* corresponding to omap dmtimer. * corresponding to omap dmtimer.
* @chip: PWM chip structure representing PWM controller * @chip: PWM chip structure representing PWM controller
* @mutex: Mutex to protect pwm apply state
* @dm_timer: Pointer to omap dm timer. * @dm_timer: Pointer to omap dm timer.
* @pdata: Pointer to omap dm timer ops. * @pdata: Pointer to omap dm timer ops.
* @dm_timer_pdev: Pointer to omap dm timer platform device * @dm_timer_pdev: Pointer to omap dm timer platform device
...@@ -63,7 +61,6 @@ ...@@ -63,7 +61,6 @@
struct pwm_omap_dmtimer_chip { struct pwm_omap_dmtimer_chip {
struct pwm_chip chip; struct pwm_chip chip;
/* Mutex to protect pwm apply state */ /* Mutex to protect pwm apply state */
struct mutex mutex;
struct omap_dm_timer *dm_timer; struct omap_dm_timer *dm_timer;
const struct omap_dm_timer_ops *pdata; const struct omap_dm_timer_ops *pdata;
struct platform_device *dm_timer_pdev; struct platform_device *dm_timer_pdev;
...@@ -277,13 +274,11 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip, ...@@ -277,13 +274,11 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip,
const struct pwm_state *state) const struct pwm_state *state)
{ {
struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip);
int ret = 0; int ret;
mutex_lock(&omap->mutex);
if (pwm_omap_dmtimer_is_enabled(omap) && !state->enabled) { if (pwm_omap_dmtimer_is_enabled(omap) && !state->enabled) {
omap->pdata->stop(omap->dm_timer); omap->pdata->stop(omap->dm_timer);
goto unlock_mutex; return 0;
} }
if (pwm_omap_dmtimer_polarity(omap) != state->polarity) if (pwm_omap_dmtimer_polarity(omap) != state->polarity)
...@@ -292,7 +287,7 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip, ...@@ -292,7 +287,7 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip,
ret = pwm_omap_dmtimer_config(chip, pwm, state->duty_cycle, ret = pwm_omap_dmtimer_config(chip, pwm, state->duty_cycle,
state->period); state->period);
if (ret) if (ret)
goto unlock_mutex; return ret;
if (!pwm_omap_dmtimer_is_enabled(omap) && state->enabled) { if (!pwm_omap_dmtimer_is_enabled(omap) && state->enabled) {
omap->pdata->set_pwm(omap->dm_timer, omap->pdata->set_pwm(omap->dm_timer,
...@@ -303,10 +298,7 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip, ...@@ -303,10 +298,7 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip,
pwm_omap_dmtimer_start(omap); pwm_omap_dmtimer_start(omap);
} }
unlock_mutex: return 0;
mutex_unlock(&omap->mutex);
return ret;
} }
static const struct pwm_ops pwm_omap_dmtimer_ops = { static const struct pwm_ops pwm_omap_dmtimer_ops = {
...@@ -404,8 +396,6 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) ...@@ -404,8 +396,6 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
omap->chip.ops = &pwm_omap_dmtimer_ops; omap->chip.ops = &pwm_omap_dmtimer_ops;
omap->chip.npwm = 1; omap->chip.npwm = 1;
mutex_init(&omap->mutex);
ret = pwmchip_add(&omap->chip); ret = pwmchip_add(&omap->chip);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to register PWM\n"); dev_err(&pdev->dev, "failed to register PWM\n");
...@@ -452,8 +442,6 @@ static void pwm_omap_dmtimer_remove(struct platform_device *pdev) ...@@ -452,8 +442,6 @@ static void pwm_omap_dmtimer_remove(struct platform_device *pdev)
omap->pdata->free(omap->dm_timer); omap->pdata->free(omap->dm_timer);
put_device(&omap->dm_timer_pdev->dev); put_device(&omap->dm_timer_pdev->dev);
mutex_destroy(&omap->mutex);
} }
static const struct of_device_id pwm_omap_dmtimer_of_match[] = { static const struct of_device_id pwm_omap_dmtimer_of_match[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment