From patchwork Wed May 9 09:50:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10388961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0D8C860170 for ; Wed, 9 May 2018 09:51:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1B9A283CF for ; Wed, 9 May 2018 09:51:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E679628EBD; Wed, 9 May 2018 09:51:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 978F8283CF for ; Wed, 9 May 2018 09:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934341AbeEIJuy (ORCPT ); Wed, 9 May 2018 05:50:54 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:53968 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934133AbeEIJuw (ORCPT ); Wed, 9 May 2018 05:50:52 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id w499oiPM018127; Wed, 9 May 2018 18:50:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com w499oiPM018127 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1525859445; bh=yaTomzog4af21guXGL9xN2AcYRx/fiNNVX3GYZLrlSc=; h=From:To:Cc:Subject:Date:From; b=Q/DyLgwzMwWlpVZ+YrR+wb+jnEKQ5P3TkN6jAZG/NGqmzmgFxflg0b+Qs1zS3V4xu UVYYzwTJdBPCO4tLhkxIXrcAlTdWJJlUikOgIWBfBydhS8/q+hN3UJhy7hw5vwBmSO v1PjV8eu5hbmGDFsxFBd7soBUXCQvjW1ol670KjLozjAC+IAcdU5y1k6/ARQsy8Dvw t7lbkEbQEaq5eQAQAWtQdlTlLT9+lSnUi6BOheOyCnmekHKPQIshfzgItWrplNqzwX JPbnAepTbmLGepBdBFpBKKjifCQ5UoAOTNTKc2EfWMg3y8effnMGPNts4QUoSw/855 CLPMSIYYBUrwQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 1/4] modpost: pass struct elf_info pointer to get_modinfo() Date: Wed, 9 May 2018 18:50:37 +0900 Message-Id: <1525859440-29583-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP get_(next_)modinfo takes a pointer and length pair of the .modinfo section. Instead, pass struct elf_info pointer to reduce the number of function arguments. Signed-off-by: Masahiro Yamada --- scripts/mod/modpost.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index bc71925..37a6a0b4 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -724,16 +724,17 @@ static char *next_string(char *string, unsigned long *secsize) return string; } -static char *get_next_modinfo(void *modinfo, unsigned long modinfo_len, - const char *tag, char *info) +static char *get_next_modinfo(struct elf_info *info, const char *tag, + char *prev) { char *p; unsigned int taglen = strlen(tag); - unsigned long size = modinfo_len; + char *modinfo = info->modinfo; + unsigned long size = info->modinfo_len; - if (info) { - size -= info - (char *)modinfo; - modinfo = next_string(info, &size); + if (prev) { + size -= prev - modinfo; + modinfo = next_string(prev, &size); } for (p = modinfo; p; p = next_string(p, &size)) { @@ -743,11 +744,10 @@ static char *get_next_modinfo(void *modinfo, unsigned long modinfo_len, return NULL; } -static char *get_modinfo(void *modinfo, unsigned long modinfo_len, - const char *tag) +static char *get_modinfo(struct elf_info *info, const char *tag) { - return get_next_modinfo(modinfo, modinfo_len, tag, NULL); + return get_next_modinfo(info, tag, NULL); } /** @@ -1951,7 +1951,7 @@ static void read_symbols(char *modname) mod->skip = 1; } - license = get_modinfo(info.modinfo, info.modinfo_len, "license"); + license = get_modinfo(&info, "license"); if (!license && !is_vmlinux(modname)) warn("modpost: missing MODULE_LICENSE() in %s\n" "see include/linux/module.h for " @@ -1963,8 +1963,7 @@ static void read_symbols(char *modname) mod->gpl_compatible = 0; break; } - license = get_next_modinfo(info.modinfo, info.modinfo_len, - "license", license); + license = get_next_modinfo(&info, "license", license); } for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { @@ -1977,7 +1976,7 @@ static void read_symbols(char *modname) (is_vmlinux(modname) && vmlinux_section_warnings)) check_sec_ref(mod, modname, &info); - version = get_modinfo(info.modinfo, info.modinfo_len, "version"); + version = get_modinfo(&info, "version"); if (version) maybe_frob_rcs_version(modname, version, info.modinfo, version - (char *)info.hdr);