diff options
Diffstat (limited to 'drivers/hwmon/max6639.c')
| -rw-r--r-- | drivers/hwmon/max6639.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c index a06346496e1d..99140a2ca995 100644 --- a/drivers/hwmon/max6639.c +++ b/drivers/hwmon/max6639.c @@ -16,9 +16,7 @@ #include <linux/jiffies.h> #include <linux/i2c.h> #include <linux/hwmon.h> -#include <linux/hwmon-sysfs.h> #include <linux/err.h> -#include <linux/mutex.h> #include <linux/regmap.h> #include <linux/util_macros.h> @@ -75,7 +73,6 @@ static const unsigned int freq_table[] = { 20, 33, 50, 100, 5000, 8333, 12500, */ struct max6639_data { struct regmap *regmap; - struct mutex update_lock; /* Register values initialized only once */ u8 ppr[MAX6639_NUM_CHANNELS]; /* Pulses per rotation 0..3 for 1..4 ppr */ @@ -249,16 +246,11 @@ static int max6639_write_fan(struct device *dev, u32 attr, int channel, if (val <= 0 || val > 4) return -EINVAL; - mutex_lock(&data->update_lock); /* Set Fan pulse per revolution */ err = max6639_set_ppr(data, channel, val); - if (err < 0) { - mutex_unlock(&data->update_lock); + if (err < 0) return err; - } data->ppr[channel] = val; - - mutex_unlock(&data->update_lock); return 0; default: return -EOPNOTSUPP; @@ -320,21 +312,17 @@ static int max6639_write_pwm(struct device *dev, u32 attr, int channel, case hwmon_pwm_input: if (val < 0 || val > 255) return -EINVAL; - err = regmap_write(data->regmap, MAX6639_REG_TARGTDUTY(channel), - val * 120 / 255); - return err; + return regmap_write(data->regmap, MAX6639_REG_TARGTDUTY(channel), + val * 120 / 255); case hwmon_pwm_freq: val = clamp_val(val, 0, 25000); i = find_closest(val, freq_table, ARRAY_SIZE(freq_table)); - mutex_lock(&data->update_lock); err = regmap_update_bits(data->regmap, MAX6639_REG_FAN_CONFIG3(channel), MAX6639_FAN_CONFIG3_FREQ_MASK, i); - if (err < 0) { - mutex_unlock(&data->update_lock); + if (err < 0) return err; - } if (i >> 2) err = regmap_set_bits(data->regmap, MAX6639_REG_GCONFIG, @@ -343,7 +331,6 @@ static int max6639_write_pwm(struct device *dev, u32 attr, int channel, err = regmap_clear_bits(data->regmap, MAX6639_REG_GCONFIG, MAX6639_GCONFIG_PWM_FREQ_HI); - mutex_unlock(&data->update_lock); return err; default: return -EOPNOTSUPP; @@ -753,8 +740,6 @@ static int max6639_probe(struct i2c_client *client) } } - mutex_init(&data->update_lock); - /* Initialize the max6639 chip */ err = max6639_init_client(client, data); if (err < 0) |
