Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1762454imm; Sat, 6 Oct 2018 09:51:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV613mg1RN+qliRa7b0ewbOwOjBP1qNVN7sIpPTzbkrvV1CsQwTuveFTK2wePmQDJObAt+MPU X-Received: by 2002:a62:8708:: with SMTP id i8-v6mr17301909pfe.150.1538844700569; Sat, 06 Oct 2018 09:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538844700; cv=none; d=google.com; s=arc-20160816; b=oyuq3RhHPoSq+lShdKSlPfGIe3iPj+EZk19rGhbPVs6RRIduekU/p5uvKapo+j7hqf 2ykQ8dhJXJuEIlog/cbx/B85I4cj4ldLtqRlxzSoh+apv7Yjiyh4EWhhqmJrDY3pn6oq fFMrp8ZEymFDDPqsiYu22cJRwOhOFwV9sTdGM6oSlrRyUnX+Xqu8o85TsNyVaKIP2JJs RfcLaxMVoxp82LufL2OKjkUCg2KSk6aRqna+eq14RMxD4QvY9Wgku+MnyXcjtrtuPCdq ukEbx8ZGvbQG3SIG/pLtOi/arHQzQCIDfEHDNRUDBZvaMpM7FqLTUHlEaeeiatYsJks9 ThSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id; bh=vw7LM64gvbCxmHqXB5R6LL8Ae9E+SVzGRU0V4SIdSj0=; b=L2ojuNoyK+8CRKqlvetuzwwMBzjZGmt2UuWCuTqmWL6M5dwHKFnpxiLlOlbIobum/K 5DK9YkbPleWOuaALIga+lfhrx6Fv7/CgQptjmWaAOFgts+4MP2yv+TI5Wl1sO8GipgLA XjqXMaRmBjH0QsT7YWdXCfpr4bZ7SjeXOXr3eWOzbX4yrOhBIwj0sN7ZWa7lhLJMrSs4 joENNpg32CnRfT8/3UlkCDDaV1H9daV7vb+eSUp5GHmVtVWILsiF0l5tw/52r9LKg3bp Fd88Os5ZZo7mZn+Jq4zNdAtBaftqr0KVjNTs2n3A93Db5Xq/31TfyKzNvNQFXRvyV+p0 lMbg== 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 x1-v6si13425409pfx.105.2018.10.06.09.51.25; Sat, 06 Oct 2018 09:51:40 -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 S1727988AbeJFXzV (ORCPT + 99 others); Sat, 6 Oct 2018 19:55:21 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:40803 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727762AbeJFXzV (ORCPT ); Sat, 6 Oct 2018 19:55:21 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 42SCLk4F8lz9ttCF; Sat, 6 Oct 2018 18:51:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id Ly3DZzwfEgm0; Sat, 6 Oct 2018 18:51:10 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 42SCLk3bkpz9ttC7; Sat, 6 Oct 2018 18:51:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0FBBD8B793; Sat, 6 Oct 2018 18:51:17 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id IXV1vd-Gw-1U; Sat, 6 Oct 2018 18:51:17 +0200 (CEST) Received: from pc16082vm.idsi0.si.c-s.fr (unknown [192.168.232.3]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 805C28B74B; Sat, 6 Oct 2018 18:51:16 +0200 (CEST) Received: by pc16082vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 5B7C46F2BA; Sat, 6 Oct 2018 16:51:16 +0000 (UTC) Message-Id: <31d84480ca37b6b2bc76d5a0307163a55b03ced8.1538789120.git.christophe.leroy@c-s.fr> In-Reply-To: <981244f0ffb38c1aa02c9eb831c7ebf479b8f564.1538789120.git.christophe.leroy@c-s.fr> References: <981244f0ffb38c1aa02c9eb831c7ebf479b8f564.1538789120.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH v4 3/3] powerpc/process: Constify the number of insns printed by show instructions functions. To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , muriloo@linux.ibm.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Sat, 6 Oct 2018 16:51:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org instructions_to_print var is assigned value 16 and there is no way to change it. This patch replaces it by a constant. Reviewed-by: Murilo Opsfelder Araujo Signed-off-by: Christophe Leroy --- v4: rebased v3: no change v2: no change arch/powerpc/kernel/process.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 8dabf656d924..dd8447d3f0bf 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1258,17 +1258,16 @@ struct task_struct *__switch_to(struct task_struct *prev, return last; } -static int instructions_to_print = 16; +#define NR_INSN_TO_PRINT 16 static void show_instructions(struct pt_regs *regs) { int i; - unsigned long pc = regs->nip - (instructions_to_print * 3 / 4 * - sizeof(int)); + unsigned long pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int)); printk("Instruction dump:"); - for (i = 0; i < instructions_to_print; i++) { + for (i = 0; i < NR_INSN_TO_PRINT; i++) { int instr; if (!(i % 8)) @@ -1301,17 +1300,17 @@ static void show_instructions(struct pt_regs *regs) void show_user_instructions(struct pt_regs *regs) { unsigned long pc; - int n = instructions_to_print; + int n = NR_INSN_TO_PRINT; struct seq_buf s; char buf[96]; /* enough for 8 times 9 + 2 chars */ - pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int)); + pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int)); /* * Make sure the NIP points at userspace, not kernel text/data or * elsewhere. */ - if (!__access_ok(pc, instructions_to_print * sizeof(int), USER_DS)) { + if (!__access_ok(pc, NR_INSN_TO_PRINT * sizeof(int), USER_DS)) { pr_info("%s[%d]: Bad NIP, not dumping instructions.\n", current->comm, current->pid); return; -- 2.13.3