git: ef1cde51032d - main - chore: asmc: use designated initializers in macros
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Feb 2026 06:35:44 UTC
The branch main has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=ef1cde51032d395492caae302fedf183c58a482b
commit ef1cde51032d395492caae302fedf183c58a482b
Author: Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-02-20 06:31:21 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-02-20 06:35:16 +0000
chore: asmc: use designated initializers in macros
This code cleanup makes it easier for human readers to understand what each
of the fields actually represents, as well as makes it easier to modify
what the macros actually do under the covers, without introducing
potential human errors.
No functional change intended.
MFC after: 1 week
---
sys/dev/asmc/asmc.c | 61 +++++++++++++++++++++++++++++++++--------------------
1 file changed, 38 insertions(+), 23 deletions(-)
diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
index 880da33ad9f3..b5cf123bd99f 100644
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -134,31 +134,46 @@ struct asmc_model {
static const struct asmc_model *asmc_match(device_t dev);
-#define ASMC_SMS_FUNCS asmc_mb_sysctl_sms_x, asmc_mb_sysctl_sms_y, \
- asmc_mb_sysctl_sms_z
-
-#define ASMC_SMS_FUNCS_DISABLED NULL, NULL, NULL
-
-#define ASMC_FAN_FUNCS asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, asmc_mb_sysctl_fansafespeed, \
- asmc_mb_sysctl_fanminspeed, \
- asmc_mb_sysctl_fanmaxspeed, \
- asmc_mb_sysctl_fantargetspeed
-
-#define ASMC_FAN_FUNCS2 asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, NULL, \
- asmc_mb_sysctl_fanminspeed, \
- asmc_mb_sysctl_fanmaxspeed, \
- asmc_mb_sysctl_fantargetspeed
-
-#define ASMC_LIGHT_FUNCS asmc_mbp_sysctl_light_left, \
- asmc_mbp_sysctl_light_right, \
- asmc_mbp_sysctl_light_control
+#define ASMC_SMS_FUNCS \
+ .smc_sms_x = asmc_mb_sysctl_sms_x, \
+ .smc_sms_y = asmc_mb_sysctl_sms_y, \
+ .smc_sms_z = asmc_mb_sysctl_sms_z
+
+#define ASMC_SMS_FUNCS_DISABLED \
+ .smc_sms_x = NULL, \
+ .smc_sms_y = NULL, \
+ .smc_sms_z = NULL
+
+#define ASMC_FAN_FUNCS \
+ .smc_fan_id = asmc_mb_sysctl_fanid, \
+ .smc_fan_speed = asmc_mb_sysctl_fanspeed, \
+ .smc_fan_safespeed = asmc_mb_sysctl_fansafespeed, \
+ .smc_fan_minspeed = asmc_mb_sysctl_fanminspeed, \
+ .smc_fan_maxspeed = asmc_mb_sysctl_fanmaxspeed, \
+ .smc_fan_targetspeed = asmc_mb_sysctl_fantargetspeed
+
+#define ASMC_FAN_FUNCS2 \
+ .smc_fan_id = asmc_mb_sysctl_fanid, \
+ .smc_fan_speed = asmc_mb_sysctl_fanspeed, \
+ .smc_fan_safespeed = NULL, \
+ .smc_fan_minspeed = asmc_mb_sysctl_fanminspeed, \
+ .smc_fan_maxspeed = asmc_mb_sysctl_fanmaxspeed, \
+ .smc_fan_targetspeed = asmc_mb_sysctl_fantargetspeed
+
+#define ASMC_LIGHT_FUNCS \
+ .smc_light_left = asmc_mbp_sysctl_light_left, \
+ .smc_light_right = asmc_mbp_sysctl_light_right, \
+ .smc_light_control = asmc_mbp_sysctl_light_control
#define ASMC_LIGHT_FUNCS_10BYTE \
- asmc_mbp_sysctl_light_left_10byte, \
- NULL, \
- asmc_mbp_sysctl_light_control
-
-#define ASMC_LIGHT_FUNCS_DISABLED NULL, NULL, NULL
+ .smc_light_left = asmc_mbp_sysctl_light_left_10byte, \
+ .smc_light_right = NULL, \
+ .smc_light_control = asmc_mbp_sysctl_light_control
+
+#define ASMC_LIGHT_FUNCS_DISABLED \
+ .smc_light_left = NULL, \
+ .smc_light_right = NULL, \
+ .smc_light_control = NULL
static const struct asmc_model asmc_models[] = {
{