diff options
author | Jean Delvare <khali@linux-fr.org> | 2010-10-28 14:31:49 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2010-10-28 14:31:49 -0400 |
commit | 21fc977551da43ec21ae0ebb859411afd4243d2b (patch) | |
tree | 4d452b87875c6d9e2cbfb2c58eaa9ea45ee4821d /drivers/hwmon/w83795.c | |
parent | 1bb3450ce5050bc677c1995a60a0ddfe9e33e7b6 (diff) |
hwmon: (w83795) Use dev_get_drvdata() where possible
When we don't need the client pointer, calling dev_get_drvdata() is
more efficient that calling to_i2c_client() and then
i2c_get_clientdata().
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83795.c')
-rw-r--r-- | drivers/hwmon/w83795.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c index 78a876f35fa3..e916c04e8681 100644 --- a/drivers/hwmon/w83795.c +++ b/drivers/hwmon/w83795.c | |||
@@ -1265,8 +1265,7 @@ store_temp(struct device *dev, struct device_attribute *attr, | |||
1265 | static ssize_t | 1265 | static ssize_t |
1266 | show_dts_mode(struct device *dev, struct device_attribute *attr, char *buf) | 1266 | show_dts_mode(struct device *dev, struct device_attribute *attr, char *buf) |
1267 | { | 1267 | { |
1268 | struct i2c_client *client = to_i2c_client(dev); | 1268 | struct w83795_data *data = dev_get_drvdata(dev); |
1269 | struct w83795_data *data = i2c_get_clientdata(client); | ||
1270 | int tmp; | 1269 | int tmp; |
1271 | 1270 | ||
1272 | if (data->enable_dts & 2) | 1271 | if (data->enable_dts & 2) |
@@ -1296,8 +1295,7 @@ show_dts_ext(struct device *dev, struct device_attribute *attr, char *buf) | |||
1296 | struct sensor_device_attribute_2 *sensor_attr = | 1295 | struct sensor_device_attribute_2 *sensor_attr = |
1297 | to_sensor_dev_attr_2(attr); | 1296 | to_sensor_dev_attr_2(attr); |
1298 | int nr = sensor_attr->nr; | 1297 | int nr = sensor_attr->nr; |
1299 | struct i2c_client *client = to_i2c_client(dev); | 1298 | struct w83795_data *data = dev_get_drvdata(dev); |
1300 | struct w83795_data *data = i2c_get_clientdata(client); | ||
1301 | long temp = temp_from_reg(data->dts_ext[nr]); | 1299 | long temp = temp_from_reg(data->dts_ext[nr]); |
1302 | 1300 | ||
1303 | return sprintf(buf, "%ld\n", temp); | 1301 | return sprintf(buf, "%ld\n", temp); |
@@ -1328,8 +1326,7 @@ store_dts_ext(struct device *dev, struct device_attribute *attr, | |||
1328 | static ssize_t | 1326 | static ssize_t |
1329 | show_temp_mode(struct device *dev, struct device_attribute *attr, char *buf) | 1327 | show_temp_mode(struct device *dev, struct device_attribute *attr, char *buf) |
1330 | { | 1328 | { |
1331 | struct i2c_client *client = to_i2c_client(dev); | 1329 | struct w83795_data *data = dev_get_drvdata(dev); |
1332 | struct w83795_data *data = i2c_get_clientdata(client); | ||
1333 | struct sensor_device_attribute_2 *sensor_attr = | 1330 | struct sensor_device_attribute_2 *sensor_attr = |
1334 | to_sensor_dev_attr_2(attr); | 1331 | to_sensor_dev_attr_2(attr); |
1335 | int index = sensor_attr->index; | 1332 | int index = sensor_attr->index; |