tools: termios_linux.h: Fix build error on ppc64
RFC PATCH 1/1 tools: termios_linux.h: Fix build error on ppc64
Commit 93b55636b09f ("tools: kwboot: Allow any baudrate on Linux") added a tcgetattr() function to be used, instead of the libc's termios functions.
This was done to allow using the raw TCGETS2/TCSETS2 ioctls that allow to support arbitrary baud rates.
This breaks the build for PowerPC, because that architecture does not have a struct termios2 defined becuase the termios and ktermios are the same.
On PowerPC, the termios ioctl() emulates the TCGETS2/TCSETS*2 ioctls with tcgetattr/tcsetattr using just the struct termios (that's as mentioned the same than what is defined as struct termios2 in other architectures).
So there is no need to use the TCGETS2/TCSETS2 ioctls on that architecture and just TCGETS/TCSETS ioctls with termios as defined by PowerPC is enough.
---
The patch fixes a build error found on Fedora rawhide with latest glibc:
https://bugzilla.redhat.com/show_bug.cgi?id=2375150
It is an RFC because I'm not familiar with this part of the code nor the PowerPC architecture. But this patch fixes the mentioned compile issue.
tools/termios_linux.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/termios_linux.h +3 -3
@@ -32,13 +32,13 @@#include <asm/ioctls.h> #include <asm/termbits.h> -#if defined(BOTHER ) && defined(TCGETS2 ) +#if defined(BOTHER ) && defined(TCGETS2 ) && !defined(__powerpc64__)#define termios termios2#endif static inline int tcgetattr (int fd,struct termios *t) { -#if defined(BOTHER ) && defined(TCGETS2 ) +#if defined(BOTHER ) && defined(TCGETS2 ) && !defined(__powerpc64__)return ioctl (fd,TCGETS2 , t);#else return ioctl (fd,TCGETS , t);
@@ -50,7 +50,7 @@ static inline int tcsetattr(int fd, int a, const struct termios *t)int cmd;switch (a) { -#if defined(BOTHER ) && defined(TCGETS2 ) +#if defined(BOTHER ) && defined(TCGETS2 ) && !defined(__powerpc64__)case TCSANOW : cmd =TCSETS2 ;break ;
Signature · 4 lines
2.49.0 base-commit: 903eb123236ccbd8ef05d43507a2a910b785bd56 branch: master
Quoted 13 lines · Javier Martinez Canillas
Commit
93b55636b09f("tools: kwboot: Allow any baudrate on Linux") added atcgetattr()function to be used, instead of the libc's termios functions.This was done to allow using the raw TCGETS2/TCSETS2 ioctls that allow to support arbitrary baud rates.
This breaks the build for PowerPC, because that architecture does not have a struct termios2 defined becuase the termios and ktermios are the same.
On PowerPC, the termios
ioctl()emulates the TCGETS2/TCSETS*2 ioctls with tcgetattr/tcsetattr using just the struct termios (that's as mentioned the same than what is defined as struct termios2 in other architectures).
Quoted 5 lines
So there is no need to use the TCGETS2/TCSETS2 ioctls on that architecture and just TCGETS/TCSETS ioctls with termios as defined by PowerPC is enough.
Fixes 93b55636b09f ("tools: kwboot: Allow any baudrate on Linux")Signed-off-by Javier Martinez Canillas <[email protected]>
Until someone can test this very specific combination of things on a ppc64le host, this is probably reasonable enough.
Signature · 1 line
Tom
Quoted 10 lines · Javier Martinez Canillas
Commit
93b55636b09f("tools: kwboot: Allow any baudrate on Linux") added atcgetattr()function to be used, instead of the libc's termios functions.This was done to allow using the raw TCGETS2/TCSETS2 ioctls that allow to support arbitrary baud rates.
This breaks the build for PowerPC, because that architecture does not have a struct termios2 defined becuase the termios and ktermios are the same.
[...]
Applied to u-boot/master, thanks!
[1/1] tools: termios_linux.h: Fix build error on ppc64
commit: 6df1b1cd4e38575019c8b4f605c07a784c63f40e
Signature · 1 line
Tom