Skip to contentSkip to conversation

hwmon: The code crashes

PATCH In review Il Han 2 participants 2 messages Aug 28, 2015 Hardware monitoring

lore
Share & tools
lore

Il Han

author
#0 lore raw

PATCH v2 1/1 hwmon: The code crashes

The code crashes, since dev is not an i2c client device.
---
Mistakes were made in the process of merging.

---
 drivers/hwmon/max31790.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/hwmon/max31790.c +6 -6
index d9b0003..f129668 100644
@@ -206,8 +206,8 @@ static ssize_t set_fan_target(struct device *dev,
 			      const char *buf, size_t count)
 {
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-	struct i2c_client *client = to_i2c_client(dev);
-	struct max31790_data *data = i2c_get_clientdata(client);
+	struct max31790_data *data = dev_get_drvdata(dev);
+	struct i2c_client *client = data->client;
 	u8 bits;
 	int sr;
 	int target_count;
@@ -273,8 +273,8 @@ static ssize_t set_pwm(struct device *dev,
 		       const char *buf, size_t count)
 {
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-	struct i2c_client *client = to_i2c_client(dev);
-	struct max31790_data *data = i2c_get_clientdata(client);
+	struct max31790_data *data = dev_get_drvdata(dev);
+	struct i2c_client *client = data->client;
 	unsigned long pwm;
 	int err;
 
@@ -325,8 +325,8 @@ static ssize_t set_pwm_enable(struct device *dev,
 			      const char *buf, size_t count)
 {
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-	struct i2c_client *client = to_i2c_client(dev);
-	struct max31790_data *data = i2c_get_clientdata(client);
+	struct max31790_data *data = dev_get_drvdata(dev);
+	struct i2c_client *client = data->client;
 	unsigned long mode;
 	int err;
 
Signature · 7 lines
2.4.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
maintainer
#1 lore raw
Quoted 4 lines · Il Han

The code crashes, since dev is not an i2c client device.
---
Mistakes were made in the process of merging.

Pretty non-descriptive subject line. Sounds like the entire hwmon subsystem was crashing.

Please, just send a single patch for the new driver.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors