From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0AAE9C35274 for ; Thu, 21 Dec 2023 08:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uMpEw8VT0RocGrTrCHIzlzKMybQ7QeNC/u8Q0rqV4U0=; b=zXfxlmxmQjxtIG 4S/RxnBvnagfSqlXl7DOXnD1UN5LbAyI9x1cGFkfeP+U5sgd0Jg8As8/A4Wkt3UH7WKZayoKHu5MC t5LKkmL+VAoAmZ2UY/nq3Yt0YVk34QoURcEtJydvzaytRBNySg41ldiDBUezMbuci/Zxx0vhjZzvb igQkvLh0DfwI/u2jmPHUDMVWx3HQJVgfWYkSiQ8fIE6OvUnY5CSwpzuoiUQtiSoy3i1i+miBlKQSG HS2b0+x/bl0gxu1a9vWTyobSrOXdnfFf0W/4frOpWr1TFpf8YudpZ6SW3eOLZvqE/gsyavgw94hJH +h09ujdA1O6ddz9cAgSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGEpL-0026EP-2O; Thu, 21 Dec 2023 08:54:47 +0000 Received: from mgamail.intel.com ([192.198.163.9]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGEpC-0026AV-2c for linux-arm-kernel@lists.infradead.org; Thu, 21 Dec 2023 08:54:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703148879; x=1734684879; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1ba7Ldspb0L81io7WDsMQs1X2A/thFBlYyfgOhF/Vgg=; b=Mt+sTEfatZuHk+IlePDpUOOnyVhjOkOfworYqugNOlqHob/DXbNeUB8g I4pd/u7Q44CF4D/AChwmvw76ZswXoOliwei352toJz+hxmyh2eg2yHocy hXgeiZPK97mf72Ho4xMaArBjvEpr+aPyiS/ubvG2hVl1uBJDIB5k8dUjc S7lZlycmwZzmdU+sG3Q7a+EyECWT06mP1IzkxfGLRl7JMg8fVRteK2G6O P5qYe4uesbC2vPKO/P35TkuJF8Wr/8Yn/DUMKlnQfR8f8GRFb/o6LjKb/ iJpIDNLFJsFkPAZVlAaz7Q8wvtJG2IKNOilJHXRS8AdoMrXQoED8lAf2i w==; X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="2793696" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="2793696" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 00:54:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="842568329" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="842568329" Received: from ssid-ilbpg3-teeminta.png.intel.com (HELO localhost.localdomain) ([10.88.227.74]) by fmsmga008.fm.intel.com with ESMTP; 21 Dec 2023 00:54:32 -0800 From: "Gan, Yi Fang" To: Greg Kroah-Hartman , Andrew Halaney , Javier Martinez Canillas , John Stultz , "Rafael J . Wysocki" , Gan Yi Fang , Jens Axboe , Russell King , Andrew Lunn , Heiner Kallweit , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , =?UTF-8?q?Marek=20Beh=C3=BAn?= , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Looi Hong Aun , Voon Weifeng , Song Yoong Siang , Lai Peter Jun Ann , Choong Yong Liang Subject: [PATCH net v2 1/2] driver.h: add helper macro for module_exit() boilerplate Date: Thu, 21 Dec 2023 16:51:08 +0800 Message-Id: <20231221085109.2830794-2-yi.fang.gan@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231221085109.2830794-1-yi.fang.gan@intel.com> References: <20231221085109.2830794-1-yi.fang.gan@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231221_005438_863266_FE4AFA6A X-CRM114-Status: GOOD ( 13.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org For the modules need a module_init() but don't need to do anything special in module_exit() might need to have an empty module_exit(). This patch add a new macro module_exit_stub() to replace the empty module_exit(). The macro is useful to remove the module_exit() boilerplate. Cc: # 6.1+ Suggested-by: Lobakin, Aleksander Signed-off-by: Gan, Yi Fang --- include/linux/device/driver.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index 7738f458995f..7d322eef501e 100644 --- a/include/linux/device/driver.h +++ b/include/linux/device/driver.h @@ -288,4 +288,18 @@ static int __init __driver##_init(void) \ } \ device_initcall(__driver##_init); +/** + * module_exit_stub() - Helper macro for drivers that have init but don't + * do anything in exit. This eliminates some boilerplate. + * Each module may only use this macro once, and calling it replaces + * module_exit(). + * + * @__driver: driver name + */ +#define module_exit_stub(__driver) \ +static void __exit __driver##_exit(void) \ +{ \ +} \ +module_exit(__driver##_exit) + #endif /* _DEVICE_DRIVER_H_ */ -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel