From patchwork Thu Sep 14 11:40:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 112547 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp641201qgf; Thu, 14 Sep 2017 04:42:21 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5wiMU2CeryD1y+25mlR23POgKLB0dIUP0ydzd7inHUZgzBAu4EbQxo94Kf03VzZfROLFSy X-Received: by 10.99.142.196 with SMTP id k187mr21311624pge.14.1505389341269; Thu, 14 Sep 2017 04:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505389341; cv=none; d=google.com; s=arc-20160816; b=tQUqI08VqGKgulDAe40BwyzCkgBAHUnof+vrxQC9dp3pNlTr769bia0NgimiCYg3I0 90r/eK5mgURMZSki/HRCV21ztb6IlRnOM5vqQiROCp43Ub/4+HqDn0PQAajHQbBxFPJw wVDs0O97V3MQ8U4wd/chnnRoNJutDyJ0iY1/iyXFUAHCHTlkhg0utCe3kzrAzP0fAdT5 evsOLuyiFczyPvaXHtCZIF/w2hgtKcMfZwEK+R7yblZsRkWJm1RvgQqa0BNd3nSiYzVk BgMjCt2q+xf1gwptA9IlvJwvjzxit+tZvyEFPsALnlN7MN5HLgkqweZbikbtFYl/0dhv 9I3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=8p6CErog2VDYcdzg5AWkjISENBK47U3vBKPMsJFtVaw=; b=WseEolpW2zjSBzEAV8JMENfu0u7Fm+WKOR8ApPhC1WNpEh6uitKyuyQGpqwA1RwxeC U5wVB93mClZLtlEq2fem8a0+ffB6x/pWHkhXLWVbqinyqPgX0bI2LmVTNKtRi95vW0MF sX1FdGRbsbR9U9IA9xP0Cyo/7ykKcSrlMr4nYqStkn9uTpKX7AXxIUSbsxVjM0xWu+pZ XzlXUK0LhImI+vjwJmQfFze1D4R3fi2rTzdjpF4OsG2X5dUFoD5Dv0WXzLSBWxyNmw5E eAd6K3FwZcyZgZzhyAwD8qNmg3bnH1FfadkeLw+e3AacBcgyDAV/qUrrpy4fhxcl/yEG baIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=gMRG+f+9; 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 x73si11171164pfk.240.2017.09.14.04.42.20; Thu, 14 Sep 2017 04:42:21 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=gMRG+f+9; 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 S1752028AbdINLmQ (ORCPT + 26 others); Thu, 14 Sep 2017 07:42:16 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:47933 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751792AbdINLmP (ORCPT ); Thu, 14 Sep 2017 07:42:15 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id v8EBeX4m004121; Thu, 14 Sep 2017 20:40:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com v8EBeX4m004121 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1505389235; bh=8p6CErog2VDYcdzg5AWkjISENBK47U3vBKPMsJFtVaw=; h=From:To:Cc:Subject:Date:From; b=gMRG+f+9woehcbP1Ve+XCHaBw2Fn5qCWQWCO9vbs4UoDqy9VpRZBhK6Mqqag7i0Gi YxkRgxbGxJzt8bwkNUAwggvNtwQ2onXTLrs5/oC4NESNaP1tO63cywKMlMHKZrw+dD 0gPCKs3qDuryIMLStN4eQunCNXNAo8GE3Q6MIp4RWDM8GUBf4ZytyeXezHg22QaDiE esOOsHSQGpdmPREdI6RtVPsF7ikIH1tEd5q7GTwpk7CX6DrltnclO4NGFSGVdT54gS pBQuqvkU+4/zg3LSNZJx5cee9RbFaxlWEIFO8IyLBhaWKrsXS4jZd4Zr5CHpfs0K83 YZlgOJjpvLcHw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-arm-kernel@lists.infradead.org, Will Deacon , Catalin Marinas Cc: Michal Marek , Masahiro Yamada , Alexander Popov , James Morse , linux-kernel@vger.kernel.org, AKASHI Takahiro , Laura Abbott , Ingo Molnar , Ard Biesheuvel , Geert Uytterhoeven , Mark Rutland Subject: [PATCH] arm64: remove unneeded copy to init_utsname()->machine Date: Thu, 14 Sep 2017 20:40:04 +0900 Message-Id: <1505389204-17231-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As you see in init/version.c, init_uts_ns.name.machine is initially set to UTS_MACHINE. There is no point to copy the same string. I dug the git history to figure out why this line is here. My best guess is like this: - This line has been around here since the initial support of arm64 by commit 9703d9d7f77c ("arm64: Kernel booting and initialisation"). If ARCH (=arm64) and UTS_MACHINE (=aarch64) do not match, arch/$(ARCH)/Makefile is supposed to override UTS_MACHINE, but the initial version of arch/arm64/Makefile missed to do that. Instead, the boot code copied "aarch64" to init_utsname()->machine. - Commit 94ed1f2cb5d4 ("arm64: setup: report ELF_PLATFORM as the machine for utsname") replaced "aarch64" with ELF_PLATFORM to make "uname" to reflect the endianness. - ELF_PLATFORM does not help to provide the UTS machine name to rpm target, so commit cfa88c79462d ("arm64: Set UTS_MACHINE in the Makefile") fixed it. The commit simply replaced ELF_PLATFORM with UTS_MACHINE, but missed the fact the string copy itself is no longer needed. Signed-off-by: Masahiro Yamada --- arch/arm64/kernel/Makefile | 2 -- arch/arm64/kernel/setup.c | 2 -- 2 files changed, 4 deletions(-) -- 2.7.4 diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index f2b4e81..29764d7 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -10,8 +10,6 @@ CFLAGS_REMOVE_ftrace.o = -pg CFLAGS_REMOVE_insn.o = -pg CFLAGS_REMOVE_return_address.o = -pg -CFLAGS_setup.o = -DUTS_MACHINE='"$(UTS_MACHINE)"' - # Object file lists. arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ entry-fpsimd.o process.o ptrace.o setup.o signal.o \ diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index d4b7405..b2fdb59 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -246,7 +245,6 @@ void __init setup_arch(char **cmdline_p) { pr_info("Boot CPU: AArch64 Processor [%08x]\n", read_cpuid_id()); - sprintf(init_utsname()->machine, UTS_MACHINE); init_mm.start_code = (unsigned long) _text; init_mm.end_code = (unsigned long) _etext; init_mm.end_data = (unsigned long) _edata;