lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231109051429.2250774-1-Jun.Ma2@amd.com>
Date:   Thu, 9 Nov 2023 13:14:29 +0800
From:   Ma Jun <Jun.Ma2@....com>
To:     <jdelvare@...e.com>, <linux@...ck-us.net>,
        <linux-hwmon@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC:     Ma Jun <Jun.Ma2@....com>
Subject: [PATCH] hwmon: Add a new macro sensor_sysfs_attr

The attribute definiations like &sensor_dev_attr_xx_xx.dev_attr.attr
are widely used in drivers. So add a new macro sensor_sysfs_attr t
to make it easier to understand and use.

For example, user can use the sensor_sysfs_attr(xx_xx) instead of
&sensor_dev_attr_xx_xx.dev_attr.attr

Signed-off-by: Ma Jun <Jun.Ma2@....com>
---
 include/linux/hwmon-sysfs.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h
index d896713359cd..7feae637e3b5 100644
--- a/include/linux/hwmon-sysfs.h
+++ b/include/linux/hwmon-sysfs.h
@@ -14,6 +14,10 @@ struct sensor_device_attribute{
 	struct device_attribute dev_attr;
 	int index;
 };
+
+#define to_sensor_sysfs_attr(_name) \
+	(&sensor_dev_attr_##_name.dev_attr.attr)
+
 #define to_sensor_dev_attr(_dev_attr) \
 	container_of(_dev_attr, struct sensor_device_attribute, dev_attr)
 
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ