hwmon: Add notification and uevent
Subsystems (2)
PATCH v2 2/2 hwmon: Add notification and uevent
Some hwmon drivers start adding support for alarm attribute notifications and generate uevents. Standardize the ABI to be used for this purpose.
---
v2: Fixed typos.
Added faults to attributes triggering notifications. Generate uevent on hwmon device kobject.
Documentation/hwmon/sysfs-interface | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)
Documentation/hwmon/sysfs-interface +32 -0
@@ -97,6 +97,17 @@ update_interval The interval at which the chip will update readings. Some devices have a variable update rate or interval. This attribute can be used to change it to the desired value. +notification This attribute exists if the driver supports notifications on + alarm, fault, and trigger attributes. Valid attribute values + are: + 0: The driver does not support notifications or uevents. + 1: The driver supports notifications. + 2: The driver generates a uevent if an alarm, fault, or trigger + status changes. + 3: The driver suports notifications and generates a uevent if + an alarm, fault, or trigger status changes. + RO + ************ * Voltages *
@@ -706,6 +717,27 @@ intrusion[0-*]_beep RW +Notifications and uevents +------------------------- + +Hwmon drivers may support generating notification on sysfs alarm, fault, and +trigger attributes. This support is reflected in the existence of the +"notification" attribute described above. + +If a driver supports notifications, applications do not have to manually poll +alarm, fault, and trigger attributes, but can use poll(2) or epoll(4) instead. + +If a driver supports notifications, it shall support it for all alarm and +trigger attributes, and should support it for all fault attributes. +Notifications shall be generated for all state transistions (0->1 as well as +1->0). + +In addition to notifications, drivers may also support uevents. If so, a uevent +shall be generated whenever an alarm or trigger attribute changes its state, and +should be generated whenever a fault attribute changes its state. The uevent +shall be generated on the driver's hwmon device kobject. + + sysfs attribute writes interpretation -------------------------------------
Signature · 7 lines
1.7.3.1 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 3 lines · Guenter Roeck
Some hwmon drivers start adding support for alarm attribute notifications and generate uevents. Standardize the ABI to be used for this purpose.
Perhaps some guidance on when uevents make sense rather than notifications? Also, why would you do both?
Quoted 49 lines
Signed-off-by Guenter Roeck <[email protected]>---
v2: Fixed typos.
Added faults to attributes triggering notifications. Generate uevent on hwmon device kobject.Documentation/hwmon/sysfs-interface | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)Documentation/hwmon/sysfs-interface +25
-0@@ -97,6 +97,17 @@ update_interval The interval at which the chip will update readings. Some devices have a variable update rate or interval. This attribute can be used to change it to the desired value. +notification This attribute exists if the driver supports notifications on + alarm, fault, and trigger attributes. Valid attribute values + are: + 0: The driver does not support notifications or uevents. + 1: The driver supports notifications. + 2: The driver generates a uevent if an alarm, fault, or trigger + status changes. + 3: The driver suports notifications and generates a uevent if + an alarm, fault, or trigger status changes. + RO + ************ * Voltages *@@ -706,6 +717,27 @@ intrusion[0-*]_beep RW +Notifications and uevents +------------------------- + +Hwmon drivers may support generating notification on sysfs alarm, fault, and +trigger attributes. This support is reflected in the existence of the +"notification" attribute described above. + +If a driver supports notifications, applications do not have to manually poll +alarm, fault, and trigger attributes, but can use poll(2) or epoll(4) instead. + +If a driver supports notifications, it shall support it for all alarm and +trigger attributes, and should support it for all fault attributes. +Notifications shall be generated for all state transistions (0->1 as well as +1->0).
Documentation/hwmon/sysfs-interface intrusion[0-*]_beep · line 743
Quoted 10 lines
Documentation/hwmon/sysfs-interface +7
-0+ +In addition to notifications, drivers may also support uevents. If so, a uevent +shall be generated whenever an alarm or trigger attribute changes its state, and +should be generated whenever a fault attribute changes its state. The uevent +shall be generated on the driver's hwmon device kobject. + + sysfs attribute writes interpretation -------------------------------------
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 6 lines · Jonathan Cameron
Quoted 3 lines · Guenter Roeck
Some hwmon drivers start adding support for alarm attribute notifications and generate uevents. Standardize the ABI to be used for this purpose.
Perhaps some guidance on when uevents make sense rather than notifications? Also, why would you do both?
uevents enable script handling. An application or script is started after a uevent is generated to handle the event. Notifications are useful for running applications which wait in poll or epoll for an event on a file descriptor.
Both are useful and reflect that application developers have different approaches on how to handle events.
Thanks,
Guenter
Quoted 51 lines
Quoted 51 lines
Signed-off-by Guenter Roeck <[email protected]>---
v2: Fixed typos.
Added faults to attributes triggering notifications. Generate uevent on hwmon device kobject.Documentation/hwmon/sysfs-interface | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)Documentation/hwmon/sysfs-interface +27
-0@@ -97,6 +97,17 @@ update_interval The interval at which the chip will update readings. Some devices have a variable update rate or interval. This attribute can be used to change it to the desired value. +notification This attribute exists if the driver supports notifications on + alarm, fault, and trigger attributes. Valid attribute values + are: + 0: The driver does not support notifications or uevents. + 1: The driver supports notifications. + 2: The driver generates a uevent if an alarm, fault, or trigger + status changes. + 3: The driver suports notifications and generates a uevent if + an alarm, fault, or trigger status changes. + RO + ************ * Voltages *@@ -706,6 +717,27 @@ intrusion[0-*]_beep RW +Notifications and uevents +------------------------- + +Hwmon drivers may support generating notification on sysfs alarm, fault, and +trigger attributes. This support is reflected in the existence of the +"notification" attribute described above. + +If a driver supports notifications, applications do not have to manually poll +alarm, fault, and trigger attributes, but can use poll(2) or epoll(4) instead. + +If a driver supports notifications, it shall support it for all alarm and +trigger attributes, and should support it for all fault attributes. +Notifications shall be generated for all state transistions (0->1 as well as +1->0). + +In addition to notifications, drivers may also support uevents. If so, a uevent
Quoted 9 lines
Documentation/hwmon/sysfs-interface intrusion[0-*]_beep · line 743
Quoted 8 lines
Documentation/hwmon/sysfs-interface +5
-0+shall be generated whenever an alarm or trigger attribute changes its state, and +should be generated whenever a fault attribute changes its state. The uevent +shall be generated on the driver's hwmon device kobject. + + sysfs attribute writes interpretation -------------------------------------
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Guenter,
This patch looks fine for me.
Please add:
Quoted 55 lines
Quoted 7 lines
Quoted 7 lines
Signed-off-by Guenter Roeck <[email protected]>---
v2: Fixed typos.
Added faults to attributes triggering notifications. Generate uevent on hwmon device kobject.Documentation/hwmon/sysfs-interface | 32++++++++++++++++++++++++++++++++
Quoted 3 lines
Review
Quoted 3 lines
1 files changed, 32 insertions(+), 0 deletions(-)(quoted diff) +0
-0b/Documentation/hwmon/sysfs-interface
Quoted 4 lines
Documentation/hwmon/sysfs-interface update_interval The interval at which the chip will
Quoted 4 lines
index e65e7e8..35b09d6 100644
Documentation/hwmon/sysfs-interface +0
-0@@ -97,6 +97,17 @@ update_interval The interval at which the chip willupdate readings.
Quoted 21 lines
Quoted 21 lines
Documentation/hwmon/sysfs-interface +11
-0Some devices have a variable update rate or interval. This attribute can be used to change it to the desired value. +notification This attribute exists if the driver supports notifications on + alarm, fault, and trigger attributes. Valid attribute values + are: + 0: The driver does not support notifications or uevents. + 1: The driver supports notifications. + 2: The driver generates a uevent if an alarm, fault, or trigger + status changes. + 3: The driver suports notifications and generates a uevent if + an alarm, fault, or trigger status changes. + RO + ************ * Voltages *@@ -706,6 +717,27 @@ intrusion[0-*]_beep RWQuoted 4 lines
Documentation/hwmon/sysfs-interface intrusion[0-*]_beep
Quoted 4 lines
Documentation/hwmon/sysfs-interface +4
-0+Notifications and uevents +------------------------- + +Hwmon drivers may support generating notification on sysfs alarm, fault,and
Quoted 4 lines
Documentation/hwmon/sysfs-interface intrusion[0-*]_beep
Quoted 4 lines
Documentation/hwmon/sysfs-interface +4
-0+trigger attributes. This support is reflected in the existence of the +"notification" attribute described above. + +If a driver supports notifications, applications do not have to manuallypoll
Quoted 1 line
Documentation/hwmon/sysfs-interface intrusion[0-*]_beep · line 728
Quoted 1 line
Documentation/hwmon/sysfs-interface +1
-0+alarm, fault, and trigger attributes, but can use poll(2) or epoll(4)instead.
Quoted 4 lines
Documentation/hwmon/sysfs-interface intrusion[0-*]_beep
Quoted 4 lines
Documentation/hwmon/sysfs-interface +4
-0+ +If a driver supports notifications, it shall support it for all alarm and +trigger attributes, and should support it for all fault attributes. +Notifications shall be generated for all state transistions (0->1 as wellas
Quoted 15 lines
Quoted 3 lines
Documentation/hwmon/sysfs-interface intrusion[0-*]_beep
Quoted 3 lines
Documentation/hwmon/sysfs-interface +3
-0+1->0). + +In addition to notifications, drivers may also support uevents. If so, auevent
Quoted 1 line
Documentation/hwmon/sysfs-interface intrusion[0-*]_beep · line 736
Quoted 1 line
Documentation/hwmon/sysfs-interface +1
-0+shall be generated whenever an alarm or trigger attribute changes itsstate, and
Quoted 1 line
Documentation/hwmon/sysfs-interface intrusion[0-*]_beep · line 737
Quoted 1 line
Documentation/hwmon/sysfs-interface +1
-0+should be generated whenever a fault attribute changes its state. Theuevent
Quoted 7 lines
Quoted 6 lines
Documentation/hwmon/sysfs-interface +3
-0+shall be generated on the driver's hwmon device kobject. + + sysfs attribute writes interpretation -------------------------------------
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors