summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-10-28 20:31:49 +0200
committerJean Delvare <khali@endymion.delvare>2010-10-28 20:31:49 +0200
commit21fc977551da43ec21ae0ebb859411afd4243d2b (patch)
tree4d452b87875c6d9e2cbfb2c58eaa9ea45ee4821d /drivers/hwmon
parent1bb3450ce5050bc677c1995a60a0ddfe9e33e7b6 (diff)
downloadop-kernel-dev-21fc977551da43ec21ae0ebb859411afd4243d2b.zip
op-kernel-dev-21fc977551da43ec21ae0ebb859411afd4243d2b.tar.gz
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')
-rw-r--r--drivers/hwmon/w83795.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index 78a876f..e916c04 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -1265,8 +1265,7 @@ store_temp(struct device *dev, struct device_attribute *attr,
static ssize_t
show_dts_mode(struct device *dev, struct device_attribute *attr, char *buf)
{
- struct i2c_client *client = to_i2c_client(dev);
- struct w83795_data *data = i2c_get_clientdata(client);
+ struct w83795_data *data = dev_get_drvdata(dev);
int tmp;
if (data->enable_dts & 2)
@@ -1296,8 +1295,7 @@ show_dts_ext(struct device *dev, struct device_attribute *attr, char *buf)
struct sensor_device_attribute_2 *sensor_attr =
to_sensor_dev_attr_2(attr);
int nr = sensor_attr->nr;
- struct i2c_client *client = to_i2c_client(dev);
- struct w83795_data *data = i2c_get_clientdata(client);
+ struct w83795_data *data = dev_get_drvdata(dev);
long temp = temp_from_reg(data->dts_ext[nr]);
return sprintf(buf, "%ld\n", temp);
@@ -1328,8 +1326,7 @@ store_dts_ext(struct device *dev, struct device_attribute *attr,
static ssize_t
show_temp_mode(struct device *dev, struct device_attribute *attr, char *buf)
{
- struct i2c_client *client = to_i2c_client(dev);
- struct w83795_data *data = i2c_get_clientdata(client);
+ struct w83795_data *data = dev_get_drvdata(dev);
struct sensor_device_attribute_2 *sensor_attr =
to_sensor_dev_attr_2(attr);
int index = sensor_attr->index;
OpenPOWER on IntegriCloud