hwmon: (adm1031) Get rid of macro-generated wrappers

Use the standard dynamic sysfs callbacks instead of macro-generated
wrappers. It makes the code more simple and the binary smaller (-8% on
my system.)

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
This commit is contained in:
Jean Delvare 2007-12-02 23:39:38 +01:00 committed by Mark M. Hoffman
parent 6d6006b8db
commit c801082d7d
1 changed files with 129 additions and 190 deletions

View File

@ -27,6 +27,7 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/hwmon.h> #include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/mutex.h> #include <linux/mutex.h>
@ -245,17 +246,21 @@ get_fan_auto_nearest(struct adm1031_data *data,
return 0; return 0;
} }
static ssize_t show_fan_auto_channel(struct device *dev, char *buf, int nr) static ssize_t show_fan_auto_channel(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
return sprintf(buf, "%d\n", GET_FAN_AUTO_BITFIELD(data, nr)); return sprintf(buf, "%d\n", GET_FAN_AUTO_BITFIELD(data, nr));
} }
static ssize_t static ssize_t
set_fan_auto_channel(struct device *dev, const char *buf, size_t count, int nr) set_fan_auto_channel(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1031_data *data = i2c_get_clientdata(client); struct adm1031_data *data = i2c_get_clientdata(client);
int nr = to_sensor_dev_attr(attr)->index;
int val = simple_strtol(buf, NULL, 10); int val = simple_strtol(buf, NULL, 10);
u8 reg; u8 reg;
int ret; int ret;
@ -294,41 +299,35 @@ set_fan_auto_channel(struct device *dev, const char *buf, size_t count, int nr)
return count; return count;
} }
#define fan_auto_channel_offset(offset) \ static SENSOR_DEVICE_ATTR(auto_fan1_channel, S_IRUGO | S_IWUSR,
static ssize_t show_fan_auto_channel_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ show_fan_auto_channel, set_fan_auto_channel, 0);
{ \ static SENSOR_DEVICE_ATTR(auto_fan2_channel, S_IRUGO | S_IWUSR,
return show_fan_auto_channel(dev, buf, offset - 1); \ show_fan_auto_channel, set_fan_auto_channel, 1);
} \
static ssize_t set_fan_auto_channel_##offset (struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
return set_fan_auto_channel(dev, buf, count, offset - 1); \
} \
static DEVICE_ATTR(auto_fan##offset##_channel, S_IRUGO | S_IWUSR, \
show_fan_auto_channel_##offset, \
set_fan_auto_channel_##offset)
fan_auto_channel_offset(1);
fan_auto_channel_offset(2);
/* Auto Temps */ /* Auto Temps */
static ssize_t show_auto_temp_off(struct device *dev, char *buf, int nr) static ssize_t show_auto_temp_off(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
return sprintf(buf, "%d\n", return sprintf(buf, "%d\n",
AUTO_TEMP_OFF_FROM_REG(data->auto_temp[nr])); AUTO_TEMP_OFF_FROM_REG(data->auto_temp[nr]));
} }
static ssize_t show_auto_temp_min(struct device *dev, char *buf, int nr) static ssize_t show_auto_temp_min(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
return sprintf(buf, "%d\n", return sprintf(buf, "%d\n",
AUTO_TEMP_MIN_FROM_REG(data->auto_temp[nr])); AUTO_TEMP_MIN_FROM_REG(data->auto_temp[nr]));
} }
static ssize_t static ssize_t
set_auto_temp_min(struct device *dev, const char *buf, size_t count, int nr) set_auto_temp_min(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1031_data *data = i2c_get_clientdata(client); struct adm1031_data *data = i2c_get_clientdata(client);
int nr = to_sensor_dev_attr(attr)->index;
int val = simple_strtol(buf, NULL, 10); int val = simple_strtol(buf, NULL, 10);
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
@ -338,17 +337,21 @@ set_auto_temp_min(struct device *dev, const char *buf, size_t count, int nr)
mutex_unlock(&data->update_lock); mutex_unlock(&data->update_lock);
return count; return count;
} }
static ssize_t show_auto_temp_max(struct device *dev, char *buf, int nr) static ssize_t show_auto_temp_max(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
return sprintf(buf, "%d\n", return sprintf(buf, "%d\n",
AUTO_TEMP_MAX_FROM_REG(data->auto_temp[nr])); AUTO_TEMP_MAX_FROM_REG(data->auto_temp[nr]));
} }
static ssize_t static ssize_t
set_auto_temp_max(struct device *dev, const char *buf, size_t count, int nr) set_auto_temp_max(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1031_data *data = i2c_get_clientdata(client); struct adm1031_data *data = i2c_get_clientdata(client);
int nr = to_sensor_dev_attr(attr)->index;
int val = simple_strtol(buf, NULL, 10); int val = simple_strtol(buf, NULL, 10);
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
@ -359,51 +362,32 @@ set_auto_temp_max(struct device *dev, const char *buf, size_t count, int nr)
return count; return count;
} }
#define auto_temp_reg(offset) \ #define auto_temp_reg(offset) \
static ssize_t show_auto_temp_##offset##_off (struct device *dev, struct device_attribute *attr, char *buf) \ static SENSOR_DEVICE_ATTR(auto_temp##offset##_off, S_IRUGO, \
{ \ show_auto_temp_off, NULL, offset - 1); \
return show_auto_temp_off(dev, buf, offset - 1); \ static SENSOR_DEVICE_ATTR(auto_temp##offset##_min, S_IRUGO | S_IWUSR, \
} \ show_auto_temp_min, set_auto_temp_min, offset - 1); \
static ssize_t show_auto_temp_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ static SENSOR_DEVICE_ATTR(auto_temp##offset##_max, S_IRUGO | S_IWUSR, \
{ \ show_auto_temp_max, set_auto_temp_max, offset - 1)
return show_auto_temp_min(dev, buf, offset - 1); \
} \
static ssize_t show_auto_temp_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return show_auto_temp_max(dev, buf, offset - 1); \
} \
static ssize_t set_auto_temp_##offset##_min (struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
return set_auto_temp_min(dev, buf, count, offset - 1); \
} \
static ssize_t set_auto_temp_##offset##_max (struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
return set_auto_temp_max(dev, buf, count, offset - 1); \
} \
static DEVICE_ATTR(auto_temp##offset##_off, S_IRUGO, \
show_auto_temp_##offset##_off, NULL); \
static DEVICE_ATTR(auto_temp##offset##_min, S_IRUGO | S_IWUSR, \
show_auto_temp_##offset##_min, set_auto_temp_##offset##_min);\
static DEVICE_ATTR(auto_temp##offset##_max, S_IRUGO | S_IWUSR, \
show_auto_temp_##offset##_max, set_auto_temp_##offset##_max)
auto_temp_reg(1); auto_temp_reg(1);
auto_temp_reg(2); auto_temp_reg(2);
auto_temp_reg(3); auto_temp_reg(3);
/* pwm */ /* pwm */
static ssize_t show_pwm(struct device *dev, char *buf, int nr) static ssize_t show_pwm(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
return sprintf(buf, "%d\n", PWM_FROM_REG(data->pwm[nr])); return sprintf(buf, "%d\n", PWM_FROM_REG(data->pwm[nr]));
} }
static ssize_t static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
set_pwm(struct device *dev, const char *buf, size_t count, int nr) const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1031_data *data = i2c_get_clientdata(client); struct adm1031_data *data = i2c_get_clientdata(client);
int nr = to_sensor_dev_attr(attr)->index;
int val = simple_strtol(buf, NULL, 10); int val = simple_strtol(buf, NULL, 10);
int reg; int reg;
@ -423,21 +407,12 @@ set_pwm(struct device *dev, const char *buf, size_t count, int nr)
return count; return count;
} }
#define pwm_reg(offset) \ static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm, set_pwm, 0);
static ssize_t show_pwm_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, show_pwm, set_pwm, 1);
{ \ static SENSOR_DEVICE_ATTR(auto_fan1_min_pwm, S_IRUGO | S_IWUSR,
return show_pwm(dev, buf, offset - 1); \ show_pwm, set_pwm, 0);
} \ static SENSOR_DEVICE_ATTR(auto_fan2_min_pwm, S_IRUGO | S_IWUSR,
static ssize_t set_pwm_##offset (struct device *dev, struct device_attribute *attr, \ show_pwm, set_pwm, 1);
const char *buf, size_t count) \
{ \
return set_pwm(dev, buf, count, offset - 1); \
} \
static DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \
show_pwm_##offset, set_pwm_##offset)
pwm_reg(1);
pwm_reg(2);
/* Fans */ /* Fans */
@ -484,8 +459,10 @@ static int trust_fan_readings(struct adm1031_data *data, int chan)
} }
static ssize_t show_fan(struct device *dev, char *buf, int nr) static ssize_t show_fan(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
int value; int value;
@ -494,23 +471,28 @@ static ssize_t show_fan(struct device *dev, char *buf, int nr)
return sprintf(buf, "%d\n", value); return sprintf(buf, "%d\n", value);
} }
static ssize_t show_fan_div(struct device *dev, char *buf, int nr) static ssize_t show_fan_div(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
return sprintf(buf, "%d\n", FAN_DIV_FROM_REG(data->fan_div[nr])); return sprintf(buf, "%d\n", FAN_DIV_FROM_REG(data->fan_div[nr]));
} }
static ssize_t show_fan_min(struct device *dev, char *buf, int nr) static ssize_t show_fan_min(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
return sprintf(buf, "%d\n", return sprintf(buf, "%d\n",
FAN_FROM_REG(data->fan_min[nr], FAN_FROM_REG(data->fan_min[nr],
FAN_DIV_FROM_REG(data->fan_div[nr]))); FAN_DIV_FROM_REG(data->fan_div[nr])));
} }
static ssize_t static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
set_fan_min(struct device *dev, const char *buf, size_t count, int nr) const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1031_data *data = i2c_get_clientdata(client); struct adm1031_data *data = i2c_get_clientdata(client);
int nr = to_sensor_dev_attr(attr)->index;
int val = simple_strtol(buf, NULL, 10); int val = simple_strtol(buf, NULL, 10);
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
@ -524,11 +506,12 @@ set_fan_min(struct device *dev, const char *buf, size_t count, int nr)
mutex_unlock(&data->update_lock); mutex_unlock(&data->update_lock);
return count; return count;
} }
static ssize_t static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
set_fan_div(struct device *dev, const char *buf, size_t count, int nr) const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1031_data *data = i2c_get_clientdata(client); struct adm1031_data *data = i2c_get_clientdata(client);
int nr = to_sensor_dev_attr(attr)->index;
int val = simple_strtol(buf, NULL, 10); int val = simple_strtol(buf, NULL, 10);
u8 tmp; u8 tmp;
int old_div; int old_div;
@ -567,44 +550,22 @@ set_fan_div(struct device *dev, const char *buf, size_t count, int nr)
} }
#define fan_offset(offset) \ #define fan_offset(offset) \
static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \
{ \ show_fan, NULL, offset - 1); \
return show_fan(dev, buf, offset - 1); \ static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
} \ show_fan_min, set_fan_min, offset - 1); \
static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \
{ \ show_fan_div, set_fan_div, offset - 1)
return show_fan_min(dev, buf, offset - 1); \
} \
static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return show_fan_div(dev, buf, offset - 1); \
} \
static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
return set_fan_min(dev, buf, count, offset - 1); \
} \
static ssize_t set_fan_##offset##_div (struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
return set_fan_div(dev, buf, count, offset - 1); \
} \
static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, \
NULL); \
static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
show_fan_##offset##_min, set_fan_##offset##_min); \
static DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \
show_fan_##offset##_div, set_fan_##offset##_div); \
static DEVICE_ATTR(auto_fan##offset##_min_pwm, S_IRUGO | S_IWUSR, \
show_pwm_##offset, set_pwm_##offset)
fan_offset(1); fan_offset(1);
fan_offset(2); fan_offset(2);
/* Temps */ /* Temps */
static ssize_t show_temp(struct device *dev, char *buf, int nr) static ssize_t show_temp(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
int ext; int ext;
ext = nr == 0 ? ext = nr == 0 ?
@ -612,26 +573,33 @@ static ssize_t show_temp(struct device *dev, char *buf, int nr)
(((data->ext_temp[nr] >> ((nr - 1) * 3)) & 7)); (((data->ext_temp[nr] >> ((nr - 1) * 3)) & 7));
return sprintf(buf, "%d\n", TEMP_FROM_REG_EXT(data->temp[nr], ext)); return sprintf(buf, "%d\n", TEMP_FROM_REG_EXT(data->temp[nr], ext));
} }
static ssize_t show_temp_min(struct device *dev, char *buf, int nr) static ssize_t show_temp_min(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[nr])); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[nr]));
} }
static ssize_t show_temp_max(struct device *dev, char *buf, int nr) static ssize_t show_temp_max(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[nr])); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[nr]));
} }
static ssize_t show_temp_crit(struct device *dev, char *buf, int nr) static ssize_t show_temp_crit(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
int nr = to_sensor_dev_attr(attr)->index;
struct adm1031_data *data = adm1031_update_device(dev); struct adm1031_data *data = adm1031_update_device(dev);
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[nr])); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[nr]));
} }
static ssize_t static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
set_temp_min(struct device *dev, const char *buf, size_t count, int nr) const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1031_data *data = i2c_get_clientdata(client); struct adm1031_data *data = i2c_get_clientdata(client);
int nr = to_sensor_dev_attr(attr)->index;
int val; int val;
val = simple_strtol(buf, NULL, 10); val = simple_strtol(buf, NULL, 10);
@ -643,11 +611,12 @@ set_temp_min(struct device *dev, const char *buf, size_t count, int nr)
mutex_unlock(&data->update_lock); mutex_unlock(&data->update_lock);
return count; return count;
} }
static ssize_t static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
set_temp_max(struct device *dev, const char *buf, size_t count, int nr) const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1031_data *data = i2c_get_clientdata(client); struct adm1031_data *data = i2c_get_clientdata(client);
int nr = to_sensor_dev_attr(attr)->index;
int val; int val;
val = simple_strtol(buf, NULL, 10); val = simple_strtol(buf, NULL, 10);
@ -659,11 +628,12 @@ set_temp_max(struct device *dev, const char *buf, size_t count, int nr)
mutex_unlock(&data->update_lock); mutex_unlock(&data->update_lock);
return count; return count;
} }
static ssize_t static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr,
set_temp_crit(struct device *dev, const char *buf, size_t count, int nr) const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct adm1031_data *data = i2c_get_clientdata(client); struct adm1031_data *data = i2c_get_clientdata(client);
int nr = to_sensor_dev_attr(attr)->index;
int val; int val;
val = simple_strtol(buf, NULL, 10); val = simple_strtol(buf, NULL, 10);
@ -676,46 +646,15 @@ set_temp_crit(struct device *dev, const char *buf, size_t count, int nr)
return count; return count;
} }
#define temp_reg(offset) \ #define temp_reg(offset) \
static ssize_t show_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
{ \ show_temp, NULL, offset - 1); \
return show_temp(dev, buf, offset - 1); \ static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \
} \ show_temp_min, set_temp_min, offset - 1); \
static ssize_t show_temp_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
{ \ show_temp_max, set_temp_max, offset - 1); \
return show_temp_min(dev, buf, offset - 1); \ static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IRUGO | S_IWUSR, \
} \ show_temp_crit, set_temp_crit, offset - 1)
static ssize_t show_temp_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return show_temp_max(dev, buf, offset - 1); \
} \
static ssize_t show_temp_##offset##_crit (struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return show_temp_crit(dev, buf, offset - 1); \
} \
static ssize_t set_temp_##offset##_min (struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
return set_temp_min(dev, buf, count, offset - 1); \
} \
static ssize_t set_temp_##offset##_max (struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
return set_temp_max(dev, buf, count, offset - 1); \
} \
static ssize_t set_temp_##offset##_crit (struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
return set_temp_crit(dev, buf, count, offset - 1); \
} \
static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp_##offset, \
NULL); \
static DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \
show_temp_##offset##_min, set_temp_##offset##_min); \
static DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
show_temp_##offset##_max, set_temp_##offset##_max); \
static DEVICE_ATTR(temp##offset##_crit, S_IRUGO | S_IWUSR, \
show_temp_##offset##_crit, set_temp_##offset##_crit)
temp_reg(1); temp_reg(1);
temp_reg(2); temp_reg(2);
@ -739,29 +678,29 @@ static int adm1031_attach_adapter(struct i2c_adapter *adapter)
} }
static struct attribute *adm1031_attributes[] = { static struct attribute *adm1031_attributes[] = {
&dev_attr_fan1_input.attr, &sensor_dev_attr_fan1_input.dev_attr.attr,
&dev_attr_fan1_div.attr, &sensor_dev_attr_fan1_div.dev_attr.attr,
&dev_attr_fan1_min.attr, &sensor_dev_attr_fan1_min.dev_attr.attr,
&dev_attr_pwm1.attr, &sensor_dev_attr_pwm1.dev_attr.attr,
&dev_attr_auto_fan1_channel.attr, &sensor_dev_attr_auto_fan1_channel.dev_attr.attr,
&dev_attr_temp1_input.attr, &sensor_dev_attr_temp1_input.dev_attr.attr,
&dev_attr_temp1_min.attr, &sensor_dev_attr_temp1_min.dev_attr.attr,
&dev_attr_temp1_max.attr, &sensor_dev_attr_temp1_max.dev_attr.attr,
&dev_attr_temp1_crit.attr, &sensor_dev_attr_temp1_crit.dev_attr.attr,
&dev_attr_temp2_input.attr, &sensor_dev_attr_temp2_input.dev_attr.attr,
&dev_attr_temp2_min.attr, &sensor_dev_attr_temp2_min.dev_attr.attr,
&dev_attr_temp2_max.attr, &sensor_dev_attr_temp2_max.dev_attr.attr,
&dev_attr_temp2_crit.attr, &sensor_dev_attr_temp2_crit.dev_attr.attr,
&dev_attr_auto_temp1_off.attr, &sensor_dev_attr_auto_temp1_off.dev_attr.attr,
&dev_attr_auto_temp1_min.attr, &sensor_dev_attr_auto_temp1_min.dev_attr.attr,
&dev_attr_auto_temp1_max.attr, &sensor_dev_attr_auto_temp1_max.dev_attr.attr,
&dev_attr_auto_temp2_off.attr, &sensor_dev_attr_auto_temp2_off.dev_attr.attr,
&dev_attr_auto_temp2_min.attr, &sensor_dev_attr_auto_temp2_min.dev_attr.attr,
&dev_attr_auto_temp2_max.attr, &sensor_dev_attr_auto_temp2_max.dev_attr.attr,
&dev_attr_auto_fan1_min_pwm.attr, &sensor_dev_attr_auto_fan1_min_pwm.dev_attr.attr,
&dev_attr_alarms.attr, &dev_attr_alarms.attr,
@ -773,19 +712,19 @@ static const struct attribute_group adm1031_group = {
}; };
static struct attribute *adm1031_attributes_opt[] = { static struct attribute *adm1031_attributes_opt[] = {
&dev_attr_fan2_input.attr, &sensor_dev_attr_fan2_input.dev_attr.attr,
&dev_attr_fan2_div.attr, &sensor_dev_attr_fan2_div.dev_attr.attr,
&dev_attr_fan2_min.attr, &sensor_dev_attr_fan2_min.dev_attr.attr,
&dev_attr_pwm2.attr, &sensor_dev_attr_pwm2.dev_attr.attr,
&dev_attr_auto_fan2_channel.attr, &sensor_dev_attr_auto_fan2_channel.dev_attr.attr,
&dev_attr_temp3_input.attr, &sensor_dev_attr_temp3_input.dev_attr.attr,
&dev_attr_temp3_min.attr, &sensor_dev_attr_temp3_min.dev_attr.attr,
&dev_attr_temp3_max.attr, &sensor_dev_attr_temp3_max.dev_attr.attr,
&dev_attr_temp3_crit.attr, &sensor_dev_attr_temp3_crit.dev_attr.attr,
&dev_attr_auto_temp3_off.attr, &sensor_dev_attr_auto_temp3_off.dev_attr.attr,
&dev_attr_auto_temp3_min.attr, &sensor_dev_attr_auto_temp3_min.dev_attr.attr,
&dev_attr_auto_temp3_max.attr, &sensor_dev_attr_auto_temp3_max.dev_attr.attr,
&dev_attr_auto_fan2_min_pwm.attr, &sensor_dev_attr_auto_fan2_min_pwm.dev_attr.attr,
NULL NULL
}; };