From patchwork Fri May 11 15:05:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 135544 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp987621lji; Fri, 11 May 2018 08:06:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoD797MsS5D/SpD6NS+d++xK6T0uwQUkOF2qfQB/PlnY2RQU4cagQhAZliFnfWVC0mwWk2F X-Received: by 2002:a17:902:30a3:: with SMTP id v32-v6mr5927783plb.123.1526051167487; Fri, 11 May 2018 08:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526051167; cv=none; d=google.com; s=arc-20160816; b=TNpKofCs7Cf8IRVRvKe+JnDMyxqPLUEyrKxn3cBFKrKtcqBD/BSQUjOLHrcqe+nwjp 3P8Y2dI17/uqLNTlOKan8km8Rd6S4Zuv2EUyfAJnr2N55DmUDvpGsU9vwR5tAA+yk4u+ lDypWWPgV3p8OBi5O/0RN5jTGkXTso6onwgNv30AqZuK8KN4Szh623XzgbIiTbxT19kJ 1r9NYrHSXAQpImd1ECI0gEtEsV17NfT7yQEC6CIQysjN94Pr/KHF+z8orob+sU6CDoGI wqXk7AgDDep7faBV4/FyuGANaS/MtEz6+bPJHtNahJFgKvaUg8+/THgs8K9fx8EU7Hbq 89OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=yln2iUAo4qpz7lzHj0XJ0hAnQiu91h/Q0cTueTt6KRY=; b=kc6uyzB4v69m3J5BhVA5cyZICFVGEgP26YPXoxDN1BzVSjnWvX2A2LsKkDa9xpg6m+ X/KWx3/ed3+a3ey9ynPvA+OK3F1OUXInYJ6+dFKvk6uNGi78bGbAtAvZElOIyO9JuH9X 2GP5EhWqVkWH4nfZhvUOMmRzc3b2hL8GosJzqEslK1pgunrZQS3owkgcm67cLayy2jsZ 4O5+s0VccfhhMJ2bFPiOUXsosyKMD+kB07/YfDDSV7/F2MLCgMEobu5EcAxNKqZzHJbA Ca8huRk09eLo2w3mNxXKfFpCUjIfR6znuudlGMjroDbRK5Fn9YipnEKtmmPPeBZounub UAOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m19-v6si3509995pff.303.2018.05.11.08.06.07; Fri, 11 May 2018 08:06:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753439AbeEKPGD (ORCPT + 29 others); Fri, 11 May 2018 11:06:03 -0400 Received: from foss.arm.com ([217.140.101.70]:43198 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753421AbeEKPF7 (ORCPT ); Fri, 11 May 2018 11:05:59 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5781D168F; Fri, 11 May 2018 08:05:59 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 699E83F23C; Fri, 11 May 2018 08:05:57 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Ralf Baechle , James Hogan , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "David S. Miller" , Ingo Molnar , Peter Zijlstra , Steven Rostedt , Oleg Nesterov , 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 Message-Id: <1526051104-15995-4-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1526051104-15995-1-git-send-email-Dave.Martin@arm.com> References: <1526051104-15995-1-git-send-email-Dave.Martin@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Ralf Baechle Cc: James Hogan --- 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(-) -- 2.1.4 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;