From patchwork Wed Nov 1 15:03:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13442860 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F669C41535 for ; Wed, 1 Nov 2023 15:04:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229518AbjKAPE5 (ORCPT ); Wed, 1 Nov 2023 11:04:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232437AbjKAPE4 (ORCPT ); Wed, 1 Nov 2023 11:04:56 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B390FD; Wed, 1 Nov 2023 08:04:54 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 776A1C433CD; Wed, 1 Nov 2023 15:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698851093; bh=T11bWBI9YO8ZTft74BUB8/taHx/JC1055+wmzAKgdGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jSetNX/jH2BNa0lWJSuJnaYZBfiymurs+qWOk5lWteXDlTxsv38TqRr+T7Fb4K/7x MP4yPOU4yr9/mhixWyj0vhxBUi1ly9S/fpTPhJM0M3TmOAQR/W/lXDSer/o0nxbPC1 gbpd2tTQO791y7tiAngRVYUXvjQ5+kZcIcR4WnPGmprrJLZzX5ZpMjBOK6F134AaSN xxzgMZAhCoGaOebkddesidDXGiBo1gpQV8hINS6z+AqkMixcI3rQJ71niMms18Li1C soVRSRB8ZRz/p+423aUyHILsRaool04Y7ASoDPgEx2sjiECdagGo5sDz2xgUXx0SWX uECLz7tTfdbdQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Greg Ungerer , Jack Brennen , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 1/7] modpost: move sym_name() to modpost.h Date: Thu, 2 Nov 2023 00:03:58 +0900 Message-Id: <20231101150404.754108-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231101150404.754108-1-masahiroy@kernel.org> References: <20231101150404.754108-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Move sym_name() to modpost.h so it can be used in other source files. Also, add the 'const' qualifier to the function arguments. Signed-off-by: Masahiro Yamada --- scripts/mod/modpost.c | 8 -------- scripts/mod/modpost.h | 9 +++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 973b5e5ae2dd..896ecfa8483f 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -710,14 +710,6 @@ static char *get_modinfo(struct elf_info *info, const char *tag) return get_next_modinfo(info, tag, NULL); } -static const char *sym_name(struct elf_info *elf, Elf_Sym *sym) -{ - if (sym) - return elf->strtab + sym->st_name; - else - return "(unknown)"; -} - /* * Check whether the 'string' argument matches one of the 'patterns', * an array of shell wildcard patterns (glob). diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 1392afec118c..9834ac44846d 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -156,6 +156,15 @@ static inline unsigned int get_secindex(const struct elf_info *info, return index; } +static inline const char *sym_name(const struct elf_info *elf, + const Elf_Sym *sym) +{ + if (sym) + return elf->strtab + sym->st_name; + else + return "(unknown)"; +} + /* * If there's no name there, ignore it; likewise, ignore it if it's * one of the magic symbols emitted used by current tools.