Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 220479
b: refs/heads/master
c: 87df0da
h: refs/heads/master
i:
  220477: ca51d52
  220475: cec9003
  220471: a3d840d
  220463: 6329ff5
  220447: 0006193
  220415: 8676269
v: v3
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Oct 28, 2010
1 parent a248b3e commit 6fe1164
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6f3dcde9c6dcbbe781a2a98900552bcb989733e3
refs/heads/master: 87df0dad3e024538d2d0d2ce786230e639c2ea8b
66 changes: 37 additions & 29 deletions trunk/drivers/hwmon/w83795.c
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ store_sf_setup(struct device *dev, struct device_attribute *attr,

#define NOT_USED -1

#define SENSOR_ATTR_IN(index) \
#define SENSOR_ATTR_IN(index) { \
SENSOR_ATTR_2(in##index##_input, S_IRUGO, show_in, NULL, \
IN_READ, index), \
SENSOR_ATTR_2(in##index##_max, S_IRUGO | S_IWUSR, show_in, \
Expand All @@ -1458,17 +1458,17 @@ store_sf_setup(struct device *dev, struct device_attribute *attr,
NULL, ALARM_STATUS, index + ((index > 14) ? 1 : 0)), \
SENSOR_ATTR_2(in##index##_beep, S_IWUSR | S_IRUGO, \
show_alarm_beep, store_beep, BEEP_ENABLE, \
index + ((index > 14) ? 1 : 0))
index + ((index > 14) ? 1 : 0)) }

#define SENSOR_ATTR_FAN(index) \
#define SENSOR_ATTR_FAN(index) { \
SENSOR_ATTR_2(fan##index##_input, S_IRUGO, show_fan, \
NULL, FAN_INPUT, index - 1), \
SENSOR_ATTR_2(fan##index##_min, S_IWUSR | S_IRUGO, \
show_fan, store_fan_min, FAN_MIN, index - 1), \
SENSOR_ATTR_2(fan##index##_alarm, S_IRUGO, show_alarm_beep, \
NULL, ALARM_STATUS, index + 31), \
SENSOR_ATTR_2(fan##index##_beep, S_IWUSR | S_IRUGO, \
show_alarm_beep, store_beep, BEEP_ENABLE, index + 31)
show_alarm_beep, store_beep, BEEP_ENABLE, index + 31) }

#define SENSOR_ATTR_PWM(index) \
SENSOR_ATTR_2(pwm##index, S_IWUSR | S_IRUGO, show_pwm, \
Expand All @@ -1488,7 +1488,7 @@ store_sf_setup(struct device *dev, struct device_attribute *attr,
SENSOR_ATTR_2(speed_cruise##index##_target, S_IWUSR | S_IRUGO, \
show_fanin, store_fanin, FANIN_TARGET, index - 1)

#define SENSOR_ATTR_DTS(index) \
#define SENSOR_ATTR_DTS(index) { \
SENSOR_ATTR_2(temp##index##_type, S_IRUGO , \
show_dts_mode, NULL, NOT_USED, index - 7), \
SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_dts, \
Expand All @@ -1504,9 +1504,9 @@ store_sf_setup(struct device *dev, struct device_attribute *attr,
SENSOR_ATTR_2(temp##index##_alarm, S_IRUGO, \
show_alarm_beep, NULL, ALARM_STATUS, index + 17), \
SENSOR_ATTR_2(temp##index##_beep, S_IWUSR | S_IRUGO, \
show_alarm_beep, store_beep, BEEP_ENABLE, index + 17)
show_alarm_beep, store_beep, BEEP_ENABLE, index + 17) }

#define SENSOR_ATTR_TEMP(index) \
#define SENSOR_ATTR_TEMP(index) { \
SENSOR_ATTR_2(temp##index##_type, S_IRUGO | S_IWUSR, \
show_temp_mode, store_temp_mode, NOT_USED, index - 1), \
SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_temp, \
Expand Down Expand Up @@ -1568,10 +1568,10 @@ store_sf_setup(struct device *dev, struct device_attribute *attr,
SENSOR_ATTR_2(temp##index##_auto_point6_temp, S_IRUGO | S_IWUSR,\
show_sf4_temp, store_sf4_temp, 5, index - 1), \
SENSOR_ATTR_2(temp##index##_auto_point7_temp, S_IRUGO | S_IWUSR,\
show_sf4_temp, store_sf4_temp, 6, index - 1)
show_sf4_temp, store_sf4_temp, 6, index - 1) }


static struct sensor_device_attribute_2 w83795_in[] = {
static struct sensor_device_attribute_2 w83795_in[][5] = {
SENSOR_ATTR_IN(0),
SENSOR_ATTR_IN(1),
SENSOR_ATTR_IN(2),
Expand All @@ -1595,7 +1595,7 @@ static struct sensor_device_attribute_2 w83795_in[] = {
SENSOR_ATTR_IN(20),
};

static struct sensor_device_attribute_2 w83795_fan[] = {
static struct sensor_device_attribute_2 w83795_fan[][4] = {
SENSOR_ATTR_FAN(1),
SENSOR_ATTR_FAN(2),
SENSOR_ATTR_FAN(3),
Expand All @@ -1612,7 +1612,7 @@ static struct sensor_device_attribute_2 w83795_fan[] = {
SENSOR_ATTR_FAN(14),
};

static struct sensor_device_attribute_2 w83795_temp[] = {
static struct sensor_device_attribute_2 w83795_temp[][29] = {
SENSOR_ATTR_TEMP(1),
SENSOR_ATTR_TEMP(2),
SENSOR_ATTR_TEMP(3),
Expand All @@ -1621,7 +1621,7 @@ static struct sensor_device_attribute_2 w83795_temp[] = {
SENSOR_ATTR_TEMP(6),
};

static struct sensor_device_attribute_2 w83795_dts[] = {
static struct sensor_device_attribute_2 w83795_dts[][8] = {
SENSOR_ATTR_DTS(7),
SENSOR_ATTR_DTS(8),
SENSOR_ATTR_DTS(9),
Expand Down Expand Up @@ -1781,22 +1781,26 @@ static int w83795_handle_files(struct device *dev, int (*fn)(struct device *,
const struct device_attribute *))
{
struct w83795_data *data = dev_get_drvdata(dev);
int err, i;
int err, i, j;

for (i = 0; i < ARRAY_SIZE(w83795_in); i++) {
if (!(data->has_in & (1 << (i / 6))))
if (!(data->has_in & (1 << i)))
continue;
err = fn(dev, &w83795_in[i].dev_attr);
if (err)
return err;
for (j = 0; j < ARRAY_SIZE(w83795_in[0]); j++) {
err = fn(dev, &w83795_in[i][j].dev_attr);
if (err)
return err;
}
}

for (i = 0; i < ARRAY_SIZE(w83795_fan); i++) {
if (!(data->has_fan & (1 << (i / 5))))
if (!(data->has_fan & (1 << i)))
continue;
err = fn(dev, &w83795_fan[i].dev_attr);
if (err)
return err;
for (j = 0; j < ARRAY_SIZE(w83795_fan[0]); j++) {
err = fn(dev, &w83795_fan[i][j].dev_attr);
if (err)
return err;
}
}

for (i = 0; i < ARRAY_SIZE(sda_single_files); i++) {
Expand All @@ -1814,20 +1818,24 @@ static int w83795_handle_files(struct device *dev, int (*fn)(struct device *,
}

for (i = 0; i < ARRAY_SIZE(w83795_temp); i++) {
if (!(data->has_temp & (1 << (i / 29))))
if (!(data->has_temp & (1 << i)))
continue;
err = fn(dev, &w83795_temp[i].dev_attr);
if (err)
return err;
for (j = 0; j < ARRAY_SIZE(w83795_temp[0]); j++) {
err = fn(dev, &w83795_temp[i][j].dev_attr);
if (err)
return err;
}
}

if (data->enable_dts != 0) {
for (i = 0; i < ARRAY_SIZE(w83795_dts); i++) {
if (!(data->has_dts & (1 << (i / 8))))
if (!(data->has_dts & (1 << i)))
continue;
err = fn(dev, &w83795_dts[i].dev_attr);
if (err)
return err;
for (j = 0; j < ARRAY_SIZE(w83795_dts[0]); j++) {
err = fn(dev, &w83795_dts[i][j].dev_attr);
if (err)
return err;
}
}
}

Expand Down

0 comments on commit 6fe1164

Please sign in to comment.