Message ID | 20231127101603.807593-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:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2986410vqx; Mon, 27 Nov 2023 02:18:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCkxntKeUbFvyMHLlRITcREzOedS4/kLYsjrwf1UDkSl0GWOh36/HVLD1GGAF9+oR5HNXk X-Received: by 2002:a9d:6b18:0:b0:6d8:2883:cb5a with SMTP id g24-20020a9d6b18000000b006d82883cb5amr2570946otp.24.1701080317205; Mon, 27 Nov 2023 02:18:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701080317; cv=none; d=google.com; s=arc-20160816; b=j+yOXcaWx5ZGn9o0JrIpLiSS8FJ/uX2R8q649M6DnnrhXwsTwmn2qvUmuwd4AvdqAs K9x+iXRJNOz4+3FDO0cfDaH842aXG6U1SXf86DHGaLqndDd2NX4CQ7nRrd4YvafLvsAY 0XzKNuwJxOKpE0e50vTBNx1FyoZDrzH1tlM/lMr8EF5Z+9s7XDRq07tNHyg1uHUwo7dx WEZhWhp4ZP3CBk5LGmYvtm/4YcXvTwABtzGQj6oinG9fji90eBK1hEnlkXRYL7TPkohb 63Vm1XmkROM9L0vhkv5t1Rn7AGOmlIglz7rm7wHMSpe3zigEBUi5gzQ12oED41c3bLKB vg1A== 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=P/NIOe4c65UqVH7B1XbQqgi6ppFLhCRs56TFX2ecn+Y=; fh=gsXiJVceV9jD0Eau8FRubV2mV4Ce0rkrkDszh9lLmC0=; b=Qw6vShiUW7KwLLnbi8ZpPm8MInTr0ktZx83+LdkY7KpPyibzc/3rp8No+NXphWOe9Y oBOhrPPPzaP2/wcC4R1XSiZ59+aa+cq8tMIga2ORFm+ETlNw9+coZNzbGvY1vv3xIWNO Iqt+fxYLccGTxX09TjHrDauf4j3HGV4j92vt5JXQ0pwLNv15CSmPHfxKxIfTIi+qgwyA old5FuzZo3PTzXnvzPZ49Sb9dkuqss7QBCnXcu8ztBW4iUS4LdZiHXt+0S4etH5VdZDU bKCfBmNh6rg9VscgCtqk8DUfL6eXJqnpA89a5UN7yJ4RSeVWTTzHzaL0HhsEZ1siFgi3 5hvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I1kG75vg; 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=intel.com Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id ch9-20020a056a0208c900b005c277eadf93si10143981pgb.318.2023.11.27.02.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 02:18:37 -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=@intel.com header.s=Intel header.b=I1kG75vg; 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=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id C66148041ECE; Mon, 27 Nov 2023 02:18:31 -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 S232894AbjK0KSW (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Mon, 27 Nov 2023 05:18:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232889AbjK0KSU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 27 Nov 2023 05:18:20 -0500 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30C90EA; Mon, 27 Nov 2023 02:18:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701080307; x=1732616307; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=EHjb8a4oKENRdIROHVOuLNb1REGASuIrFu/8GnwvA6M=; b=I1kG75vgCflcYYI6RvFpQfTH38L7BxKPxmXkrwQmnaquDw59v+IykMSE YuNHABUUXb0JE3owaK0uKNeyR9k9B7SE2CpG5WJsw2/RFulit+Ai8C2Tz /68udVlruIfa91OvW7iCCGuaueMHA6wsKY0KanqQMhFcrGjaYFjl7rXJT nvSwbluj0e2QsLhMKBycrEXtVzaTB1/9oP8DZXwzsi3ewl3IfUeCgfVB9 ZJYRlon795lF1/VpcR9Z9i4TcBPFhlkWth860YKOf/uyVHBAxskxK/PwU K5Ab72XTX5b2quK/nV5CYILT842dhp7FCkBGlW7a9W8GKCaceU++Hs1bu Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10906"; a="11372970" X-IronPort-AV: E=Sophos;i="6.04,230,1695711600"; d="scan'208";a="11372970" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2023 02:18:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10906"; a="891690067" X-IronPort-AV: E=Sophos;i="6.04,230,1695711600"; d="scan'208";a="891690067" Received: from ssid-ilbpg3-teeminta.png.intel.com (HELO localhost.localdomain) ([10.88.227.74]) by orsmga004.jf.intel.com with ESMTP; 27 Nov 2023 02:18:21 -0800 From: Gan Yi Fang <yi.fang.gan@intel.com> To: Russell King <linux@armlinux.org.uk>, Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, =?utf-8?q?Marek_Beh=C3=BAn?= <kabel@kernel.org>, netdev@vger.kernel.org, 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>, Gan Yi Fang <yi.fang.gan@intel.com>, Lai Peter Jun Ann <jun.ann.lai@intel.com> Subject: [PATCH net 1/1] net: phylink: Add module_exit() Date: Mon, 27 Nov 2023 18:16:03 +0800 Message-Id: <20231127101603.807593-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.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 pete.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 (pete.vger.email [0.0.0.0]); Mon, 27 Nov 2023 02:18:32 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783711994846091883 X-GMAIL-MSGID: 1783711994846091883 |
Series |
[net,1/1] net: phylink: Add module_exit()
|
|
Commit Message
Gan, Yi Fang
Nov. 27, 2023, 10:16 a.m. UTC
From: "Gan, Yi Fang" <yi.fang.gan@intel.com> In free_module(), if mod->init callback is defined but mod->exit callback is not defined, it will assume the module cannot be removed and return EBUSY. The module_exit() is missing from current phylink module drive causing failure while unloading it. This patch introduces phylink_exit() for phylink module removal. Fixes: eca68a3c7d05 ("net: phylink: pass supported host PHY interface modes to phylib for SFP's PHYs") Cc: <stable@vger.kernel.org> # 6.1+ Signed-off-by: Lai Peter Jun Ann <jun.ann.lai@intel.com> Signed-off-by: Gan, Yi Fang <yi.fang.gan@intel.com> --- drivers/net/phy/phylink.c | 3 +++ 1 file changed, 3 insertions(+)
Comments
On Mon, Nov 27, 2023 at 06:16:03PM +0800, Gan Yi Fang wrote: > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c > index 25c19496a336..7121503c9259 100644 > --- a/drivers/net/phy/phylink.c > +++ b/drivers/net/phy/phylink.c > @@ -3724,7 +3724,10 @@ static int __init phylink_init(void) > return 0; > } > > +static void __exit phylink_exit(void){} Please format that as: static void __exit phylink_exit(void) { } and move it _after_ module_init(). Thanks.
From: Gan Yi Fang <yi.fang.gan@intel.com> Date: Mon, 27 Nov 2023 18:16:03 +0800 > From: "Gan, Yi Fang" <yi.fang.gan@intel.com> Please fix your Git vs mail client settings, so that your own patches won't contain "From:" with your own name. I'd suggest using "Gan Yi Fang", as that Intel's versions with commas (,) aren't optimal for mailing lists and development. > > In free_module(), if mod->init callback is defined but mod->exit callback > is not defined, it will assume the module cannot be removed and return > EBUSY. The module_exit() is missing from current phylink module drive > causing failure while unloading it. > > This patch introduces phylink_exit() for phylink module removal. > > Fixes: eca68a3c7d05 ("net: phylink: pass supported host PHY interface modes to phylib for SFP's PHYs") > Cc: <stable@vger.kernel.org> # 6.1+ > Signed-off-by: Lai Peter Jun Ann <jun.ann.lai@intel.com> > Signed-off-by: Gan, Yi Fang <yi.fang.gan@intel.com> > --- > drivers/net/phy/phylink.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c > index 25c19496a336..7121503c9259 100644 > --- a/drivers/net/phy/phylink.c > +++ b/drivers/net/phy/phylink.c > @@ -3724,7 +3724,10 @@ static int __init phylink_init(void) > return 0; > } > > +static void __exit phylink_exit(void){} > + > module_init(phylink_init); > +module_exit(phylink_exit); This pattern (empty __exit function + module_exit()) is +/- common in the kernel. How about making a macro from it, just like it's done with e.g. module_platform_driver() etc.? So that you could just add to phylink.c something like: module_exit_stub(phylink); > > MODULE_LICENSE("GPL v2"); > MODULE_DESCRIPTION("phylink models the MAC to optional PHY connection"); Thanks, Olek
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 25c19496a336..7121503c9259 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3724,7 +3724,10 @@ static int __init phylink_init(void) return 0; } +static void __exit phylink_exit(void){} + module_init(phylink_init); +module_exit(phylink_exit); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("phylink models the MAC to optional PHY connection");