hwmon: (lm80) fix checkpatch messages
Fixed all checkpatch messages except simple_strto* -> kstr* This will be addressed in a separate patch Also left one line-too-long message as it was only a little bit too long and would become less readable compile-tested: no warnings or errors Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
This commit is contained in:
parent
179c4fdb56
commit
66b3b1f757
|
@ -93,7 +93,8 @@ static inline long TEMP_FROM_REG(u16 temp)
|
|||
return res / 10;
|
||||
}
|
||||
|
||||
#define TEMP_LIMIT_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*1000)
|
||||
#define TEMP_LIMIT_FROM_REG(val) (((val) > 0x80 ? \
|
||||
(val) - 0x100 : (val)) * 1000)
|
||||
|
||||
#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT((val) < 0 ? \
|
||||
((val) - 500) / 1000 : ((val) + 500) / 1000, 0, 255)
|
||||
|
@ -164,7 +165,8 @@ static struct i2c_driver lm80_driver = {
|
|||
*/
|
||||
|
||||
#define show_in(suffix, value) \
|
||||
static ssize_t show_in_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \
|
||||
static ssize_t show_in_##suffix(struct device *dev, \
|
||||
struct device_attribute *attr, char *buf) \
|
||||
{ \
|
||||
int nr = to_sensor_dev_attr(attr)->index; \
|
||||
struct lm80_data *data = lm80_update_device(dev); \
|
||||
|
@ -175,8 +177,8 @@ show_in(max, in_max)
|
|||
show_in(input, in)
|
||||
|
||||
#define set_in(suffix, value, reg) \
|
||||
static ssize_t set_in_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \
|
||||
size_t count) \
|
||||
static ssize_t set_in_##suffix(struct device *dev, \
|
||||
struct device_attribute *attr, const char *buf, size_t count) \
|
||||
{ \
|
||||
int nr = to_sensor_dev_attr(attr)->index; \
|
||||
struct i2c_client *client = to_i2c_client(dev); \
|
||||
|
@ -193,7 +195,8 @@ set_in(min, in_min, LM80_REG_IN_MIN)
|
|||
set_in(max, in_max, LM80_REG_IN_MAX)
|
||||
|
||||
#define show_fan(suffix, value) \
|
||||
static ssize_t show_fan_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \
|
||||
static ssize_t show_fan_##suffix(struct device *dev, \
|
||||
struct device_attribute *attr, char *buf) \
|
||||
{ \
|
||||
int nr = to_sensor_dev_attr(attr)->index; \
|
||||
struct lm80_data *data = lm80_update_device(dev); \
|
||||
|
@ -245,10 +248,18 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
|
|||
DIV_FROM_REG(data->fan_div[nr]));
|
||||
|
||||
switch (val) {
|
||||
case 1: data->fan_div[nr] = 0; break;
|
||||
case 2: data->fan_div[nr] = 1; break;
|
||||
case 4: data->fan_div[nr] = 2; break;
|
||||
case 8: data->fan_div[nr] = 3; break;
|
||||
case 1:
|
||||
data->fan_div[nr] = 0;
|
||||
break;
|
||||
case 2:
|
||||
data->fan_div[nr] = 1;
|
||||
break;
|
||||
case 4:
|
||||
data->fan_div[nr] = 2;
|
||||
break;
|
||||
case 8:
|
||||
data->fan_div[nr] = 3;
|
||||
break;
|
||||
default:
|
||||
dev_err(&client->dev, "fan_div value %ld not "
|
||||
"supported. Choose one of 1, 2, 4 or 8!\n", val);
|
||||
|
@ -268,14 +279,16 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
|
|||
return count;
|
||||
}
|
||||
|
||||
static ssize_t show_temp_input1(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t show_temp_input1(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct lm80_data *data = lm80_update_device(dev);
|
||||
return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp));
|
||||
}
|
||||
|
||||
#define show_temp(suffix, value) \
|
||||
static ssize_t show_temp_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \
|
||||
static ssize_t show_temp_##suffix(struct device *dev, \
|
||||
struct device_attribute *attr, char *buf) \
|
||||
{ \
|
||||
struct lm80_data *data = lm80_update_device(dev); \
|
||||
return sprintf(buf, "%d\n", TEMP_LIMIT_FROM_REG(data->value)); \
|
||||
|
@ -286,8 +299,8 @@ show_temp(os_max, temp_os_max);
|
|||
show_temp(os_hyst, temp_os_hyst);
|
||||
|
||||
#define set_temp(suffix, value, reg) \
|
||||
static ssize_t set_temp_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \
|
||||
size_t count) \
|
||||
static ssize_t set_temp_##suffix(struct device *dev, \
|
||||
struct device_attribute *attr, const char *buf, size_t count) \
|
||||
{ \
|
||||
struct i2c_client *client = to_i2c_client(dev); \
|
||||
struct lm80_data *data = i2c_get_clientdata(client); \
|
||||
|
@ -490,7 +503,8 @@ static int lm80_probe(struct i2c_client *client,
|
|||
data->fan_min[1] = lm80_read_value(client, LM80_REG_FAN_MIN(2));
|
||||
|
||||
/* Register sysfs hooks */
|
||||
if ((err = sysfs_create_group(&client->dev.kobj, &lm80_group)))
|
||||
err = sysfs_create_group(&client->dev.kobj, &lm80_group);
|
||||
if (err)
|
||||
goto error_free;
|
||||
|
||||
data->hwmon_dev = hwmon_device_register(&client->dev);
|
||||
|
|
Loading…
Reference in New Issue