Message ID | 20221216221703.294683-2-allenwebb@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp1227509wrn; Fri, 16 Dec 2022 14:21:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXv/hEHKmB5ApGAKBxPWRRpaU4Iv2Img1HIBbBJCgP7Ff2gUcRSbGHlbA281L5AlPPuGPqNW X-Received: by 2002:a05:6402:cb1:b0:472:cf46:e4de with SMTP id cn17-20020a0564020cb100b00472cf46e4demr10056297edb.23.1671229277036; Fri, 16 Dec 2022 14:21:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671229277; cv=none; d=google.com; s=arc-20160816; b=R37ua5Y645tt3sFFbYKWW99iu7+fqZCvnN4XJsFTOnwVE+PCV+jj8iuV7H5abyyciP X/H4rk90dh4ho1EQLvtwnI6wkn5gWMyAzT97aoxj/XTj2Kw89/693HCwBnnXB/k2x+CF 8wYU6tP00qp4OvSeEyQVJVGyw0X7eKpWRBmL/GPLgTBhaDOJJla4QmYxT/aUSnGQeZLb 0+BhjV5SQJBsdKw/Uw+U5Fndwa20JOBSyximsH9ZH8/oEC/I1WfkJz6/xp8yaOT8SiZI 7tahCCWLyZIBAVqvJfsWIWKhdtALDMNFwk1yeAmygIARfga2jr071YQ5urtcbow/Cxxi WrWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=QIkoHfPVoGJGQCXWyZmF+mudK9y7JC4uGfB+VF9vmAA=; b=Fqy3cwYdmOKrNsRn2sIqUIf6iKqa5N0ECALQVVnCiuyTq9BrTqF3qslPuVMWoQ4/9x vbODj1XLuP+Kfa+A25k8MYGQocO+D+2RvL+Ifdsq3ICJnWK4uhQMBiKtIEwLSwbASgzv IusUz+dBr0DQ1CnZbIgxOMtaxFVE0qBpr70GFWEN5F3vXH51qtP4qNOJCUJ1L0w1hMR5 NIn+X6EPKVrucuDJiC6mr12ED3MmlyXRvTptko157Vro7nHS2OndEvQQHOwSPebLw2lF nLY1m/NUeUo0YFiSR16IZYQZo2W9VQw63q5p9fpfMqIK0x94j4IQhdl31qv01091sVIL 4RkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=DPM862br; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a05640227cc00b00459b51c2b25si4065863ede.438.2022.12.16.14.20.53; Fri, 16 Dec 2022 14:21:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=DPM862br; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229965AbiLPWR0 (ORCPT <rfc822;jeantsuru.cumc.mandola@gmail.com> + 99 others); Fri, 16 Dec 2022 17:17:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbiLPWRX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 16 Dec 2022 17:17:23 -0500 Received: from mail-io1-xd4a.google.com (mail-io1-xd4a.google.com [IPv6:2607:f8b0:4864:20::d4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF1DE2A252 for <linux-kernel@vger.kernel.org>; Fri, 16 Dec 2022 14:17:20 -0800 (PST) Received: by mail-io1-xd4a.google.com with SMTP id r25-20020a6bfc19000000b006e002cb217fso2026380ioh.2 for <linux-kernel@vger.kernel.org>; Fri, 16 Dec 2022 14:17:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=QIkoHfPVoGJGQCXWyZmF+mudK9y7JC4uGfB+VF9vmAA=; b=DPM862br1ksx4WgfZPPdueiIQnI6WvqPmGTG1MgLblwtuOlS7D2+IHQhAHJWXU9iNG j4RxkkFEM0HoFL3kqNsdC+IJMWBTwI8W6+Ta5PvZplSXceS8nTDmbx2x+33J5oD92OFT g77b5zdEyCeTgxNQQFcZA/XalLB+/1uF5YTqvBjiIxsFzKG/Km8FlFj84+FnuoT0LMow HT2aw6HDm83sOt0XTM+xnEBPzPFUkRx+tiHqOWVrRF/4zSEfTDSIW0wZe/YA3+3tJQA8 F7V6Z8l7ZANhHSadRJglbkKVcT0i88Xi5gRe00KnPx6R6+C1xOoBUsZ+idFieWINkCzf aXbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QIkoHfPVoGJGQCXWyZmF+mudK9y7JC4uGfB+VF9vmAA=; b=swHBLyhoTTIPjGvzs6ZWTGUg4jQsdLEJ8yHU6S5ToXoArDdBDnCuOll6qfPDAfuNlF XZeZ5o8CYkHCzhDfKSo3zLj0iHSWZNUR+C9iHqj8riUMNJ2XjwaQkdmImnoLm2BR0EFQ aVFlAKpJaJqA9JFzvgm1gJyxDXmkeb01iisLIP/fuoi8D7G0qLUaOJ0dYpn7z7ZpAU5n WcGJDXPb64Omz9FaTOj2SKmO4cydWpY+U2ZbJ6SZCJJrz8nxfW/JCEY9+RWPfkVDZXbk cLxR7pDoGEURhbfCQXeIC1KqNuR19tiSBzg7Asi3ddfOpWSg6fTJ+nc8LQJCefEl1M8+ zjcg== X-Gm-Message-State: ANoB5pl1m5hBtTciKG/Syt5ltmKFAgYIzQ7Yl5mU3LlD39wIpCrvoyvp b3ptlqUmOyqtuJteXUZDlWhfqJSYCtaNUSs= X-Received: from allenwebb.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:12e8]) (user=allenwebb job=sendgmr) by 2002:a5d:9e4a:0:b0:6de:42ff:d96b with SMTP id i10-20020a5d9e4a000000b006de42ffd96bmr34882896ioi.58.1671229040270; Fri, 16 Dec 2022 14:17:20 -0800 (PST) Date: Fri, 16 Dec 2022 16:16:59 -0600 In-Reply-To: <20221216221703.294683-1-allenwebb@google.com> Mime-Version: 1.0 References: <Y5IA2NYE5IaAzNby@kroah.com> <20221216221703.294683-1-allenwebb@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20221216221703.294683-2-allenwebb@google.com> Subject: [PATCH v7 1/5] module.h: MODULE_DEVICE_TABLE for built-in modules From: Allen Webb <allenwebb@google.com> To: "linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>, "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> Cc: Luis Chamberlain <mcgrof@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Allen Webb <allenwebb@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752410910230946689?= X-GMAIL-MSGID: =?utf-8?q?1752410910230946689?= |
Series |
Generate modules.builtin.alias from match ids
|
|
Commit Message
Allen Webb
Dec. 16, 2022, 10:16 p.m. UTC
Implement MODULE_DEVICE_TABLE for build-in modules to make it possible
to generate a builtin.alias file to complement modules.alias.
Signed-off-by: Allen Webb <allenwebb@google.com>
---
include/linux/module.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
Comments
Hi Allen,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on masahiroy-kbuild/fixes]
[also build test ERROR on mcgrof/modules-next westeri-thunderbolt/next linus/master v6.1 next-20221216]
[cannot apply to masahiroy-kbuild/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Allen-Webb/module-h-MODULE_DEVICE_TABLE-for-built-in-modules/20221217-071949
base: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git fixes
patch link: https://lore.kernel.org/r/20221216221703.294683-2-allenwebb%40google.com
patch subject: [PATCH v7 1/5] module.h: MODULE_DEVICE_TABLE for built-in modules
config: arm-randconfig-r024-20221216
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 98b13979fb05f3ed288a900deb843e7b27589e58)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/intel-lab-lkp/linux/commit/403b6f73d008681a1db43482df4038dd670f1bd4
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Allen-Webb/module-h-MODULE_DEVICE_TABLE-for-built-in-modules/20221217-071949
git checkout 403b6f73d008681a1db43482df4038dd670f1bd4
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/soc/imx/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/soc/imx/imx8mp-blk-ctrl.c:746:1: error: alias must point to a defined variable or function
MODULE_DEVICE_TABLE(of, imx8m_blk_ctrl_of_match);
^
include/linux/module.h:254:26: note: expanded from macro 'MODULE_DEVICE_TABLE'
__attribute__ ((unused, alias(__stringify(name))))
^
1 error generated.
vim +746 drivers/soc/imx/imx8mp-blk-ctrl.c
556f5cf9568af7 Lucas Stach 2022-04-06 734
556f5cf9568af7 Lucas Stach 2022-04-06 735 static const struct of_device_id imx8mp_blk_ctrl_of_match[] = {
556f5cf9568af7 Lucas Stach 2022-04-06 736 {
556f5cf9568af7 Lucas Stach 2022-04-06 737 .compatible = "fsl,imx8mp-hsio-blk-ctrl",
556f5cf9568af7 Lucas Stach 2022-04-06 738 .data = &imx8mp_hsio_blk_ctl_dev_data,
e3442022f54301 Lucas Stach 2022-04-06 739 }, {
e3442022f54301 Lucas Stach 2022-04-06 740 .compatible = "fsl,imx8mp-hdmi-blk-ctrl",
e3442022f54301 Lucas Stach 2022-04-06 741 .data = &imx8mp_hdmi_blk_ctl_dev_data,
556f5cf9568af7 Lucas Stach 2022-04-06 742 }, {
556f5cf9568af7 Lucas Stach 2022-04-06 743 /* Sentinel */
556f5cf9568af7 Lucas Stach 2022-04-06 744 }
556f5cf9568af7 Lucas Stach 2022-04-06 745 };
556f5cf9568af7 Lucas Stach 2022-04-06 @746 MODULE_DEVICE_TABLE(of, imx8m_blk_ctrl_of_match);
556f5cf9568af7 Lucas Stach 2022-04-06 747
Hi Allen, Thank you for the patch! Yet something to improve: [auto build test ERROR on masahiroy-kbuild/fixes] [also build test ERROR on mcgrof/modules-next westeri-thunderbolt/next linus/master v6.1 next-20221216] [cannot apply to masahiroy-kbuild/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Allen-Webb/module-h-MODULE_DEVICE_TABLE-for-built-in-modules/20221217-071949 base: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git fixes patch link: https://lore.kernel.org/r/20221216221703.294683-2-allenwebb%40google.com patch subject: [PATCH v7 1/5] module.h: MODULE_DEVICE_TABLE for built-in modules config: sh-allmodconfig compiler: sh4-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/403b6f73d008681a1db43482df4038dd670f1bd4 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Allen-Webb/module-h-MODULE_DEVICE_TABLE-for-built-in-modules/20221217-071949 git checkout 403b6f73d008681a1db43482df4038dd670f1bd4 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh SHELL=/bin/bash drivers/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from include/linux/cpumask.h:10, from include/linux/smp.h:13, from include/linux/lockdep.h:14, from include/linux/rcupdate.h:29, from include/linux/rculist.h:11, from include/linux/pid.h:5, from include/linux/sched.h:14, from include/linux/ratelimit.h:6, from include/linux/dev_printk.h:16, from include/linux/device.h:15, from include/linux/spi/spi.h:10, from drivers/mfd/stmpe-spi.c:10: >> include/linux/module.h:251:21: error: '__mod_spi__stmpe_id__kmod_stmpe_spi_device_table' aliased to undefined symbol 'stmpe_id' 251 | CONCATENATE(__mod_##type##__##name##__, \ | ^~~~~~ include/linux/kernel.h:491:24: note: in definition of macro '__CONCAT' 491 | #define __CONCAT(a, b) a ## b | ^ include/linux/module.h:250:14: note: in expansion of macro 'CONCATENATE' 250 | extern void *CONCATENATE( \ | ^~~~~~~~~~~ include/linux/kernel.h:492:27: note: in expansion of macro '__CONCAT' 492 | #define CONCATENATE(a, b) __CONCAT(a, b) | ^~~~~~~~ include/linux/module.h:251:9: note: in expansion of macro 'CONCATENATE' 251 | CONCATENATE(__mod_##type##__##name##__, \ | ^~~~~~~~~~~ drivers/mfd/stmpe-spi.c:132:1: note: in expansion of macro 'MODULE_DEVICE_TABLE' 132 | MODULE_DEVICE_TABLE(spi, stmpe_id); | ^~~~~~~~~~~~~~~~~~~ -- In file included from include/linux/clk.h:13, from drivers/mailbox/rockchip-mailbox.c:6: >> include/linux/module.h:251:21: error: '__mod_of__rockchp_mbox_of_match__kmod_rockchip_mailbox_device_table' aliased to undefined symbol 'rockchp_mbox_of_match' 251 | CONCATENATE(__mod_##type##__##name##__, \ | ^~~~~~ include/linux/kernel.h:491:24: note: in definition of macro '__CONCAT' 491 | #define __CONCAT(a, b) a ## b | ^ include/linux/module.h:250:14: note: in expansion of macro 'CONCATENATE' 250 | extern void *CONCATENATE( \ | ^~~~~~~~~~~ include/linux/kernel.h:492:27: note: in expansion of macro '__CONCAT' 492 | #define CONCATENATE(a, b) __CONCAT(a, b) | ^~~~~~~~ include/linux/module.h:251:9: note: in expansion of macro 'CONCATENATE' 251 | CONCATENATE(__mod_##type##__##name##__, \ | ^~~~~~~~~~~ drivers/mailbox/rockchip-mailbox.c:162:1: note: in expansion of macro 'MODULE_DEVICE_TABLE' 162 | MODULE_DEVICE_TABLE(of, rockchp_mbox_of_match); | ^~~~~~~~~~~~~~~~~~~ -- In file included from include/linux/clk.h:13, from drivers/soc/imx/imx8mp-blk-ctrl.c:7: >> include/linux/module.h:251:21: error: '__mod_of__imx8m_blk_ctrl_of_match__kmod_imx8mp_blk_ctrl_device_table' aliased to undefined symbol 'imx8m_blk_ctrl_of_match' 251 | CONCATENATE(__mod_##type##__##name##__, \ | ^~~~~~ include/linux/kernel.h:491:24: note: in definition of macro '__CONCAT' 491 | #define __CONCAT(a, b) a ## b | ^ include/linux/module.h:250:14: note: in expansion of macro 'CONCATENATE' 250 | extern void *CONCATENATE( \ | ^~~~~~~~~~~ include/linux/kernel.h:492:27: note: in expansion of macro '__CONCAT' 492 | #define CONCATENATE(a, b) __CONCAT(a, b) | ^~~~~~~~ include/linux/module.h:251:9: note: in expansion of macro 'CONCATENATE' 251 | CONCATENATE(__mod_##type##__##name##__, \ | ^~~~~~~~~~~ drivers/soc/imx/imx8mp-blk-ctrl.c:746:1: note: in expansion of macro 'MODULE_DEVICE_TABLE' 746 | MODULE_DEVICE_TABLE(of, imx8m_blk_ctrl_of_match); | ^~~~~~~~~~~~~~~~~~~ vim +251 include/linux/module.h 239 240 #ifdef MODULE 241 /* Creates an alias so file2alias.c can find device table. */ 242 #define MODULE_DEVICE_TABLE(type, name) \ 243 extern typeof(name) __mod_##type##__##name##_device_table \ 244 __attribute__ ((unused, alias(__stringify(name)))) 245 #else /* !MODULE */ 246 /* The names may not be unique for built-in modules, so include the module name 247 * to guarantee uniqueness. 248 */ 249 #define MODULE_DEVICE_TABLE(type, name) \ 250 extern void *CONCATENATE( \ > 251 CONCATENATE(__mod_##type##__##name##__, \ 252 __KBUILD_MODNAME), \ 253 _device_table) \ 254 __attribute__ ((unused, alias(__stringify(name)))) 255 #endif 256
Hi Allen, Thank you for the patch! Yet something to improve: [auto build test ERROR on masahiroy-kbuild/fixes] [also build test ERROR on mcgrof/modules-next westeri-thunderbolt/next linus/master v6.1 next-20221216] [cannot apply to masahiroy-kbuild/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Allen-Webb/module-h-MODULE_DEVICE_TABLE-for-built-in-modules/20221217-071949 base: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git fixes patch link: https://lore.kernel.org/r/20221216221703.294683-2-allenwebb%40google.com patch subject: [PATCH v7 1/5] module.h: MODULE_DEVICE_TABLE for built-in modules config: alpha-allyesconfig compiler: alpha-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/403b6f73d008681a1db43482df4038dd670f1bd4 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Allen-Webb/module-h-MODULE_DEVICE_TABLE-for-built-in-modules/20221217-071949 git checkout 403b6f73d008681a1db43482df4038dd670f1bd4 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from include/linux/cpumask.h:10, from include/linux/mm_types_task.h:14, from include/linux/mm_types.h:5, from include/linux/buildid.h:5, from include/linux/module.h:14, from drivers/scsi/BusLogic.c:25: >> include/linux/module.h:251:21: error: '__mod_pci__blogic_pci_tbl__kmod_BusLogic_device_table' aliased to undefined symbol 'blogic_pci_tbl' 251 | CONCATENATE(__mod_##type##__##name##__, \ | ^~~~~~ include/linux/kernel.h:491:24: note: in definition of macro '__CONCAT' 491 | #define __CONCAT(a, b) a ## b | ^ include/linux/module.h:250:14: note: in expansion of macro 'CONCATENATE' 250 | extern void *CONCATENATE( \ | ^~~~~~~~~~~ include/linux/kernel.h:492:27: note: in expansion of macro '__CONCAT' 492 | #define CONCATENATE(a, b) __CONCAT(a, b) | ^~~~~~~~ include/linux/module.h:251:9: note: in expansion of macro 'CONCATENATE' 251 | CONCATENATE(__mod_##type##__##name##__, \ | ^~~~~~~~~~~ drivers/scsi/BusLogic.c:3735:1: note: in expansion of macro 'MODULE_DEVICE_TABLE' 3735 | MODULE_DEVICE_TABLE(pci, blogic_pci_tbl); | ^~~~~~~~~~~~~~~~~~~ vim +251 include/linux/module.h 239 240 #ifdef MODULE 241 /* Creates an alias so file2alias.c can find device table. */ 242 #define MODULE_DEVICE_TABLE(type, name) \ 243 extern typeof(name) __mod_##type##__##name##_device_table \ 244 __attribute__ ((unused, alias(__stringify(name)))) 245 #else /* !MODULE */ 246 /* The names may not be unique for built-in modules, so include the module name 247 * to guarantee uniqueness. 248 */ 249 #define MODULE_DEVICE_TABLE(type, name) \ 250 extern void *CONCATENATE( \ > 251 CONCATENATE(__mod_##type##__##name##__, \ 252 __KBUILD_MODNAME), \ 253 _device_table) \ 254 __attribute__ ((unused, alias(__stringify(name)))) 255 #endif 256
Le 16/12/2022 à 23:16, Allen Webb a écrit : > Implement MODULE_DEVICE_TABLE for build-in modules to make it possible > to generate a builtin.alias file to complement modules.alias. > > Signed-off-by: Allen Webb <allenwebb@google.com> > --- > include/linux/module.h | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/include/linux/module.h b/include/linux/module.h > index ec61fb53979a9..49e4019393127 100644 > --- a/include/linux/module.h > +++ b/include/linux/module.h > @@ -243,7 +243,15 @@ extern void cleanup_module(void); > extern typeof(name) __mod_##type##__##name##_device_table \ > __attribute__ ((unused, alias(__stringify(name)))) > #else /* !MODULE */ > -#define MODULE_DEVICE_TABLE(type, name) > +/* The names may not be unique for built-in modules, so include the module name > + * to guarantee uniqueness. > + */ This is network only comment style. Other parts of kenel have different style, see https://docs.kernel.org/process/coding-style.html#commenting > +#define MODULE_DEVICE_TABLE(type, name) \ > +extern void *CONCATENATE( \ 'extern' keyword is pointless of function prototypes and deprecated. Don't add new occurences. > + CONCATENATE(__mod_##type##__##name##__, \ > + __KBUILD_MODNAME), \ > + _device_table) \ > + __attribute__ ((unused, alias(__stringify(name)))) > #endif > > /* Version of form [<epoch>:]<version>[-<extra-version>].
On Sat, Dec 17, 2022 at 4:05 AM Christophe Leroy <christophe.leroy@csgroup.eu> wrote: > > > > Le 16/12/2022 à 23:16, Allen Webb a écrit : > > Implement MODULE_DEVICE_TABLE for build-in modules to make it possible > > to generate a builtin.alias file to complement modules.alias. > > > > Signed-off-by: Allen Webb <allenwebb@google.com> > > --- > > include/linux/module.h | 10 +++++++++- > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/include/linux/module.h b/include/linux/module.h > > index ec61fb53979a9..49e4019393127 100644 > > --- a/include/linux/module.h > > +++ b/include/linux/module.h > > @@ -243,7 +243,15 @@ extern void cleanup_module(void); > > extern typeof(name) __mod_##type##__##name##_device_table \ > > __attribute__ ((unused, alias(__stringify(name)))) > > #else /* !MODULE */ > > -#define MODULE_DEVICE_TABLE(type, name) > > +/* The names may not be unique for built-in modules, so include the module name > > + * to guarantee uniqueness. > > + */ > > This is network only comment style. I have fixed this in my local copy and will include it with the next upload. > > Other parts of kenel have different style, see > https://docs.kernel.org/process/coding-style.html#commenting > > > +#define MODULE_DEVICE_TABLE(type, name) \ > > +extern void *CONCATENATE( \ > > 'extern' keyword is pointless of function prototypes and deprecated. > Don't add new occurences. This is a weird case because these symbols are used for post compilation processing by modpost. If I drop the extern keyword, the build fails with a bunch of errors of the form: /mnt/host/source/src/third_party/kernel/upstream/drivers/hid/hid-generic.c:79:1: error: definition '__mod_hid__hid_table__kmod_hid_generic_device_table' cannot also be an alias MODULE_DEVICE_TABLE(hid, hid_table); ^ /mnt/host/source/src/third_party/kernel/upstream/include/linux/module.h:255:26: note: expanded from macro 'MODULE_DEVICE_TABLE' __attribute__ ((unused, alias(__stringify(name)))) > > > > + CONCATENATE(__mod_##type##__##name##__, \ > > + __KBUILD_MODNAME), \ > > + _device_table) \ > > + __attribute__ ((unused, alias(__stringify(name)))) > > #endif > > > > /* Version of form [<epoch>:]<version>[-<extra-version>].
diff --git a/include/linux/module.h b/include/linux/module.h index ec61fb53979a9..49e4019393127 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -243,7 +243,15 @@ extern void cleanup_module(void); extern typeof(name) __mod_##type##__##name##_device_table \ __attribute__ ((unused, alias(__stringify(name)))) #else /* !MODULE */ -#define MODULE_DEVICE_TABLE(type, name) +/* The names may not be unique for built-in modules, so include the module name + * to guarantee uniqueness. + */ +#define MODULE_DEVICE_TABLE(type, name) \ +extern void *CONCATENATE( \ + CONCATENATE(__mod_##type##__##name##__, \ + __KBUILD_MODNAME), \ + _device_table) \ + __attribute__ ((unused, alias(__stringify(name)))) #endif /* Version of form [<epoch>:]<version>[-<extra-version>].