From patchwork Sun Nov 26 07:19:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 169838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2337583vqx; Sat, 25 Nov 2023 23:20:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0AJQy5W+4mKBW6ydD8F3sDGlcoWcfoBygrjzeUtchJJ2MqeYJAcT32HalcH5a99Ljgnc9 X-Received: by 2002:a17:903:4d8:b0:1cf:a246:6f67 with SMTP id jm24-20020a17090304d800b001cfa2466f67mr7215324plb.1.1700983207482; Sat, 25 Nov 2023 23:20:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700983207; cv=none; d=google.com; s=arc-20160816; b=gZzct+wDydC99lqI8wWlKgjvDzRWTQjIIKRgK+Z158Ywx98hT20mH7RL5aZ+5kiYxa hw0/MacIQNHM+HtE6PptMoZV25+tpipBSgwJcpwebRz/ovNBryuzmcWFSaJFcXOizSkx 26LS+FcZkp7ilXtjyrfSMQriyC+s2LSSDsqp1F3g5QrQacsspQGnopQxHjIKWUFE18Im BH0pFZupsBeWnBXCbHtofW0Mu8//LvGQwbd3MIiUTVGqr9ZSKyF1sYjE4SnzjhwNgqrp HuSpfXKxv0i/KYcbuBkH2B/pitlImqy0XymFeFcDRApMtWR+7d4Y2sXpzfZGGM1xRGA0 Rvww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Vo30T+f5Cn8EACFxLn5pntv0HSl+5P3yFsRMGL7PzaU=; fh=hkyfHfwnPmiKMR4A30PicT0LuC6/2ftxjAZBgfA+N+o=; b=QcDkq4tLOJhWak2hwA57BveKCTsB0nfWeKPlOWYe+RQCQz+L9Pg0F1vos8QtCPx6dh mrv6fYl0fvCA+OgIvlLEHsrfCIWpGdfZ+0wQ9uuYzZIOlQ5bamBoUS9+C/ntWzb9hZ6H ENCGZggEEJOjh/2FfiSydtvRRV0+hEA/AbveGzQg5cPtKonO7USNw9VaqvZNybQf2285 9wqrkqkbxtb21xZf3jpRLNSuOEwAcdJD6PcAp/iP4i2sQn+h8yQ23i9goVP5UMaUt5jK v1T5WzP1bpkKSBQOX3yYbpmMAenJmtagBrXcgUXq0L7pOi0QBMlVhenCyBM9gE0Uvypr dOXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=l8eJqj2q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id p3-20020a1709026b8300b001cf9d8ae8f0si5936316plk.166.2023.11.25.23.20.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 23:20:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=l8eJqj2q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id CBD0680C9A7F; Sat, 25 Nov 2023 23:20:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229470AbjKZHTT (ORCPT + 99 others); Sun, 26 Nov 2023 02:19:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjKZHTS (ORCPT ); Sun, 26 Nov 2023 02:19:18 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D39D101 for ; Sat, 25 Nov 2023 23:19:24 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 383C9C433C7; Sun, 26 Nov 2023 07:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700983164; bh=8gd0dMckeTvfrJbqiPZ2qHzROw5OCFMp48suO82vyAs=; h=From:To:Cc:Subject:Date:From; b=l8eJqj2qVxYSd0kyCthbRdsjJWwv8BkOprPhHQWVhjZE77suqM6bLD/BiLU/E1itB nACkUvUzYVBu3EyM6bJxFONeF6hruY82B1HyUWGAqbzqn5EaniAbbi53yeV58r0imt zT8dHSlB/WuMWZB8tEJRbgv06wvUmqrw/n6IMOcbv0EFj4KG/VELuhXNdO3LOvOoRM gdEalE+TZ+Hb+Mx2qjdTAU2T1C9ZblxQTHsNWYLM6r0sHpHh3kbiz/wTHdnDO6ixYb K9QP7W9tZsUkVb6Fgs4bujgAZiZhIiS/CsPQkrcKnTWsgJE3wKIeomXu98uMlhSZYy FGRtjHj4xOqww== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Paul Gortmaker , linux-modules@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH] init: move THIS_MODULE from to Date: Sun, 26 Nov 2023 16:19:14 +0900 Message-Id: <20231126071914.932241-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sat, 25 Nov 2023 23:20:04 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783610167828180136 X-GMAIL-MSGID: 1783610167828180136 Commit f50169324df4 ("module.h: split out the EXPORT_SYMBOL into export.h") appropriately separated EXPORT_SYMBOL into because modules and EXPORT_SYMBOL are orthogonal; modules are symbol consumers, while EXPORT_SYMBOL are used by symbol providers, which may not be necessarily a module. However, that commit also relocated THIS_MODULE. As explained in the commit description, the intention was to define THIS_MODULE in a lightweight header, but I do not believe was the suitable location because EXPORT_SYMBOL and THIS_MODULE are unrelated. Move it to another lightweight header, . The reason for choosing is to make self-contained without relying on incorrectly including . With this adjustment, the role of becomes clearer as it only defines EXPORT_SYMBOL. Signed-off-by: Masahiro Yamada Reviewed-by: Luis Chamberlain --- include/linux/export.h | 18 ------------------ include/linux/init.h | 7 +++++++ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/include/linux/export.h b/include/linux/export.h index 9911508a9604..0bbd02fd351d 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -6,15 +6,6 @@ #include #include -/* - * Export symbols from the kernel to modules. Forked from module.h - * to reduce the amount of pointless cruft we feed to gcc when only - * exporting a simple symbol or two. - * - * Try not to add #includes here. It slows compilation and makes kernel - * hackers place grumpy comments in header files. - */ - /* * This comment block is used by fixdep. Please do not remove. * @@ -23,15 +14,6 @@ * side effect of the *.o build rule. */ -#ifndef __ASSEMBLY__ -#ifdef MODULE -extern struct module __this_module; -#define THIS_MODULE (&__this_module) -#else -#define THIS_MODULE ((struct module *)0) -#endif -#endif /* __ASSEMBLY__ */ - #ifdef CONFIG_64BIT #define __EXPORT_SYMBOL_REF(sym) \ .balign 8 ASM_NL \ diff --git a/include/linux/init.h b/include/linux/init.h index 01b52c9c7526..3fa3f6241350 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -179,6 +179,13 @@ extern void (*late_time_init)(void); extern bool initcall_debug; +#ifdef MODULE +extern struct module __this_module; +#define THIS_MODULE (&__this_module) +#else +#define THIS_MODULE ((struct module *)0) +#endif + #endif #ifndef MODULE