Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280582
b: refs/heads/master
c: 1f962f3
h: refs/heads/master
v: v3
  • Loading branch information
Frans Meulenbroeks authored and Guenter Roeck committed Jan 5, 2012
1 parent 31c034f commit 1f7cb4e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aac9fe9b4697868009e752562e743cc7984809bc
refs/heads/master: 1f962f363b762887d8f9057598b6acacf9e80234
23 changes: 16 additions & 7 deletions trunk/drivers/hwmon/lm75.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *da,
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct lm75_data *data = lm75_update_device(dev);

if (IS_ERR(data))
return PTR_ERR(data);

return sprintf(buf, "%d\n",
LM75_TEMP_FROM_REG(data->temp[attr->index]));
}
Expand Down Expand Up @@ -402,6 +406,7 @@ static struct lm75_data *lm75_update_device(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct lm75_data *data = i2c_get_clientdata(client);
struct lm75_data *ret = data;

mutex_lock(&data->update_lock);

Expand All @@ -414,19 +419,23 @@ static struct lm75_data *lm75_update_device(struct device *dev)
int status;

status = lm75_read_value(client, LM75_REG_TEMP[i]);
if (status < 0)
dev_dbg(&client->dev, "reg %d, err %d\n",
LM75_REG_TEMP[i], status);
else
data->temp[i] = status;
if (unlikely(status < 0)) {
dev_dbg(dev,
"LM75: Failed to read value: reg %d, error %d\n",
LM75_REG_TEMP[i], status);
ret = ERR_PTR(status);
data->valid = 0;
goto abort;
}
data->temp[i] = status;
}
data->last_updated = jiffies;
data->valid = 1;
}

abort:
mutex_unlock(&data->update_lock);

return data;
return ret;
}

/*-----------------------------------------------------------------------*/
Expand Down

0 comments on commit 1f7cb4e

Please sign in to comment.