linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Tong Zhang <ztong0001@gmail.com>
Cc: "Jakub Kicinski" <kuba@kernel.org>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Colin Ian King" <colin.i.king@googlemail.com>,
	"Saurav Girepunje" <saurav.girepunje@gmail.com>,
	"Johan Hovold" <johan@kernel.org>,
	"Cláudio Maia" <clrrm@isep.ipp.pt>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8192u: cleanup proc fs entries upon exit
Date: Mon, 21 Feb 2022 18:16:22 +0100	[thread overview]
Message-ID: <YhPI5iDRUpzYWDyY@kroah.com> (raw)
In-Reply-To: <20220220231554.2510567-1-ztong0001@gmail.com>

On Sun, Feb 20, 2022 at 03:15:53PM -0800, Tong Zhang wrote:
> proc fs entries need to be removed when module is removed, otherwise
> when we try to insert the module again, kernel will complain
> 
> [  493.068012] proc_dir_entry 'net/ieee80211' already registered
> [  493.271973]  proc_mkdir+0x18/0x20
> [  493.272136]  ieee80211_debug_init+0x28/0xde8 [r8192u_usb]
> [  493.272404]  rtl8192_usb_module_init+0x10/0x161 [r8192u_usb]
> 
> [   13.910616] proc_dir_entry 'net/rtl819xU' already registered
> [   13.918931]  proc_mkdir+0x18/0x20
> [   13.919098]  rtl8192_usb_module_init+0x142/0x16d [r8192u_usb]
> 
> Signed-off-by: Tong Zhang <ztong0001@gmail.com>
> ---
>  drivers/staging/rtl8192u/r8192U_core.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index 364e1ca94f70..683afdc667bc 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -4825,6 +4825,11 @@ static int __init rtl8192_usb_module_init(void)
>  static void __exit rtl8192_usb_module_exit(void)
>  {
>  	usb_deregister(&rtl8192_usb_driver);
> +	remove_proc_entry(RTL819XU_MODULE_NAME, init_net.proc_net);
> +
> +#ifdef CONFIG_IEEE80211_DEBUG
> +	ieee80211_debug_exit();
> +#endif

Please do not put #ifdef in .c files.  They should be in a .h file
instead.

thanks,

greg k-h

  parent reply	other threads:[~2022-02-21 17:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-20 23:15 [PATCH] staging: rtl8192u: cleanup proc fs entries upon exit Tong Zhang
2022-02-21 13:00 ` Dan Carpenter
2022-02-21 13:05   ` Dan Carpenter
2022-02-21 17:16 ` Greg Kroah-Hartman [this message]
2022-02-23  5:43   ` Tong Zhang
2022-02-24  6:40   ` [PATCH v2 1/3] staging: rtl8192u: fix broken debug macro Tong Zhang
2022-02-24  6:40   ` [PATCH v2 2/3] staging: rtl8192u: add empty debug functions Tong Zhang
2022-02-24  6:40   ` [PATCH v2 3/3] staging: rtl8192u: rework init and exit function Tong Zhang
2022-02-24  7:27     ` Dan Carpenter

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=YhPI5iDRUpzYWDyY@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=clrrm@isep.ipp.pt \
    --cc=colin.i.king@googlemail.com \
    --cc=johan@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=saurav.girepunje@gmail.com \
    --cc=ztong0001@gmail.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;
as well as URLs for NNTP newsgroup(s).