LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dave Martin <Dave.Martin@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Ralf Baechle <ralf@linux-mips.org>,
	James Hogan <jhogan@kernel.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	"David S. Miller" <davem@davemloft.net>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Oleg Nesterov <oleg@redhat.com>,
	linux-arch@vger.kernel.org
Subject: [PATCH REPOST 3/5] MIPS: Use update{,_tsk}_thread_flag()
Date: Fri, 11 May 2018 16:05:02 +0100	[thread overview]
Message-ID: <1526051104-15995-4-git-send-email-Dave.Martin@arm.com> (raw)
In-Reply-To: <1526051104-15995-1-git-send-email-Dave.Martin@arm.com>

This patch uses the new update_thread_flag() helpers to simplify a
couple of if () set; else clear; constructs.

No functional change.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
---
 arch/mips/kernel/elf.c     | 10 ++--------
 arch/mips/kernel/process.c | 15 ++++++---------
 arch/mips/kernel/ptrace.c  |  5 +----
 arch/mips/kernel/syscall.c | 10 ++--------
 4 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/arch/mips/kernel/elf.c b/arch/mips/kernel/elf.c
index 731325a..2351509 100644
--- a/arch/mips/kernel/elf.c
+++ b/arch/mips/kernel/elf.c
@@ -267,14 +267,8 @@ int arch_check_elf(void *_ehdr, bool has_interpreter, void *_interp_ehdr,
 
 static inline void set_thread_fp_mode(int hybrid, int regs32)
 {
-	if (hybrid)
-		set_thread_flag(TIF_HYBRID_FPREGS);
-	else
-		clear_thread_flag(TIF_HYBRID_FPREGS);
-	if (regs32)
-		set_thread_flag(TIF_32BIT_FPREGS);
-	else
-		clear_thread_flag(TIF_32BIT_FPREGS);
+	update_thread_flag(TIF_HYBRID_FPREGS, hybrid);
+	update_thread_flag(TIF_32BIT_FPREGS, regs32);
 }
 
 void mips_set_personality_fp(struct arch_elf_state *state)
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index b9e9bf6..4bdecb6 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -763,18 +763,15 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value)
 	 */
 	for_each_thread(task, t) {
 		/* Update desired FP register width */
-		if (value & PR_FP_MODE_FR) {
-			clear_tsk_thread_flag(t, TIF_32BIT_FPREGS);
-		} else {
-			set_tsk_thread_flag(t, TIF_32BIT_FPREGS);
+		update_tsk_thread_flag(t, TIF_32BIT_REGS,
+				       !(value & PR_FP_MODE_FR));
+
+		if (!(value & PR_FP_MODE_FR))
 			clear_tsk_thread_flag(t, TIF_MSA_CTX_LIVE);
-		}
 
 		/* Update desired FP single layout */
-		if (value & PR_FP_MODE_FRE)
-			set_tsk_thread_flag(t, TIF_HYBRID_FPREGS);
-		else
-			clear_tsk_thread_flag(t, TIF_HYBRID_FPREGS);
+		update_tsk_thread_flag(t, TIF_HYBRID_FPREGS,
+				       value & PR_FP_MODE_FRE);
 	}
 
 	/* Allow threads to use FP again */
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 0b23b1a..b218812 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -279,10 +279,7 @@ int ptrace_set_watch_regs(struct task_struct *child,
 		child->thread.watch.mips3264.watchhi[i] = ht[i];
 	}
 
-	if (watch_active)
-		set_tsk_thread_flag(child, TIF_LOAD_WATCH);
-	else
-		clear_tsk_thread_flag(child, TIF_LOAD_WATCH);
+	update_tsk_thread_flag(child, TIF_LOAD_WATCH, watch_active);
 
 	return 0;
 }
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 69c17b5..e9fa130 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -209,14 +209,8 @@ SYSCALL_DEFINE3(sysmips, long, cmd, long, arg1, long, arg2)
 		if (arg1 & ~3)
 			return -EINVAL;
 
-		if (arg1 & 1)
-			set_thread_flag(TIF_FIXADE);
-		else
-			clear_thread_flag(TIF_FIXADE);
-		if (arg1 & 2)
-			set_thread_flag(TIF_LOGADE);
-		else
-			clear_thread_flag(TIF_LOGADE);
+		update_thread_flag(TIF_FIXADE, arg1 & 1);
+		update_thread_flag(TIF_LOGADE, arg1 & 2);
 
 		return 0;
 
-- 
2.1.4

  parent reply	other threads:[~2018-05-11 15:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11 15:04 [PATCH REPOST 0/5] Simplify setting thread flags to a particular value Dave Martin
2018-05-11 15:05 ` [PATCH REPOST 1/5] thread_info: Port core code to use update_thread_flag() helpers Dave Martin
2018-05-11 15:33   ` Steven Rostedt
2018-05-13 16:12   ` Oleg Nesterov
2018-05-11 15:05 ` [PATCH REPOST 2/5] ARM: Use update_thread_flag() Dave Martin
2018-05-11 15:05 ` Dave Martin [this message]
2018-05-11 15:05 ` [PATCH REPOST 4/5] powerpc: " Dave Martin
2018-05-15  3:13   ` Michael Ellerman
2018-05-11 15:05 ` [PATCH REPOST 5/5] sparc: " Dave Martin
2018-05-11 15:10   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1526051104-15995-4-git-send-email-Dave.Martin@arm.com \
    --to=dave.martin@arm.com \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=jhogan@kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=oleg@redhat.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=ralf@linux-mips.org \
    --cc=rostedt@goodmis.org \
    --subject='Re: [PATCH REPOST 3/5] MIPS: Use update{,_tsk}_thread_flag()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).