summaryrefslogtreecommitdiff
path: root/drivers/hwmon/max127.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/max127.c')
-rw-r--r--drivers/hwmon/max127.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/drivers/hwmon/max127.c b/drivers/hwmon/max127.c
index 0e21e7e6bbd2..5102d86d2619 100644
--- a/drivers/hwmon/max127.c
+++ b/drivers/hwmon/max127.c
@@ -45,7 +45,6 @@
#define MAX127_SIGN_BIT BIT(11)
struct max127_data {
- struct mutex lock;
struct i2c_client *client;
u8 ctrl_byte[MAX127_NUM_CHANNELS];
};
@@ -121,21 +120,16 @@ static int max127_read_input(struct max127_data *data, int channel, long *val)
struct i2c_client *client = data->client;
u8 ctrl_byte = data->ctrl_byte[channel];
- mutex_lock(&data->lock);
-
status = max127_select_channel(client, ctrl_byte);
if (status)
- goto exit;
+ return status;
status = max127_read_channel(client, &raw);
if (status)
- goto exit;
+ return status;
*val = max127_process_raw(ctrl_byte, raw);
-
-exit:
- mutex_unlock(&data->lock);
- return status;
+ return 0;
}
static int max127_read_min(struct max127_data *data, int channel, long *val)
@@ -170,8 +164,6 @@ static int max127_write_min(struct max127_data *data, int channel, long val)
{
u8 ctrl;
- mutex_lock(&data->lock);
-
ctrl = data->ctrl_byte[channel];
if (val <= -MAX127_FULL_RANGE) {
ctrl |= (MAX127_CTRL_RNG | MAX127_CTRL_BIP);
@@ -182,23 +174,15 @@ static int max127_write_min(struct max127_data *data, int channel, long val)
ctrl &= ~MAX127_CTRL_BIP;
}
data->ctrl_byte[channel] = ctrl;
-
- mutex_unlock(&data->lock);
-
return 0;
}
static int max127_write_max(struct max127_data *data, int channel, long val)
{
- mutex_lock(&data->lock);
-
if (val >= MAX127_FULL_RANGE)
data->ctrl_byte[channel] |= MAX127_CTRL_RNG;
else
data->ctrl_byte[channel] &= ~MAX127_CTRL_RNG;
-
- mutex_unlock(&data->lock);
-
return 0;
}
@@ -285,7 +269,7 @@ static const struct hwmon_ops max127_hwmon_ops = {
.write = max127_write,
};
-static const struct hwmon_channel_info *max127_info[] = {
+static const struct hwmon_channel_info * const max127_info[] = {
HWMON_CHANNEL_INFO(in,
HWMON_I_INPUT | HWMON_I_MIN | HWMON_I_MAX,
HWMON_I_INPUT | HWMON_I_MIN | HWMON_I_MAX,
@@ -315,7 +299,6 @@ static int max127_probe(struct i2c_client *client)
return -ENOMEM;
data->client = client;
- mutex_init(&data->lock);
for (i = 0; i < ARRAY_SIZE(data->ctrl_byte); i++)
data->ctrl_byte[i] = (MAX127_CTRL_START |
MAX127_SET_CHANNEL(i));
@@ -329,17 +312,16 @@ static int max127_probe(struct i2c_client *client)
}
static const struct i2c_device_id max127_id[] = {
- { "max127", 0 },
+ { "max127" },
{ }
};
MODULE_DEVICE_TABLE(i2c, max127_id);
static struct i2c_driver max127_driver = {
- .class = I2C_CLASS_HWMON,
.driver = {
.name = "max127",
},
- .probe_new = max127_probe,
+ .probe = max127_probe,
.id_table = max127_id,
};