Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Apr 2026 16:15:34 +0000
From:      Enji Cooper <ngie@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 67504e71521d - stable/15 - chore: asmc: use designated initializers in macros
Message-ID:  <69ece8a6.43c97.538f16d@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=67504e71521d7806e3a6b67fe43da350839eabc8

commit 67504e71521d7806e3a6b67fe43da350839eabc8
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-02-20 06:31:21 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-04-25 16:14:51 +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
    
    (cherry picked from commit ef1cde51032d395492caae302fedf183c58a482b)
---
 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 b874599dcc81..756f4c12e43d 100644
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -135,31 +135,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
 
 #define	ASMC_TEMPS_FUNCS_DISABLED \
 			  .smc_temps = {},		\


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69ece8a6.43c97.538f16d>