diff mbox series

endian_switch01.c: drop unused main4()

Message ID fb88846b13f4b0c39c6e3f44b67454f5c3857f6d.1678432077.git.jstancek@redhat.com
State Accepted, archived
Headers show
Series endian_switch01.c: drop unused main4() | expand

Commit Message

Jan Stancek March 10, 2023, 7:10 a.m. UTC
Drop the unused main4() and move AT_HWCAP check to check_le_switch_supported().
Tested on RHEL7.9 3.10 based kernel, and RHEL9.0 5.14.0 based kernel.

Acked-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 .../kernel/syscalls/switch/endian_switch01.c    | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

Comments

Petr Vorel March 10, 2023, 7:30 a.m. UTC | #1
Hi Jan,

> Drop the unused main4() and move AT_HWCAP check to check_le_switch_supported().
> Tested on RHEL7.9 3.10 based kernel, and RHEL9.0 5.14.0 based kernel.

+1

I also tried to test it but currently have only VM, which is obviously without
endian switch:

endian_switch01.c:57: TCONF: fast endian switch (0x1ebe) N/A

Kind regards,
Petr
Cyril Hrubis March 13, 2023, 2:28 p.m. UTC | #2
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Jan Stancek March 13, 2023, 5:17 p.m. UTC | #3
Pushed.

On Mon, Mar 13, 2023 at 3:27 PM Cyril Hrubis <chrubis@suse.cz> wrote:
>
> Hi!
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/switch/endian_switch01.c b/testcases/kernel/syscalls/switch/endian_switch01.c
index eae193fc15f2..d965aed56dfd 100644
--- a/testcases/kernel/syscalls/switch/endian_switch01.c
+++ b/testcases/kernel/syscalls/switch/endian_switch01.c
@@ -15,6 +15,7 @@ 
 #include <stdlib.h>
 #include <unistd.h>
 #include <elf.h>
+#include <sys/auxv.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include "tst_test.h"
@@ -40,6 +41,9 @@  void check_le_switch_supported(void)
 		exit(errno);
 	}
 
+	if (!(getauxval(AT_HWCAP) & PPC_FEATURE_TRUE_LE))
+		tst_brk(TCONF, "Processor does not support little-endian mode");
+
 	SAFE_WAIT(&status);
 	if (WIFSIGNALED(status)) {
 		int sig = WTERMSIG(status);
@@ -94,19 +98,6 @@  static struct tst_test test = {
 	.forks_child = 1,
 };
 
-int main4(int argc, char **argv, LTP_ATTRIBUTE_UNUSED char **envp,
-	unsigned long *auxv)
-{
-	for (; *auxv != AT_NULL && *auxv != AT_HWCAP; auxv += 2)
-		;
-
-	if (!(auxv[0] == AT_HWCAP && (auxv[1] & PPC_FEATURE_TRUE_LE)))
-		tst_brk(TCONF, "Processor does not support little-endian mode");
-
-	tst_run_tcases(argc, argv, &test);
-	return 0;
-}
-
 #else /* defined (__powerpc64__) || (__powerpc__) */
 TST_TEST_TCONF("This system does not support running of switch() syscall");
 #endif