#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/module.h>
-#include <linux/mutex.h>
#include <linux/regmap.h>
#include <linux/slab.h>
/* Client data (each client gets its own) */
struct lm92_data {
struct regmap *regmap;
- struct mutex update_lock;
int resolution;
};
break;
case hwmon_temp_crit_hyst:
val = clamp_val(val, -120000, 220000);
- mutex_lock(&data->update_lock);
err = regmap_read(regmap, LM92_REG_TEMP_CRIT, &temp);
if (err)
- goto unlock;
+ return err;
val = TEMP_TO_REG(TEMP_FROM_REG(temp) - val, data->resolution);
- err = regmap_write(regmap, LM92_REG_TEMP_HYST, val);
-unlock:
- mutex_unlock(&data->update_lock);
- return err;
+ return regmap_write(regmap, LM92_REG_TEMP_HYST, val);
default:
return -EOPNOTSUPP;
}
data->regmap = regmap;
data->resolution = (unsigned long)i2c_get_match_data(client);
- mutex_init(&data->update_lock);
/* Initialize the chipset */
err = lm92_init_client(regmap);