Skip to contentSkip to conversation

hwmon: (dell-smm) Pack the whole smm_regs struct

PATCH Applied Armin Wolf 2 participants 2 messages Dec 21, 2021

Subsystems (2)
lore
Share & tools
lore

Armin Wolf

author
#0 lore raw

PATCH 1/1 hwmon: (dell-smm) Pack the whole smm_regs struct

When desiring the whole struct to be packed, __packed should be applied to the whole struct, not just every struct member except the first one.

Tested on a Dell Inspiron 3505.

---
 drivers/hwmon/dell-smm-hwmon.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/hwmon/dell-smm-hwmon.c +6 -6
index d8c6e75bb374..d401f9acf450 100644
@@ -113,12 +113,12 @@ MODULE_PARM_DESC(fan_max, "Maximum configurable fan speed (default: autodetect)"
 
 struct smm_regs {
 	unsigned int eax;
-	unsigned int ebx __packed;
-	unsigned int ecx __packed;
-	unsigned int edx __packed;
-	unsigned int esi __packed;
-	unsigned int edi __packed;
-};
+	unsigned int ebx;
+	unsigned int ecx;
+	unsigned int edx;
+	unsigned int esi;
+	unsigned int edi;
+} __packed;
 
 static const char * const temp_labels[] = {
 	"CPU",

--
2.30.2

maintainer Applied
#1 lore raw
Quoted 7 lines · Armin Wolf

When desiring the whole struct to be packed, __packed should be applied to the whole struct, not just every struct member except the first one.

Tested on a Dell Inspiron 3505.

Applied to hwmon-next.

Thanks,
Guenter

Quoted 30 lines
---
 drivers/hwmon/dell-smm-hwmon.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--
2.30.2

drivers/hwmon/dell-smm-hwmon.c +6 -6
index d8c6e75bb374..d401f9acf450 100644
@@ -113,12 +113,12 @@ MODULE_PARM_DESC(fan_max, "Maximum configurable fan speed (default: autodetect)"
 
 struct smm_regs {
 	unsigned int eax;
-	unsigned int ebx __packed;
-	unsigned int ecx __packed;
-	unsigned int edx __packed;
-	unsigned int esi __packed;
-	unsigned int edi __packed;
-};
+	unsigned int ebx;
+	unsigned int ecx;
+	unsigned int edx;
+	unsigned int esi;
+	unsigned int edi;
+} __packed;
 
 static const char * const temp_labels[] = {
 	"CPU",