diff options
Diffstat (limited to 'drivers/hwmon/sfctemp.c')
| -rw-r--r-- | drivers/hwmon/sfctemp.c | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/drivers/hwmon/sfctemp.c b/drivers/hwmon/sfctemp.c index fb1da93383d7..b78b2c099a12 100644 --- a/drivers/hwmon/sfctemp.c +++ b/drivers/hwmon/sfctemp.c @@ -10,7 +10,6 @@ #include <linux/hwmon.h> #include <linux/io.h> #include <linux/module.h> -#include <linux/mutex.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/reset.h> @@ -49,8 +48,6 @@ #define SFCTEMP_K1000 81100L struct sfctemp { - /* serialize access to hardware register and enabled below */ - struct mutex lock; void __iomem *regs; struct clk *clk_sense; struct clk *clk_bus; @@ -92,15 +89,14 @@ static void sfctemp_stop(struct sfctemp *sfctemp) static int sfctemp_enable(struct sfctemp *sfctemp) { - int ret = 0; + int ret; - mutex_lock(&sfctemp->lock); if (sfctemp->enabled) - goto done; + return 0; ret = clk_prepare_enable(sfctemp->clk_bus); if (ret) - goto err; + return ret; ret = reset_control_deassert(sfctemp->rst_bus); if (ret) goto err_disable_bus; @@ -115,9 +111,7 @@ static int sfctemp_enable(struct sfctemp *sfctemp) sfctemp_power_up(sfctemp); sfctemp_run(sfctemp); sfctemp->enabled = true; -done: - mutex_unlock(&sfctemp->lock); - return ret; + return 0; err_disable_sense: clk_disable_unprepare(sfctemp->clk_sense); @@ -125,16 +119,13 @@ err_assert_bus: reset_control_assert(sfctemp->rst_bus); err_disable_bus: clk_disable_unprepare(sfctemp->clk_bus); -err: - mutex_unlock(&sfctemp->lock); return ret; } static int sfctemp_disable(struct sfctemp *sfctemp) { - mutex_lock(&sfctemp->lock); if (!sfctemp->enabled) - goto done; + return 0; sfctemp_stop(sfctemp); sfctemp_power_down(sfctemp); @@ -143,8 +134,6 @@ static int sfctemp_disable(struct sfctemp *sfctemp) reset_control_assert(sfctemp->rst_bus); clk_disable_unprepare(sfctemp->clk_bus); sfctemp->enabled = false; -done: - mutex_unlock(&sfctemp->lock); return 0; } @@ -155,22 +144,14 @@ static void sfctemp_disable_action(void *data) static int sfctemp_convert(struct sfctemp *sfctemp, long *val) { - int ret; - - mutex_lock(&sfctemp->lock); - if (!sfctemp->enabled) { - ret = -ENODATA; - goto out; - } + if (!sfctemp->enabled) + return -ENODATA; /* calculate temperature in milli Celcius */ *val = (long)((readl(sfctemp->regs) & SFCTEMP_DOUT_MSK) >> SFCTEMP_DOUT_POS) * SFCTEMP_Y1000 / SFCTEMP_Z - SFCTEMP_K1000; - ret = 0; -out: - mutex_unlock(&sfctemp->lock); - return ret; + return 0; } static umode_t sfctemp_is_visible(const void *data, enum hwmon_sensor_types type, @@ -263,7 +244,6 @@ static int sfctemp_probe(struct platform_device *pdev) return -ENOMEM; dev_set_drvdata(dev, sfctemp); - mutex_init(&sfctemp->lock); sfctemp->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(sfctemp->regs)) |
