Commit 21fc9775 authored by Jean Delvare's avatar Jean Delvare Committed by Jean Delvare

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: default avatarJean Delvare <khali@linux-fr.org>
parent 1bb3450c
...@@ -1265,8 +1265,7 @@ store_temp(struct device *dev, struct device_attribute *attr, ...@@ -1265,8 +1265,7 @@ store_temp(struct device *dev, struct device_attribute *attr,
static ssize_t static ssize_t
show_dts_mode(struct device *dev, struct device_attribute *attr, char *buf) show_dts_mode(struct device *dev, struct device_attribute *attr, char *buf)
{ {
struct i2c_client *client = to_i2c_client(dev); struct w83795_data *data = dev_get_drvdata(dev);
struct w83795_data *data = i2c_get_clientdata(client);
int tmp; int tmp;
if (data->enable_dts & 2) if (data->enable_dts & 2)
...@@ -1296,8 +1295,7 @@ show_dts_ext(struct device *dev, struct device_attribute *attr, char *buf) ...@@ -1296,8 +1295,7 @@ show_dts_ext(struct device *dev, struct device_attribute *attr, char *buf)
struct sensor_device_attribute_2 *sensor_attr = struct sensor_device_attribute_2 *sensor_attr =
to_sensor_dev_attr_2(attr); to_sensor_dev_attr_2(attr);
int nr = sensor_attr->nr; int nr = sensor_attr->nr;
struct i2c_client *client = to_i2c_client(dev); struct w83795_data *data = dev_get_drvdata(dev);
struct w83795_data *data = i2c_get_clientdata(client);
long temp = temp_from_reg(data->dts_ext[nr]); long temp = temp_from_reg(data->dts_ext[nr]);
return sprintf(buf, "%ld\n", temp); return sprintf(buf, "%ld\n", temp);
...@@ -1328,8 +1326,7 @@ store_dts_ext(struct device *dev, struct device_attribute *attr, ...@@ -1328,8 +1326,7 @@ store_dts_ext(struct device *dev, struct device_attribute *attr,
static ssize_t static ssize_t
show_temp_mode(struct device *dev, struct device_attribute *attr, char *buf) show_temp_mode(struct device *dev, struct device_attribute *attr, char *buf)
{ {
struct i2c_client *client = to_i2c_client(dev); struct w83795_data *data = dev_get_drvdata(dev);
struct w83795_data *data = i2c_get_clientdata(client);
struct sensor_device_attribute_2 *sensor_attr = struct sensor_device_attribute_2 *sensor_attr =
to_sensor_dev_attr_2(attr); to_sensor_dev_attr_2(attr);
int index = sensor_attr->index; int index = sensor_attr->index;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment