Skip to contentSkip to conversation

hwmon: (lineage-pem): Fix in1 voltage alarm

PATCH In review Guenter Roeck 2 participants 4 messages Mar 15, 2011 – Mar 16, 2011 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (lineage-pem): Fix in1 voltage alarm

The alarm bit assumed to be a low voltage alarm bit is not set for low voltage alarms, and the alarm bit assumed to be a high voltage alarm turns out to be a general alarm bit which is set for both low and high voltage alarms.

Remove the in1_min_alarm sysfs attribute and rename in1_max_alarm to in1_alarm to reflect the situation.

---
 drivers/hwmon/lineage-pem.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
drivers/hwmon/lineage-pem.c +2 -5
index 2fe8e9e..ab63650 100644
@@ -345,9 +345,7 @@ static ssize_t pem_show_fan(struct device *dev, struct device_attribute *da,
 /* Voltages */
 static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, pem_show_data, NULL,
 			  PEM_DATA_VOUT_LSB);
-static SENSOR_DEVICE_ATTR_2(in1_min_alarm, S_IRUGO, pem_show_bool, NULL,
-			    PEM_DATA_ALARM_2, ALRM2_OV_LOW);
-static SENSOR_DEVICE_ATTR_2(in1_max_alarm, S_IRUGO, pem_show_bool, NULL,
+static SENSOR_DEVICE_ATTR_2(in1_alarm, S_IRUGO, pem_show_bool, NULL,
 			    PEM_DATA_ALARM_1, ALRM1_VOUT_OUT_LIMIT);
 static SENSOR_DEVICE_ATTR_2(in1_crit_alarm, S_IRUGO, pem_show_bool, NULL,
 			    PEM_DATA_ALARM_1, ALRM1_OV_VOLT_SHUTDOWN);
@@ -395,8 +393,7 @@ static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, pem_show_bool, NULL,
 
 static struct attribute *pem_attributes[] = {
 	&sensor_dev_attr_in1_input.dev_attr.attr,
-	&sensor_dev_attr_in1_min_alarm.dev_attr.attr,
-	&sensor_dev_attr_in1_max_alarm.dev_attr.attr,
+	&sensor_dev_attr_in1_alarm.dev_attr.attr,
 	&sensor_dev_attr_in1_crit_alarm.dev_attr.attr,
 	&sensor_dev_attr_in2_alarm.dev_attr.attr,
 
Signature · 7 lines
1.7.3.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/1
#1 lore raw

Re: [lm-sensors] [PATCH] hwmon: (lineage-pem): Fix in1 voltage

Quoted 28 lines · Guenter Roeck

The alarm bit assumed to be a low voltage alarm bit is not set for low voltage alarms, and the alarm bit assumed to be a high voltage alarm turns out to be a general alarm bit which is set for both low and high voltage alarms.

Remove the in1_min_alarm sysfs attribute and rename in1_max_alarm to in1_alarm to reflect the situation.

---
 drivers/hwmon/lineage-pem.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
drivers/hwmon/lineage-pem.c +1 -3
index 2fe8e9e..ab63650 100644
@@ -345,9 +345,7 @@ static ssize_t pem_show_fan(struct device *dev, struct device_attribute *da,
 /* Voltages */
 static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, pem_show_data, NULL,
 			  PEM_DATA_VOUT_LSB);
-static SENSOR_DEVICE_ATTR_2(in1_min_alarm, S_IRUGO, pem_show_bool, NULL,
-			    PEM_DATA_ALARM_2, ALRM2_OV_LOW);
-static SENSOR_DEVICE_ATTR_2(in1_max_alarm, S_IRUGO, pem_show_bool, NULL,
+static SENSOR_DEVICE_ATTR_2(in1_alarm, S_IRUGO, pem_show_bool, NULL,
 			    PEM_DATA_ALARM_1, ALRM1_VOUT_OUT_LIMIT);
 static SENSOR_DEVICE_ATTR_2(in1_crit_alarm, S_IRUGO, pem_show_bool, NULL,
 			    PEM_DATA_ALARM_1, ALRM1_OV_VOLT_SHUTDOWN);

drivers/hwmon/lineage-pem.c static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, pem_show_bool, NULL, · line 399

Quoted 9 lines
drivers/hwmon/lineage-pem.c +1 -2
@@ -395,8 +393,7 @@ static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, pem_show_bool, NULL,
 
 static struct attribute *pem_attributes[] = {
 	&sensor_dev_attr_in1_input.dev_attr.attr,
-	&sensor_dev_attr_in1_min_alarm.dev_attr.attr,
-	&sensor_dev_attr_in1_max_alarm.dev_attr.attr,
+	&sensor_dev_attr_in1_alarm.dev_attr.attr,
 	&sensor_dev_attr_in1_crit_alarm.dev_attr.attr,
 	&sensor_dev_attr_in2_alarm.dev_attr.attr,
 

Looks good.

Note that this means that this device has now in1_alarm and in1_crit_alarm. This is a case your proposed rewrite of the "sensors" code won't properly deal with, as it will only check for limit-specific alarm flags in the absence of a generic alarm flag (so in this case in1_crit_alarm will be ignored.) Not that the original code was better, but maybe it's the right time to get it right.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw

Re: [lm-sensors] [PATCH] hwmon: (lineage-pem): Fix in1 voltage

In reply to Guenter Roeck

Hi Jean,

Quoted 41 lines · Jean Delvare
Quoted 28 lines · Guenter Roeck

The alarm bit assumed to be a low voltage alarm bit is not set for low voltage alarms, and the alarm bit assumed to be a high voltage alarm turns out to be a general alarm bit which is set for both low and high voltage alarms.

Remove the in1_min_alarm sysfs attribute and rename in1_max_alarm to in1_alarm to reflect the situation.

---
 drivers/hwmon/lineage-pem.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
drivers/hwmon/lineage-pem.c +1 -3
index 2fe8e9e..ab63650 100644
@@ -345,9 +345,7 @@ static ssize_t pem_show_fan(struct device *dev, struct device_attribute *da,
 /* Voltages */
 static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, pem_show_data, NULL,
 			  PEM_DATA_VOUT_LSB);
-static SENSOR_DEVICE_ATTR_2(in1_min_alarm, S_IRUGO, pem_show_bool, NULL,
-			    PEM_DATA_ALARM_2, ALRM2_OV_LOW);
-static SENSOR_DEVICE_ATTR_2(in1_max_alarm, S_IRUGO, pem_show_bool, NULL,
+static SENSOR_DEVICE_ATTR_2(in1_alarm, S_IRUGO, pem_show_bool, NULL,
 			    PEM_DATA_ALARM_1, ALRM1_VOUT_OUT_LIMIT);
 static SENSOR_DEVICE_ATTR_2(in1_crit_alarm, S_IRUGO, pem_show_bool, NULL,
 			    PEM_DATA_ALARM_1, ALRM1_OV_VOLT_SHUTDOWN);

drivers/hwmon/lineage-pem.c static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, pem_show_bool, NULL, · line 399

Quoted 9 lines
drivers/hwmon/lineage-pem.c +1 -2
@@ -395,8 +393,7 @@ static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, pem_show_bool, NULL,
 
 static struct attribute *pem_attributes[] = {
 	&sensor_dev_attr_in1_input.dev_attr.attr,
-	&sensor_dev_attr_in1_min_alarm.dev_attr.attr,
-	&sensor_dev_attr_in1_max_alarm.dev_attr.attr,
+	&sensor_dev_attr_in1_alarm.dev_attr.attr,
 	&sensor_dev_attr_in1_crit_alarm.dev_attr.attr,
 	&sensor_dev_attr_in2_alarm.dev_attr.attr,
 

Looks good.

Quoted 9 lines

Note that this means that this device has now in1_alarm and in1_crit_alarm. This is a case your proposed rewrite of the "sensors" code won't properly deal with, as it will only check for limit-specific alarm flags in the absence of a generic alarm flag (so in this case in1_crit_alarm will be ignored.) Not that the original code was better, but maybe it's the right time to get it right.

Yes, I know :(. I didn't want to get rid of the _crit attribute, since it is supported and adds value. Figured I'd deal with the sensors problem later (if I find a good solution).

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#3 lore raw

Re: [lm-sensors] [PATCH] hwmon: (lineage-pem): Fix in1 voltage

In reply to Guenter Roeck
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Jean Delvare

Note that this means that this device has now in1_alarm and in1_crit_alarm. This is a case your proposed rewrite of the "sensors" code won't properly deal with, as it will only check for limit-specific alarm flags in the absence of a generic alarm flag (so in this case in1_crit_alarm will be ignored.) Not that the original code was better, but maybe it's the right time to get it right.

Yes, I know :(. I didn't want to get rid of the _crit attribute, since it is supported and adds value. Figured I'd deal with the sensors problem later (if I find a good solution).

Just always check for all possible alarm flags (generic and limit-specific alike)? The only annoyance I can see is that when in1_crit_alarm is set, whether or not in1_alarm is also set won't affect the output, it will be "ALARM (CRIT)" in both cases. But I don't think it is a problem in practice.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors