mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
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: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
parent
46cfec2a86
commit
01b571fbba
@ -37,7 +37,6 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <clocksource/timer-ti-dm.h>
|
||||
@ -55,7 +54,6 @@
|
||||
* struct pwm_omap_dmtimer_chip - Structure representing a pwm chip
|
||||
* corresponding to omap dmtimer.
|
||||
* @chip: PWM chip structure representing PWM controller
|
||||
* @mutex: Mutex to protect pwm apply state
|
||||
* @dm_timer: Pointer to omap dm timer.
|
||||
* @pdata: Pointer to omap dm timer ops.
|
||||
* @dm_timer_pdev: Pointer to omap dm timer platform device
|
||||
@ -63,7 +61,6 @@
|
||||
struct pwm_omap_dmtimer_chip {
|
||||
struct pwm_chip chip;
|
||||
/* Mutex to protect pwm apply state */
|
||||
struct mutex mutex;
|
||||
struct omap_dm_timer *dm_timer;
|
||||
const struct omap_dm_timer_ops *pdata;
|
||||
struct platform_device *dm_timer_pdev;
|
||||
@ -277,13 +274,11 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip,
|
||||
const struct pwm_state *state)
|
||||
{
|
||||
struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip);
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&omap->mutex);
|
||||
int ret;
|
||||
|
||||
if (pwm_omap_dmtimer_is_enabled(omap) && !state->enabled) {
|
||||
omap->pdata->stop(omap->dm_timer);
|
||||
goto unlock_mutex;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pwm_omap_dmtimer_polarity(omap) != state->polarity)
|
||||
@ -292,7 +287,7 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip,
|
||||
ret = pwm_omap_dmtimer_config(chip, pwm, state->duty_cycle,
|
||||
state->period);
|
||||
if (ret)
|
||||
goto unlock_mutex;
|
||||
return ret;
|
||||
|
||||
if (!pwm_omap_dmtimer_is_enabled(omap) && state->enabled) {
|
||||
omap->pdata->set_pwm(omap->dm_timer,
|
||||
@ -303,10 +298,7 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip,
|
||||
pwm_omap_dmtimer_start(omap);
|
||||
}
|
||||
|
||||
unlock_mutex:
|
||||
mutex_unlock(&omap->mutex);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct pwm_ops pwm_omap_dmtimer_ops = {
|
||||
@ -404,8 +396,6 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
|
||||
omap->chip.ops = &pwm_omap_dmtimer_ops;
|
||||
omap->chip.npwm = 1;
|
||||
|
||||
mutex_init(&omap->mutex);
|
||||
|
||||
ret = pwmchip_add(&omap->chip);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "failed to register PWM\n");
|
||||
@ -452,8 +442,6 @@ static void pwm_omap_dmtimer_remove(struct platform_device *pdev)
|
||||
omap->pdata->free(omap->dm_timer);
|
||||
|
||||
put_device(&omap->dm_timer_pdev->dev);
|
||||
|
||||
mutex_destroy(&omap->mutex);
|
||||
}
|
||||
|
||||
static const struct of_device_id pwm_omap_dmtimer_of_match[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user