From patchwork Mon May 14 17:14:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 135751 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2052564lji; Mon, 14 May 2018 10:18:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoYH+0SdzuyknhyGl+B8FfVJy1E5LhccqUQkTu01KCt9ShXdYogTPRVO/wP/smLq5I47Lsr X-Received: by 2002:a17:902:1aa:: with SMTP id b39-v6mr10866364plb.120.1526318297761; Mon, 14 May 2018 10:18:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526318297; cv=none; d=google.com; s=arc-20160816; b=VGV+VjGRmJJWplE4Nsb57iPCXeTKDmdQSPrdlQAsaAEbAXTXdKORkaIC1lC7qU9ODN Z8Rtu42NJaRhUDVMl/CGadJepbfvU1bZQa0MWDNt3DMEu4BCIJj7mKG09F3c53sd0mGs mNThF9c/2AOazJrWdXqRRJ8PMI68Ltqzj3+hW9CPRRkkTi7Eg4Va3HL/Y2julT5dfIkU uEJZekaJKtY+eein0gOQTVXxi5+oxeb2Zl0OSBl36Fv8uBaOHX/J8M8xf7wweKf0Vuof EVsjWJScFwy+QGiNe86gjlTNc7CrFsGfqKwFOPd36W9tev1wXLfXULCqI0fuEwXV9666 9JdA== 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=TFXr8k0ZKvqKpvpe1KYTKPuyJbiYtmnUsfU2jgZR8K8=; b=k1Ufzhb4wxqsoh7/GNoFuSkaRRuov7bxZcOtPY5Ep1TrmYg4ERfrzk3CPGDnu5hALe GOzpsYl8zMu9DfIra+Rn9c05UNfu7vWiTvrz3q0NIDty+xnylF/bPNCrJg5GFKbcWp5l 8rz8ICLsZ+6sGVAftUrlRUhkZ+mHp9Da0m2z0izMBa2Ka+NMQY2kLhcz6wF72kSWDONZ ofb84+oT5pDyDQHH/6VfqoN5t0Kb+XioirTn8C42qzSvvodr48fiRYrqTkTIGCDnGRaY 6/vdHrt4cO1auLm4YnwTlBCgKiiPxdiVW4qeqgmgFu3VfNgdizLhwqDcsCp4ZuRvNpS4 pUvg== 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 g130-v6si9690780pfc.366.2018.05.14.10.18.17; Mon, 14 May 2018 10:18:17 -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 S1754472AbeENRSP (ORCPT + 29 others); Mon, 14 May 2018 13:18:15 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:46952 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753995AbeENRP1 (ORCPT ); Mon, 14 May 2018 13:15:27 -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 8DD391688; Mon, 14 May 2018 10:15:27 -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 C70323F59F; Mon, 14 May 2018 10:15:26 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, Ralf Baechle , James Hogan Subject: [RFC PATCH 03/11] MIPS: Remove unused task argument from prctl functions Date: Mon, 14 May 2018 18:14:19 +0100 Message-Id: <1526318067-4964-4-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1526318067-4964-1-git-send-email-Dave.Martin@arm.com> References: <1526318067-4964-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 Some MIPS-specific prctl backends take a task argument that is redundant, since the only thing ever passed is "current". This patch gets rid of the redundant arguments. No functional change. Signed-off-by: Dave Martin Cc: Ralf Baechle Cc: James Hogan --- arch/mips/include/asm/processor.h | 4 ++-- arch/mips/kernel/process.c | 23 +++++++++++------------ arch/mips/kernel/syscall.c | 1 + kernel/sys.c | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) -- 2.1.4 diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h index af34afb..8f06608 100644 --- a/arch/mips/include/asm/processor.h +++ b/arch/mips/include/asm/processor.h @@ -420,7 +420,7 @@ extern int mips_get_process_fp_mode(struct task_struct *task); extern int mips_set_process_fp_mode(struct task_struct *task, unsigned int value); -#define GET_FP_MODE(task) mips_get_process_fp_mode(task) -#define SET_FP_MODE(task,value) mips_set_process_fp_mode(task, value) +#define GET_FP_MODE() mips_get_process_fp_mode() +#define SET_FP_MODE(value) mips_set_process_fp_mode(value) #endif /* _ASM_PROCESSOR_H */ diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index b9e9bf6..7db1989 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -679,13 +679,13 @@ void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self) put_cpu(); } -int mips_get_process_fp_mode(struct task_struct *task) +int mips_get_process_fp_mode(void) { int value = 0; - if (!test_tsk_thread_flag(task, TIF_32BIT_FPREGS)) + if (!test_thread_flag(TIF_32BIT_FPREGS)) value |= PR_FP_MODE_FR; - if (test_tsk_thread_flag(task, TIF_HYBRID_FPREGS)) + if (test_thread_flag(TIF_HYBRID_FPREGS)) value |= PR_FP_MODE_FRE; return value; @@ -699,14 +699,14 @@ static void prepare_for_fp_mode_switch(void *info) lose_fpu(1); } -int mips_set_process_fp_mode(struct task_struct *task, unsigned int value) +int mips_set_process_fp_mode(unsigned int value) { const unsigned int known_bits = PR_FP_MODE_FR | PR_FP_MODE_FRE; struct task_struct *t; int max_users; /* If nothing to change, return right away, successfully. */ - if (value == mips_get_process_fp_mode(task)) + if (value == mips_get_process_fp_mode()) return 0; /* Only accept a mode change if 64-bit FP enabled for o32. */ @@ -736,11 +736,10 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value) preempt_disable(); /* Save FP & vector context, then disable FPU & MSA */ - if (task->signal == current->signal) - lose_fpu(1); + lose_fpu(1); /* Prevent any threads from obtaining live FP context */ - atomic_set(&task->mm->context.fp_mode_switching, 1); + atomic_set(¤t->mm->context.fp_mode_switching, 1); smp_mb__after_atomic(); /* @@ -750,7 +749,7 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value) */ if (num_online_cpus() > 1) { /* No need to send an IPI for the local CPU */ - max_users = (task->mm == current->mm) ? 1 : 0; + max_users = (current->mm == current->mm) ? 1 : 0; if (atomic_read(¤t->mm->mm_users) > max_users) smp_call_function(prepare_for_fp_mode_switch, @@ -761,7 +760,7 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value) * There are now no threads of the process with live FP context, so it * is safe to proceed with the FP mode switch. */ - for_each_thread(task, t) { + for_each_thread(current, t) { /* Update desired FP register width */ if (value & PR_FP_MODE_FR) { clear_tsk_thread_flag(t, TIF_32BIT_FPREGS); @@ -778,10 +777,10 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value) } /* Allow threads to use FP again */ - atomic_set(&task->mm->context.fp_mode_switching, 0); + atomic_set(¤t->mm->context.fp_mode_switching, 0); preempt_enable(); - wake_up_var(&task->mm->context.fp_mode_switching); + wake_up_var(¤t->mm->context.fp_mode_switching); return 0; } diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 69c17b5..15f33f0 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/kernel/sys.c b/kernel/sys.c index f917d78..520d2e8 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -108,10 +108,10 @@ # define MPX_DISABLE_MANAGEMENT() (-EINVAL) #endif #ifndef GET_FP_MODE -# define GET_FP_MODE(a) (-EINVAL) +# define GET_FP_MODE() (-EINVAL) #endif #ifndef SET_FP_MODE -# define SET_FP_MODE(a,b) (-EINVAL) +# define SET_FP_MODE(a) (-EINVAL) #endif /* @@ -2433,10 +2433,10 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, error = MPX_DISABLE_MANAGEMENT(); break; case PR_SET_FP_MODE: - error = SET_FP_MODE(me, arg2); + error = SET_FP_MODE(arg2); break; case PR_GET_FP_MODE: - error = GET_FP_MODE(me); + error = GET_FP_MODE(); break; default: error = prctl_arch(option, arg2, arg3, arg4, arg5);