Skip to contentSkip to conversation

hwmon: The Code Crashes

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

lore
Share & tools
lore

Il Han

author
#0 lore raw

PATCH 2/2 hwmon: The Code Crashes

The code crashes, since dev is not an i2c client device.

---
 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
author
#2 lore raw
In reply to Il Han

2015-08-26 23:06 GMT+09:00 Guenter Roeck <[email protected]>:

Quoted 7 lines · Il Han
Quoted 5 lines

The code crashes, since dev is not an i2c client device.

Quoted 9 lines

You lost me a bit here. Why did you make this a separate patch ?

Also, please version your patches and provide a change log. I am sure I asked for that before.

Thanks,
Guenter

Sorry.
Because I'm not accustomed to commit them with git, I made the mistake. confused about making a patch version such as [PATCH v2], providing a change log, etc.
I am going to look up about git commit.
--
Il Han
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

maintainer
#3 lore raw
In reply to Il Han
Quoted 14 lines · Il Han

2015-08-26 23:06 GMT+09:00 Guenter Roeck <[email protected] <mailto:[email protected]>>:

On 08/25/2015 10:41 PM, Il Han wrote:

The code crashes, since dev is not an i2c client device.

Signed-off-by Il Han <[email protected] <mailto:[email protected]>>

You lost me a bit here. Why did you make this a separate patch ?

Also, please version your patches and provide a change log. I am sure I asked for that before.

Quoted 8 lines

Thanks,
Guenter

Sorry.
Because I'm not accustomed to commit them with git, I made the mistake. confused about making a patch version such as [PATCH v2], providing a change log, etc. I am going to look up about git commit.

You might be looking for

	git format-patch --subject-prefix="PATCH v2"

Providing a change log doesn't mean to provide separate patches. It means to tag the patch with a version number ("PATCH v2" instead of "PATCH"), and to describe the changes below the '---' line in the patch. This is described in detail in Documentation/SubmittingPatches.

Thanks,
Guenter

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