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: 135235 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp5423808lji; Wed, 9 May 2018 02:51:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrdAGfSHeF4d4QynjM5TYRf4oFH3GgKYQkX+K6woH9DAh6PzFF+C4yQsuKri4DTCvtyEX3W X-Received: by 2002:a63:6fc8:: with SMTP id k191-v6mr35434805pgc.330.1525859470334; Wed, 09 May 2018 02:51:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525859470; cv=none; d=google.com; s=arc-20160816; b=Z8eNbii9jiUZPSsm6oC3XoKr21gPkr4++81XZabT/wNhCu0opCGxaOcADPf19Z/fk9 3XPKELyIUjqSzSdkblyi4PIWaD7X2kC9ybQyAoliU+DDXl4EUKb+bA0FJx0ozoL1B1a3 ImHzZSxffMbwxU7EdRFIQUiMJGCZKCUK2h7EPfBIgTP1IsJqvx51pwfAgP7xXH/lipIi eFY6PZTf69Z3kQaavhEer329YzqMZKayEJDbNLB+FtXB8xrxbyGdUgQdHizqoUVwGFYw hrak1BKbT2uiVoPsPELGk5it5MejQJlcAG1TfPACh0XoSm2P4DlYqDuz2P4q/ORLl8mx ztgw== 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=yaTomzog4af21guXGL9xN2AcYRx/fiNNVX3GYZLrlSc=; b=eoWGDeVFgBAS4TZ82clL5SfZJeMM1lucBLOrMt4HvZc5p47m7c1I743LKijOGSUrLS LdvpxzcPLGDSAYSU78q9+OWjwdBevxMwSajY9gTOVvwwNmpghJP+FbETq0+EGgtXWo0t 2LxAGnPLVZlkt8eHcQrY9PmcA8mgyeRP+jxjSU9mq+wLn79r8M5llr3AE4foDABOqAL9 sOA74HcmDYSW4U18+kYetRqL5lEViwEarJpOmnv/Fx9Y/1g7yszkwcn/uAf0q+t+5YYX 9Cb1Xc/NE474H/RlKY5Q1FwZN9yYP05heWG4NdwbJt3WYPPSmznfE+uZq/QU7vSINaFP TJXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Q/DyLgwz; 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 r9si17702899pfg.247.2018.05.09.02.51.10; Wed, 09 May 2018 02:51:10 -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=Q/DyLgwz; 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 S934514AbeEIJu4 (ORCPT + 29 others); Wed, 9 May 2018 05:50:56 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.4 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);