Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions drivers/hwmon/nct7363.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static int nct7363_read_fan(struct device *dev, u32 attr, int channel,
{
struct nct7363_data *data = dev_get_drvdata(dev);
unsigned int hi, lo, rpm;
int ret = 0;
int ret;
u16 cnt;

switch (attr) {
Expand All @@ -92,18 +92,21 @@ static int nct7363_read_fan(struct device *dev, u32 attr, int channel,
ret = regmap_read(data->regmap,
NCT7363_REG_FANINX_HVAL(channel), &hi);
if (ret)
return ret;
goto out_unlock;

ret = regmap_read(data->regmap,
NCT7363_REG_FANINX_LVAL(channel), &lo);
if (ret)
return ret;
mutex_unlock(&data->lock);
goto out_unlock;

cnt = (hi << 5) | (lo & NCT7363_FANINX_LVAL_MASK);
rpm = FAN_FROM_REG(cnt);
*val = (long)rpm;
return 0;
ret = 0;

out_unlock:
mutex_unlock(&data->lock);
return ret;
default:
return -EOPNOTSUPP;
}
Expand Down