public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Gan Yi Fang <yi.fang.gan@intel.com>
Cc: "Looi Hong Aun" <hong.aun.looi@intel.com>,
	"Voon Weifeng" <weifeng.voon@intel.com>,
	"Song Yoong Siang" <yoong.siang.song@intel.com>,
	"Lai Peter Jun Ann" <jun.ann.lai@intel.com>,
	"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>,
	"Marek Behún" <kabel@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 1/1] net: phylink: Add module_exit()
Date: Mon, 27 Nov 2023 14:01:59 +0100	[thread overview]
Message-ID: <673d222c-52ee-4b65-9dff-0357ed0726a8@intel.com> (raw)
In-Reply-To: <20231127101603.807593-1-yi.fang.gan@intel.com>

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

      parent reply	other threads:[~2023-11-27 13:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 10:16 [PATCH net 1/1] net: phylink: Add module_exit() Gan Yi Fang
2023-11-27 10:27 ` Russell King (Oracle)
2023-11-27 13:01 ` Alexander Lobakin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=673d222c-52ee-4b65-9dff-0357ed0726a8@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=hong.aun.looi@intel.com \
    --cc=jun.ann.lai@intel.com \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=weifeng.voon@intel.com \
    --cc=yi.fang.gan@intel.com \
    --cc=yoong.siang.song@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox