diff options
Diffstat (limited to 'drivers/hwmon/emc2103.c')
| -rw-r--r-- | drivers/hwmon/emc2103.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c index e4c95ca9e19f..9b8e925af030 100644 --- a/drivers/hwmon/emc2103.c +++ b/drivers/hwmon/emc2103.c @@ -277,8 +277,10 @@ fan1_input_show(struct device *dev, struct device_attribute *da, char *buf) { struct emc2103_data *data = emc2103_update_device(dev); int rpm = 0; + mutex_lock(&data->update_lock); if (data->fan_tach != 0) rpm = (FAN_RPM_FACTOR * data->fan_multiplier) / data->fan_tach; + mutex_unlock(&data->update_lock); return sprintf(buf, "%d\n", rpm); } @@ -363,10 +365,12 @@ fan1_target_show(struct device *dev, struct device_attribute *da, char *buf) struct emc2103_data *data = emc2103_update_device(dev); int rpm = 0; + mutex_lock(&data->update_lock); /* high byte of 0xff indicates disabled so return 0 */ if ((data->fan_target != 0) && ((data->fan_target & 0x1fe0) != 0x1fe0)) rpm = (FAN_RPM_FACTOR * data->fan_multiplier) / data->fan_target; + mutex_unlock(&data->update_lock); return sprintf(buf, "%d\n", rpm); } @@ -620,7 +624,7 @@ emc2103_probe(struct i2c_client *client) } static const struct i2c_device_id emc2103_ids[] = { - { "emc2103", 0, }, + { "emc2103" }, { /* LIST END */ } }; MODULE_DEVICE_TABLE(i2c, emc2103_ids); @@ -643,7 +647,7 @@ emc2103_detect(struct i2c_client *new_client, struct i2c_board_info *info) if ((product != 0x24) && (product != 0x26)) return -ENODEV; - strlcpy(info->type, "emc2103", I2C_NAME_SIZE); + strscpy(info->type, "emc2103", I2C_NAME_SIZE); return 0; } @@ -653,7 +657,7 @@ static struct i2c_driver emc2103_driver = { .driver = { .name = "emc2103", }, - .probe_new = emc2103_probe, + .probe = emc2103_probe, .id_table = emc2103_ids, .detect = emc2103_detect, .address_list = normal_i2c, |
