Message ID | 20231212094352.2263283-1-yi.fang.gan@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7612010vqy; Tue, 12 Dec 2023 01:46:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFfcNIC6dej82v6X9fx99KXteye+TzfJlzzLfeNikhCX3R2KU3E4yBuYmN1Cryzz0+LNhWl X-Received: by 2002:a17:902:eb87:b0:1d0:ab30:5582 with SMTP id q7-20020a170902eb8700b001d0ab305582mr2802641plg.129.1702374404585; Tue, 12 Dec 2023 01:46:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702374404; cv=none; d=google.com; s=arc-20160816; b=e+JTH2nMSEcCD8uLAswrzh7f2Xy6ccXelxx3HStt+aM8tKPO6J4ubWKNj3ASAsFBQk +jtTuL1DTySzlItyYBDMT17+Da3/GNgmNyF77Hu0UOTWX1xGJVojxEvxQMPRahM0harf DGD6Su1pTfSP+6she+ej5r599kGAPh2UyNtrMWBky6qFJXoFmxr6xu3d3RDPE3i1JMyQ gfcmzFQPxbcbdYQo5ygI7tW26NWHR2kZCFSNDSZgmgVUlpqoZC7Uk2CEinHbU+Yt86C/ ULGvLWOeiYFXE5I+ITUg0oBgqz/mc91hE+5Ab2wPf98m2N8KyjXbcxNTTGBTu7AM6/9n P5pQ== 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=NReA4eKgPXV7Slp2Uz7TwEM/gX6Plron0QJGSJ65HwA=; fh=dvp5Xx+DRreDmFQH/xXXh1S80/ZI152mtA3lYObnbfo=; b=gFm8dQVqLdQ+zd3iP1LmzwJQoFbRy3/7f8OqwCRXsiw7zhTH9LPd/LqshtoPEtoCPV u+Af58T4f2wig7bdS+L5zOx8bWZiI9z9txM49f2+dOdFhrZu98kZca4M/jvsGx7MNxE4 S9MIQ+YuVPa35nYZ1o48QtXiR3xxYoInApilBfZ2u16NX1O2e/tYMGJG7P+H1Nb4SLax WAHhHHM89ZP7ydaRGGbX9rxy+oEtxD9QQ9Z2+8Arts2icPLnjEr2AF20fSnVBfyqcK8L veuoUSMFlJNTV4Sz9vVsyKYBEMZ0Jvzaw4wFPanbDVwf9nqBr0bjZ64yT1qHTzA9oWbE 6JZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@intel.com header.s=Intel header.b=Wwe4ffY5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id x6-20020a170902b40600b001d06b5f9af4si7352083plr.441.2023.12.12.01.46.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 01:46:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=fail header.i=@intel.com header.s=Intel header.b=Wwe4ffY5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 833578042ABD; Tue, 12 Dec 2023 01:46:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231508AbjLLJq3 (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Tue, 12 Dec 2023 04:46:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbjLLJq1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Dec 2023 04:46:27 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61C2AD2 for <linux-kernel@vger.kernel.org>; Tue, 12 Dec 2023 01:46:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702374394; x=1733910394; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=jQ1g0JWTs+h+uCJaGecUkR5E/TcmaxUbWdQhueCisdo=; b=Wwe4ffY5zASFMaoW7tjmDjnJWPoOx3lBoe3qccgPxhBb1VJ/5YXsVDtA 1UBYqbv+S5ILIJOZqgbluC0xOUzhnwH4/C/c6zprxzNIbkpQK2GVGTjpV QSoaYkcgihp9fFMmmr6B0m/p84DG4AzraGPh78RUOIj2QXqOrMDefv48e 1psXXM0VuHf6jXndE1klKz8JdFxOLb4fbX7RLO0UgnzUVM6w12uiWAv8C t1oYDsP4IoexYngDO7vwWrLw/ZLg/tZsElkqeNuaTZar860EAzSUmRDz/ XIRzy4Zbr1Aq3UP7uiJCsabbVIwHu3lrqk5+drcrUDJszE3raO5aH1xOA g==; X-IronPort-AV: E=McAfee;i="6600,9927,10921"; a="374286558" X-IronPort-AV: E=Sophos;i="6.04,269,1695711600"; d="scan'208";a="374286558" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2023 01:46:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10921"; a="749653695" X-IronPort-AV: E=Sophos;i="6.04,269,1695711600"; d="scan'208";a="749653695" Received: from ssid-ilbpg3-teeminta.png.intel.com (HELO localhost.localdomain) ([10.88.227.74]) by orsmga006.jf.intel.com with ESMTP; 12 Dec 2023 01:46:29 -0800 From: "Gan, Yi Fang" <yi.fang.gan@intel.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J . Wysocki" <rafael@kernel.org>, Javier Martinez Canillas <javierm@redhat.com>, John Stultz <jstultz@google.com>, Jens Axboe <axboe@kernel.dk>, Andrew Halaney <ahalaney@redhat.com>, Lobakin@vger.kernel.org, Aleksander <aleksander.lobakin@intel.com>, Gan@vger.kernel.org, Yi Fang <yi.fang.gan@intel.com>, linux-kernel@vger.kernel.org Cc: Looi Hong Aun <hong.aun.looi@intel.com>, Voon Weifeng <weifeng.voon@intel.com>, Song Yoong Siang <yoong.siang.song@intel.com>, Lai@vger.kernel.org, Peter Jun Ann <peter.jun.ann.lai@intel.com> Subject: [PATCH net-next 1/1] driver.h: add helper macro for module_exit() boilerplate Date: Tue, 12 Dec 2023 17:43:52 +0800 Message-Id: <20231212094352.2263283-1-yi.fang.gan@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,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 howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Dec 2023 01:46:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785068943483400226 X-GMAIL-MSGID: 1785068943483400226 |
Series |
[net-next,1/1] driver.h: add helper macro for module_exit() boilerplate
|
|
Commit Message
Gan, Yi Fang
Dec. 12, 2023, 9:43 a.m. UTC
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.
Signed-off-by: Gan, Yi Fang <yi.fang.gan@intel.com>
---
include/linux/device/driver.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
Comments
On Tue, Dec 12, 2023 at 05:43:52PM +0800, Gan, Yi Fang wrote: > 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. > > Signed-off-by: Gan, Yi Fang <yi.fang.gan@intel.com> > --- > include/linux/device/driver.h | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) Why would we take a macro that no one actually uses? Please submit this with a user, you all know that this is the case, how did it pass your internal reviews (hint, I don't think it did...) thanks, greg k-h
diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index 7738f458995f..18e75c7b5c2f 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 one, 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_ */