forked from mirrors/linux
		
	hwmon: (adm1025) Fix checkpatch issues
Fixed: ERROR: do not use assignment in if condition ERROR: space required after that ',' (ctx:VxV) ERROR: spaces required around that '<' (ctx:VxV) ERROR: spaces required around that '=' (ctx:VxV) ERROR: trailing whitespace WARNING: simple_strtol is obsolete, use kstrtol instead WARNING: simple_strtoul is obsolete, use kstrtoul instead Not fixed: ERROR: Macros with multiple statements should be enclosed in a do - while loop Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
		
							parent
							
								
									79738416f6
								
							
						
					
					
						commit
						2b22de5117
					
				
					 1 changed files with 46 additions and 17 deletions
				
			
		|  | @ -99,7 +99,8 @@ static const int in_scale[6] = { 2500, 2250, 3300, 5000, 12000, 3300 }; | |||
| #define TEMP_FROM_REG(reg)	((reg) * 1000) | ||||
| #define TEMP_TO_REG(val)	((val) <= -127500 ? -128 : \ | ||||
| 				 (val) >= 126500 ? 127 : \ | ||||
| 				 (((val) < 0 ? (val)-500 : (val)+500) / 1000)) | ||||
| 				 (((val) < 0 ? (val) - 500 : \ | ||||
| 				   (val) + 500) / 1000)) | ||||
| 
 | ||||
| /*
 | ||||
|  * Functions declaration | ||||
|  | @ -218,7 +219,12 @@ static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, | |||
| 	int index = to_sensor_dev_attr(attr)->index; | ||||
| 	struct i2c_client *client = to_i2c_client(dev); | ||||
| 	struct adm1025_data *data = i2c_get_clientdata(client); | ||||
| 	long val = simple_strtol(buf, NULL, 10); | ||||
| 	long val; | ||||
| 	int err; | ||||
| 
 | ||||
| 	err = kstrtol(buf, 10, &val); | ||||
| 	if (err) | ||||
| 		return err; | ||||
| 
 | ||||
| 	mutex_lock(&data->update_lock); | ||||
| 	data->in_min[index] = IN_TO_REG(val, in_scale[index]); | ||||
|  | @ -234,7 +240,12 @@ static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, | |||
| 	int index = to_sensor_dev_attr(attr)->index; | ||||
| 	struct i2c_client *client = to_i2c_client(dev); | ||||
| 	struct adm1025_data *data = i2c_get_clientdata(client); | ||||
| 	long val = simple_strtol(buf, NULL, 10); | ||||
| 	long val; | ||||
| 	int err; | ||||
| 
 | ||||
| 	err = kstrtol(buf, 10, &val); | ||||
| 	if (err) | ||||
| 		return err; | ||||
| 
 | ||||
| 	mutex_lock(&data->update_lock); | ||||
| 	data->in_max[index] = IN_TO_REG(val, in_scale[index]); | ||||
|  | @ -264,7 +275,12 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, | |||
| 	int index = to_sensor_dev_attr(attr)->index; | ||||
| 	struct i2c_client *client = to_i2c_client(dev); | ||||
| 	struct adm1025_data *data = i2c_get_clientdata(client); | ||||
| 	long val = simple_strtol(buf, NULL, 10); | ||||
| 	long val; | ||||
| 	int err; | ||||
| 
 | ||||
| 	err = kstrtol(buf, 10, &val); | ||||
| 	if (err) | ||||
| 		return err; | ||||
| 
 | ||||
| 	mutex_lock(&data->update_lock); | ||||
| 	data->temp_min[index] = TEMP_TO_REG(val); | ||||
|  | @ -280,7 +296,12 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, | |||
| 	int index = to_sensor_dev_attr(attr)->index; | ||||
| 	struct i2c_client *client = to_i2c_client(dev); | ||||
| 	struct adm1025_data *data = i2c_get_clientdata(client); | ||||
| 	long val = simple_strtol(buf, NULL, 10); | ||||
| 	long val; | ||||
| 	int err; | ||||
| 
 | ||||
| 	err = kstrtol(buf, 10, &val); | ||||
| 	if (err) | ||||
| 		return err; | ||||
| 
 | ||||
| 	mutex_lock(&data->update_lock); | ||||
| 	data->temp_max[index] = TEMP_TO_REG(val); | ||||
|  | @ -343,7 +364,14 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, | |||
| 		       const char *buf, size_t count) | ||||
| { | ||||
| 	struct adm1025_data *data = dev_get_drvdata(dev); | ||||
| 	data->vrm = simple_strtoul(buf, NULL, 10); | ||||
| 	unsigned long val; | ||||
| 	int err; | ||||
| 
 | ||||
| 	err = kstrtoul(buf, 10, &val); | ||||
| 	if (err) | ||||
| 		return err; | ||||
| 
 | ||||
| 	data->vrm = val; | ||||
| 	return count; | ||||
| } | ||||
| static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); | ||||
|  | @ -462,14 +490,15 @@ static int adm1025_probe(struct i2c_client *client, | |||
| 	adm1025_init_client(client); | ||||
| 
 | ||||
| 	/* Register sysfs hooks */ | ||||
| 	if ((err = sysfs_create_group(&client->dev.kobj, &adm1025_group))) | ||||
| 	err = sysfs_create_group(&client->dev.kobj, &adm1025_group); | ||||
| 	if (err) | ||||
| 		goto exit_free; | ||||
| 
 | ||||
| 	/* Pin 11 is either in4 (+12V) or VID4 */ | ||||
| 	config = i2c_smbus_read_byte_data(client, ADM1025_REG_CONFIG); | ||||
| 	if (!(config & 0x20)) { | ||||
| 		if ((err = sysfs_create_group(&client->dev.kobj, | ||||
| 					      &adm1025_group_in4))) | ||||
| 		err = sysfs_create_group(&client->dev.kobj, &adm1025_group_in4); | ||||
| 		if (err) | ||||
| 			goto exit_remove; | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Guenter Roeck
						Guenter Roeck