From patchwork Sun May 24 15:42:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11567485 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB97314C0 for ; Sun, 24 May 2020 15:44:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A04A20787 for ; Sun, 24 May 2020 15:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590335095; bh=y4LDN2cptklG/L3OvtbLFAtwBB06/jbLreEh7H/ewyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NJxRFkcY/it6axlolZXYiN8HnTswoo0axmvbF7TmsLsM2GmAE07523Ur61pHmtYq8 dsHMjRH28QJ1618hXhjc8oAtyIXzcOhEXAYRMToUxXsSBBUDSlhRiiesBCSEziCbbg vysKHZDTPtCcU0EPfKaxh0xZCfZJra4WnSbUbcgA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388037AbgEXPoo (ORCPT ); Sun, 24 May 2020 11:44:44 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:19707 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728479AbgEXPnX (ORCPT ); Sun, 24 May 2020 11:43:23 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-09.nifty.com with ESMTP id 04OFgcVD017561; Mon, 25 May 2020 00:42:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 04OFgcVD017561 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1590334974; bh=MpjBywKi5hvRtpRuPaWkkgxcSAed2a9OTbmkoaxhCOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2vNDjNRqakTzs8Gw8isSeCoAbEkvZM631ReC3jWX+3Fzid2JYZcLbRnBx50rS415 /Une6cVawj2dEv1Gp+/wIZYdo92yDn0tJawcO85V1bCmFOojXr7/jDC0e35NWmhiYd 6MeKgU3i01VR+r+Zr0CMdQ4kSJeHcrYU2xaN5vJleYlOY6W9W5V8aYQL8Z9FpwyzSu hm1FYjmv3T93A/szJT4MRbMv9tnd/HWfw+gNpC3z/pDe59Da08peQmJ7I/bSVP3LEd kxumSLprm1EHR8tKkTQu3OFVbD7cZcozlN7TKdwMtLboKjQ2bBW0QF7dDDJxQaKmft whDlgFGMr3wFg== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 28/29] modpost: remove is_vmlinux() helper Date: Mon, 25 May 2020 00:42:34 +0900 Message-Id: <20200524154235.380482-29-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200524154235.380482-1-masahiroy@kernel.org> References: <20200524154235.380482-1-masahiroy@kernel.org> MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Now that is_vmlinux() is called only in new_module(), we can inline the function call. modname is the basename with '.o' is stripped. No need to compare it with 'vmlinux.o'. vmlinux is always located at the current working directory. No need to strip the directory path. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/mod/modpost.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 2c783adbfc34..527f71b662b0 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -90,20 +90,6 @@ static inline bool strends(const char *str, const char *postfix) return strcmp(str + strlen(str) - strlen(postfix), postfix) == 0; } -static int is_vmlinux(const char *modname) -{ - const char *myname; - - myname = strrchr(modname, '/'); - if (myname) - myname++; - else - myname = modname; - - return (strcmp(myname, "vmlinux") == 0) || - (strcmp(myname, "vmlinux.o") == 0); -} - void *do_nofail(void *ptr, const char *expr) { if (!ptr) @@ -180,7 +166,7 @@ static struct module *new_module(const char *modname) /* add to list */ strcpy(mod->name, modname); - mod->is_vmlinux = is_vmlinux(modname); + mod->is_vmlinux = (strcmp(modname, "vmlinux") == 0); mod->gpl_compatible = -1; mod->next = modules; modules = mod;