From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932268AbcHQT2B (ORCPT ); Wed, 17 Aug 2016 15:28:01 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33034 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932205AbcHQT16 (ORCPT ); Wed, 17 Aug 2016 15:27:58 -0400 From: Cristina Moraru To: linux-kernel@vger.kernel.org Cc: mcgrof@kernel.org, teg@jklm.no, kay@vrfy.org, rusty@rustcorp.com.au, akpm@linux-foundation.org, Cristina Moraru Subject: [RFC PATCH 4/5] Set KCONFIG_KSYMB as value for kconfig_ksymb module attribute Date: Wed, 17 Aug 2016 21:27:02 +0200 Message-Id: <1471462023-119645-5-git-send-email-cristina.moraru09@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471462023-119645-1-git-send-email-cristina.moraru09@gmail.com> References: <1471462023-119645-1-git-send-email-cristina.moraru09@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update modpost to add in *.mod.c files generated for each module the setting of module attribute kernel_ksymb to value given by KBUILD_KSYMB macro. This patch is part of a research project within Google Summer of Code of porting 'make localmodconfig' for backported drivers. The goal is to enable each module to expose in /sys its corresponding CONFIG_* option. The value of this attribute will be dynamically pegged by modpost without requiring extra work from the driver developers. Further, this information will be used by a hardware interogation tool to extract build information about the existing devices. Signed-off-by: Cristina Moraru --- scripts/mod/modpost.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 48958d3..a105916 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2245,6 +2245,12 @@ static void add_srcversion(struct buffer *b, struct module *mod) } } +static void add_kconfig_symbol(struct buffer *b, struct module *mod) +{ + buf_printf(b, "\n"); + buf_printf(b, "MODULE_INFO(kconfig_symbol, KBUILD_KSYMB);\n"); +} + static void write_if_changed(struct buffer *b, const char *fname) { char *tmp; @@ -2478,6 +2484,7 @@ int main(int argc, char **argv) add_depends(&buf, mod, modules); add_moddevtable(&buf, mod); add_srcversion(&buf, mod); + add_kconfig_symbol(&buf, mod); sprintf(fname, "%s.mod.c", mod->name); write_if_changed(&buf, fname); -- 2.7.4