Skip to contentSkip to conversation

gpiolib: Switch to use compat_need_64bit_alignment_fixup() helper

PATCH Superseded Andy Shevchenko 1 participant 2 messages Oct 8, 2020

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiolib: Switch to use compat_need_64bit_alignment_fixup() helper

The new compat_need_64bit_alignment_fixup() helper allows to avoid ugly ifdefferu in IOCTL compatible code. Use it in GPIO cdev code.

Depends-on: 527c412519eb ("compat: add a compat_need_64bit_alignment_fixup() helper")
Depends-on: cc7886d25bca ("compat: lift compat_s64 and compat_u64 to <asm-generic/compat.h>")

---
 drivers/gpio/gpiolib-cdev.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/gpio/gpiolib-cdev.c +6 -10
index e9faeaf65d14..03f33521e737 100644
@@ -1479,19 +1479,15 @@ static __poll_t lineevent_poll(struct file *file,
 	return events;
 }
 
+struct compat_gpioeevent_data {
+	compat_u64	timestamp;
+	u32		id;
+};
+
 static ssize_t lineevent_get_size(void)
 {
-#if defined(CONFIG_X86_64) && !defined(CONFIG_UML)
-	/* i386 has no padding after 'id' */
-	if (in_ia32_syscall()) {
-		struct compat_gpioeevent_data {
-			compat_u64	timestamp;
-			u32		id;
-		};
-
+	if (compat_need_64bit_alignment_fixup())
 		return sizeof(struct compat_gpioeevent_data);
-	}
-#endif
 	return sizeof(struct gpioevent_data);
 }
 
Signature · 1 line
2.28.0
#1 lore raw
Quoted 2 lines · Andy Shevchenko

The new compat_need_64bit_alignment_fixup() helper allows to avoid ugly ifdefferu in IOCTL compatible code. Use it in GPIO cdev code.

There is v2 coming, don't consider this, thanks!

Signature · 2 lines
With Best Regards,
Andy Shevchenko