[PATCH 65/75] header Add SENSOR_DEVICE_ATTR_RO

Hauke Mehrtens <[email protected]> Fri, 28 Jun 2024 01:47:51 +0200
Newsgroups org.kernel.vger.backports
Message-ID <[email protected]>
These new attributes are used by the mt76 driver.

Signed-off-by: Hauke Mehrtens <[email protected]>
---
 backport/backport-include/linux/hwmon-sysfs.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 backport/backport-include/linux/hwmon-sysfs.h

diff --git a/backport/backport-include/linux/hwmon-sysfs.h b/backport/backport-include/linux/hwmon-sysfs.h
new file mode 100644
index 00000000..84a4e149
--- /dev/null
+++ b/backport/backport-include/linux/hwmon-sysfs.h
@@ -0,0 +1,15 @@
+#ifndef __BACKPORT_LINUX_HWMON_SYSFS_H
+#define __BACKPORT_LINUX_HWMON_SYSFS_H
+#include_next <linux/hwmon-sysfs.h>
+
+#ifndef SENSOR_DEVICE_ATTR_RO
+#define SENSOR_DEVICE_ATTR_RO(_name, _func, _index)		\
+	SENSOR_DEVICE_ATTR(_name, 0444, _func##_show, NULL, _index)
+#endif
+
+#ifndef SENSOR_DEVICE_ATTR_RW
+#define SENSOR_DEVICE_ATTR_RW(_name, _func, _index)		\
+	SENSOR_DEVICE_ATTR(_name, 0644, _func##_show, _func##_store, _index)
+#endif
+
+#endif /* __BACKPORT_LINUX_HWMON_SYSFS_H */
-- 
2.45.2