Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 363052
b: refs/heads/master
c: bec24b7
h: refs/heads/master
v: v3
  • Loading branch information
Guenter Roeck committed Apr 8, 2013
1 parent a5c4dba commit e280e00
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 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: f539038e0b26b88baf6caad9402ce17ab8256aac
refs/heads/master: bec24b74b2cf56442af11f2d43c5083650b8c372
38 changes: 16 additions & 22 deletions trunk/drivers/hwmon/ltc4261.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,25 +164,13 @@ static ssize_t ltc4261_show_bool(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%d\n", fault ? 1 : 0);
}

/*
* These macros are used below in constructing device attribute objects
* for use with sysfs_create_group() to make a sysfs device file
* for each register.
*/

#define LTC4261_VALUE(name, ltc4261_cmd_idx) \
static SENSOR_DEVICE_ATTR(name, S_IRUGO, \
ltc4261_show_value, NULL, ltc4261_cmd_idx)

#define LTC4261_BOOL(name, mask) \
static SENSOR_DEVICE_ATTR(name, S_IRUGO, \
ltc4261_show_bool, NULL, (mask))

/*
* Input voltages.
*/
LTC4261_VALUE(in1_input, LTC4261_ADIN_H);
LTC4261_VALUE(in2_input, LTC4261_ADIN2_H);
static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ltc4261_show_value, NULL,
LTC4261_ADIN_H);
static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc4261_show_value, NULL,
LTC4261_ADIN2_H);

/*
* Voltage alarms. The chip has only one set of voltage alarm status bits,
Expand All @@ -192,16 +180,22 @@ LTC4261_VALUE(in2_input, LTC4261_ADIN2_H);
* To ensure that the alarm condition is reported to the user, report it
* with both voltage sensors.
*/
LTC4261_BOOL(in1_min_alarm, FAULT_UV);
LTC4261_BOOL(in1_max_alarm, FAULT_OV);
LTC4261_BOOL(in2_min_alarm, FAULT_UV);
LTC4261_BOOL(in2_max_alarm, FAULT_OV);
static SENSOR_DEVICE_ATTR(in1_min_alarm, S_IRUGO, ltc4261_show_bool, NULL,
FAULT_UV);
static SENSOR_DEVICE_ATTR(in1_max_alarm, S_IRUGO, ltc4261_show_bool, NULL,
FAULT_OV);
static SENSOR_DEVICE_ATTR(in2_min_alarm, S_IRUGO, ltc4261_show_bool, NULL,
FAULT_UV);
static SENSOR_DEVICE_ATTR(in2_max_alarm, S_IRUGO, ltc4261_show_bool, NULL,
FAULT_OV);

/* Currents (via sense resistor) */
LTC4261_VALUE(curr1_input, LTC4261_SENSE_H);
static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc4261_show_value, NULL,
LTC4261_SENSE_H);

/* Overcurrent alarm */
LTC4261_BOOL(curr1_max_alarm, FAULT_OC);
static SENSOR_DEVICE_ATTR(curr1_max_alarm, S_IRUGO, ltc4261_show_bool, NULL,
FAULT_OC);

static struct attribute *ltc4261_attributes[] = {
&sensor_dev_attr_in1_input.dev_attr.attr,
Expand Down

0 comments on commit e280e00

Please sign in to comment.