From patchwork Thu Apr 19 10:58:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 133748 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp490369ljf; Thu, 19 Apr 2018 03:59:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4924uRk6JBWQi6imydN5Mz9YQUFWT0CN8vFjHcQTlyrkM5KMwCaNN8eUloObtjJ01n+AoUi X-Received: by 10.98.159.129 with SMTP id v1mr5412551pfk.25.1524135551790; Thu, 19 Apr 2018 03:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524135551; cv=none; d=google.com; s=arc-20160816; b=li7mHYdrRit416WcuFpFtwOkLOn2Obe+RXdgnF3RjLLnXQrOR1UTgwsnhZFSDQhhla f9NPu19O9bvJBHyvhJjbSpWbmjSZPXhU29EGFdWV0Lt45ItD44lLkrfPOvDC7FpZ/6CV W30toZYS16R1V+/BgwCUzmZLOciw4GplgE2skJGCMPnA/p1sOGuw5qS/tZidsE58vvyL d+U+JwwECpm7UVPLOq9KqbNOCguHmLeCT+oYmQt1xfHcC0owXQIBfI/FrdDmNjsJczll KQreiET1IAoKvIwRrLz4yXGyz5krGYdZJlCRLBfERu8GmFXtZFqn0mysZi2b4bb2QYpB EGiw== 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=v0+5wjnCeBB9sv/xst1D1yrVT5wfkWr+IzLH7BlBq1uUbaknmtWwYv3G2Ec3qDK/nC TpIKGYxk8KUlBntPw2lCYgdFcN9B48w7u92x2V1L0u/v2akCfzQudEOI/gyZVDqLWf4C oipR/ccHFitMe+7Szd/HIdNivF6R/o8RGrvnrqB2Fp2IuctbKXQPxr4+KaoU/w/qBEfG L/8Lbi5mY4GgTZ2eI+NW0hbg7kXqY3dyckKboZx4EDeM9MtCYdlYjeZJg+JO+DOwqCvV /cJ4QNOLM4MtqWWPGovpw7iakVJ5axdd7vFCdGMYKpvzGSE1OZak4RKvmUAtbQNKK3MM fibg== 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 b39-v6si1543565plb.456.2018.04.19.03.59.11; Thu, 19 Apr 2018 03:59:11 -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 S1752694AbeDSK7J (ORCPT + 29 others); Thu, 19 Apr 2018 06:59:09 -0400 Received: from foss.arm.com ([217.140.101.70]:35902 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751228AbeDSK7F (ORCPT ); Thu, 19 Apr 2018 06:59:05 -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 5377C15BF; Thu, 19 Apr 2018 03:59:05 -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 1F9583F59D; Thu, 19 Apr 2018 03:59:02 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Catalin Marinas , Will Deacon , 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: [RFC PATCH 4/6] MIPS: Use update{,_tsk}_thread_flag() Date: Thu, 19 Apr 2018 11:58:46 +0100 Message-Id: <1524135528-28561-5-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1524135528-28561-1-git-send-email-Dave.Martin@arm.com> References: <1524135528-28561-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;