* [PATCH] mmc: remove unnecessary module_init/exit functions
@ 2026-01-31 2:00 Ethan Nelson-Moore
2026-02-02 1:04 ` Shawn Lin
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Ethan Nelson-Moore @ 2026-01-31 2:00 UTC (permalink / raw)
To: linux-mmc
Cc: Ethan Nelson-Moore, Jaehoon Chung, Shawn Lin, Ulf Hansson,
Adrian Hunter
Three MMC drivers have unnecessary module_init and module_exit functions
that are empty or just print a message. Remove them. Note that if a
module_init function exists, a module_exit function must also exist;
otherwise, the module cannot be unloaded.
Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
---
drivers/mmc/host/dw_mmc.c | 13 -------------
drivers/mmc/host/sdhci-pltfm.c | 13 -------------
drivers/mmc/host/sdhci-uhs2.c | 13 +------------
3 files changed, 1 insertion(+), 38 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 9e74b675e92d..613d74d2e946 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -3693,19 +3693,6 @@ int dw_mci_runtime_resume(struct device *dev)
EXPORT_SYMBOL(dw_mci_runtime_resume);
#endif /* CONFIG_PM */
-static int __init dw_mci_init(void)
-{
- pr_info("Synopsys Designware Multimedia Card Interface Driver\n");
- return 0;
-}
-
-static void __exit dw_mci_exit(void)
-{
-}
-
-module_init(dw_mci_init);
-module_exit(dw_mci_exit);
-
MODULE_DESCRIPTION("DW Multimedia Card Interface driver");
MODULE_AUTHOR("NXP Semiconductor VietNam");
MODULE_AUTHOR("Imagination Technologies Ltd");
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 7f6ac636f040..d4fb60c1ef69 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -215,19 +215,6 @@ const struct dev_pm_ops sdhci_pltfm_pmops = {
};
EXPORT_SYMBOL_GPL(sdhci_pltfm_pmops);
-static int __init sdhci_pltfm_drv_init(void)
-{
- pr_info("sdhci-pltfm: SDHCI platform and OF driver helper\n");
-
- return 0;
-}
-module_init(sdhci_pltfm_drv_init);
-
-static void __exit sdhci_pltfm_drv_exit(void)
-{
-}
-module_exit(sdhci_pltfm_drv_exit);
-
MODULE_DESCRIPTION("SDHCI platform and OF driver helper");
MODULE_AUTHOR("Intel Corporation");
MODULE_LICENSE("GPL v2");
diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
index c459a08d01da..41e49c6cc751 100644
--- a/drivers/mmc/host/sdhci-uhs2.c
+++ b/drivers/mmc/host/sdhci-uhs2.c
@@ -1126,7 +1126,7 @@ static irqreturn_t sdhci_uhs2_thread_irq(int irq, void *dev_id)
/*****************************************************************************\
* *
- * Driver init/exit *
+ * Driver init *
* *
\*****************************************************************************/
@@ -1138,17 +1138,6 @@ static int sdhci_uhs2_host_ops_init(struct sdhci_host *host)
return 0;
}
-static int __init sdhci_uhs2_mod_init(void)
-{
- return 0;
-}
-module_init(sdhci_uhs2_mod_init);
-
-static void __exit sdhci_uhs2_mod_exit(void)
-{
-}
-module_exit(sdhci_uhs2_mod_exit);
-
/*****************************************************************************\
*
* Device allocation/registration *
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] mmc: remove unnecessary module_init/exit functions
2026-01-31 2:00 [PATCH] mmc: remove unnecessary module_init/exit functions Ethan Nelson-Moore
@ 2026-02-02 1:04 ` Shawn Lin
2026-02-02 6:39 ` Adrian Hunter
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Shawn Lin @ 2026-02-02 1:04 UTC (permalink / raw)
To: Ethan Nelson-Moore
Cc: shawn.lin, Jaehoon Chung, Ulf Hansson, Adrian Hunter, linux-mmc
在 2026/01/31 星期六 10:00, Ethan Nelson-Moore 写道:
> Three MMC drivers have unnecessary module_init and module_exit functions
> that are empty or just print a message. Remove them. Note that if a
> module_init function exists, a module_exit function must also exist;
> otherwise, the module cannot be unloaded.
>
> Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
> ---
> drivers/mmc/host/dw_mmc.c | 13 -------------
Thanks for you patch. For dw_mmc,
Acked-by: Shawn Lin <shawn.lin@rock-chips.com>
> drivers/mmc/host/sdhci-pltfm.c | 13 -------------
> drivers/mmc/host/sdhci-uhs2.c | 13 +------------
> 3 files changed, 1 insertion(+), 38 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 9e74b675e92d..613d74d2e946 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -3693,19 +3693,6 @@ int dw_mci_runtime_resume(struct device *dev)
> EXPORT_SYMBOL(dw_mci_runtime_resume);
> #endif /* CONFIG_PM */
>
> -static int __init dw_mci_init(void)
> -{
> - pr_info("Synopsys Designware Multimedia Card Interface Driver\n");
> - return 0;
> -}
> -
> -static void __exit dw_mci_exit(void)
> -{
> -}
> -
> -module_init(dw_mci_init);
> -module_exit(dw_mci_exit);
> -
> MODULE_DESCRIPTION("DW Multimedia Card Interface driver");
> MODULE_AUTHOR("NXP Semiconductor VietNam");
> MODULE_AUTHOR("Imagination Technologies Ltd");
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 7f6ac636f040..d4fb60c1ef69 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -215,19 +215,6 @@ const struct dev_pm_ops sdhci_pltfm_pmops = {
> };
> EXPORT_SYMBOL_GPL(sdhci_pltfm_pmops);
>
> -static int __init sdhci_pltfm_drv_init(void)
> -{
> - pr_info("sdhci-pltfm: SDHCI platform and OF driver helper\n");
> -
> - return 0;
> -}
> -module_init(sdhci_pltfm_drv_init);
> -
> -static void __exit sdhci_pltfm_drv_exit(void)
> -{
> -}
> -module_exit(sdhci_pltfm_drv_exit);
> -
> MODULE_DESCRIPTION("SDHCI platform and OF driver helper");
> MODULE_AUTHOR("Intel Corporation");
> MODULE_LICENSE("GPL v2");
> diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> index c459a08d01da..41e49c6cc751 100644
> --- a/drivers/mmc/host/sdhci-uhs2.c
> +++ b/drivers/mmc/host/sdhci-uhs2.c
> @@ -1126,7 +1126,7 @@ static irqreturn_t sdhci_uhs2_thread_irq(int irq, void *dev_id)
>
> /*****************************************************************************\
> * *
> - * Driver init/exit *
> + * Driver init *
> * *
> \*****************************************************************************/
>
> @@ -1138,17 +1138,6 @@ static int sdhci_uhs2_host_ops_init(struct sdhci_host *host)
> return 0;
> }
>
> -static int __init sdhci_uhs2_mod_init(void)
> -{
> - return 0;
> -}
> -module_init(sdhci_uhs2_mod_init);
> -
> -static void __exit sdhci_uhs2_mod_exit(void)
> -{
> -}
> -module_exit(sdhci_uhs2_mod_exit);
> -
> /*****************************************************************************\
> *
> * Device allocation/registration *
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mmc: remove unnecessary module_init/exit functions
2026-01-31 2:00 [PATCH] mmc: remove unnecessary module_init/exit functions Ethan Nelson-Moore
2026-02-02 1:04 ` Shawn Lin
@ 2026-02-02 6:39 ` Adrian Hunter
2026-02-02 12:31 ` Ulf Hansson
2026-02-23 14:12 ` Ulf Hansson
3 siblings, 0 replies; 12+ messages in thread
From: Adrian Hunter @ 2026-02-02 6:39 UTC (permalink / raw)
To: Ethan Nelson-Moore, linux-mmc; +Cc: Jaehoon Chung, Shawn Lin, Ulf Hansson
On 31/01/2026 04:00, Ethan Nelson-Moore wrote:
> Three MMC drivers have unnecessary module_init and module_exit functions
> that are empty or just print a message. Remove them. Note that if a
> module_init function exists, a module_exit function must also exist;
> otherwise, the module cannot be unloaded.
>
> Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Doesn't seem to apply cleanly to mmc 'next' branch:
https://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git/log/?h=next
Fix that and you can add:
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/dw_mmc.c | 13 -------------
> drivers/mmc/host/sdhci-pltfm.c | 13 -------------
> drivers/mmc/host/sdhci-uhs2.c | 13 +------------
> 3 files changed, 1 insertion(+), 38 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 9e74b675e92d..613d74d2e946 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -3693,19 +3693,6 @@ int dw_mci_runtime_resume(struct device *dev)
> EXPORT_SYMBOL(dw_mci_runtime_resume);
> #endif /* CONFIG_PM */
>
> -static int __init dw_mci_init(void)
> -{
> - pr_info("Synopsys Designware Multimedia Card Interface Driver\n");
> - return 0;
> -}
> -
> -static void __exit dw_mci_exit(void)
> -{
> -}
> -
> -module_init(dw_mci_init);
> -module_exit(dw_mci_exit);
> -
> MODULE_DESCRIPTION("DW Multimedia Card Interface driver");
> MODULE_AUTHOR("NXP Semiconductor VietNam");
> MODULE_AUTHOR("Imagination Technologies Ltd");
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 7f6ac636f040..d4fb60c1ef69 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -215,19 +215,6 @@ const struct dev_pm_ops sdhci_pltfm_pmops = {
> };
> EXPORT_SYMBOL_GPL(sdhci_pltfm_pmops);
>
> -static int __init sdhci_pltfm_drv_init(void)
> -{
> - pr_info("sdhci-pltfm: SDHCI platform and OF driver helper\n");
> -
> - return 0;
> -}
> -module_init(sdhci_pltfm_drv_init);
> -
> -static void __exit sdhci_pltfm_drv_exit(void)
> -{
> -}
> -module_exit(sdhci_pltfm_drv_exit);
> -
> MODULE_DESCRIPTION("SDHCI platform and OF driver helper");
> MODULE_AUTHOR("Intel Corporation");
> MODULE_LICENSE("GPL v2");
> diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> index c459a08d01da..41e49c6cc751 100644
> --- a/drivers/mmc/host/sdhci-uhs2.c
> +++ b/drivers/mmc/host/sdhci-uhs2.c
> @@ -1126,7 +1126,7 @@ static irqreturn_t sdhci_uhs2_thread_irq(int irq, void *dev_id)
>
> /*****************************************************************************\
> * *
> - * Driver init/exit *
> + * Driver init *
> * *
> \*****************************************************************************/
>
> @@ -1138,17 +1138,6 @@ static int sdhci_uhs2_host_ops_init(struct sdhci_host *host)
> return 0;
> }
>
> -static int __init sdhci_uhs2_mod_init(void)
> -{
> - return 0;
> -}
> -module_init(sdhci_uhs2_mod_init);
> -
> -static void __exit sdhci_uhs2_mod_exit(void)
> -{
> -}
> -module_exit(sdhci_uhs2_mod_exit);
> -
> /*****************************************************************************\
> *
> * Device allocation/registration *
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mmc: remove unnecessary module_init/exit functions
2026-01-31 2:00 [PATCH] mmc: remove unnecessary module_init/exit functions Ethan Nelson-Moore
2026-02-02 1:04 ` Shawn Lin
2026-02-02 6:39 ` Adrian Hunter
@ 2026-02-02 12:31 ` Ulf Hansson
2026-02-02 20:40 ` Ethan Nelson-Moore
2026-02-23 14:12 ` Ulf Hansson
3 siblings, 1 reply; 12+ messages in thread
From: Ulf Hansson @ 2026-02-02 12:31 UTC (permalink / raw)
To: Ethan Nelson-Moore; +Cc: linux-mmc, Jaehoon Chung, Shawn Lin, Adrian Hunter
On Sat, 31 Jan 2026 at 03:00, Ethan Nelson-Moore <enelsonmoore@gmail.com> wrote:
>
> Three MMC drivers have unnecessary module_init and module_exit functions
> that are empty or just print a message. Remove them. Note that if a
> module_init function exists, a module_exit function must also exist;
> otherwise, the module cannot be unloaded.
The above doesn't mention that omitting the _init/exit and functions
also makes the module unloadable.
I think this should be perfectly fine for these cases, assuming that
we never want to unload the modules as they are pure library
functions. That said, please clarify this in the commit message.
Kind regards
Uffe
>
> Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
> ---
> drivers/mmc/host/dw_mmc.c | 13 -------------
> drivers/mmc/host/sdhci-pltfm.c | 13 -------------
> drivers/mmc/host/sdhci-uhs2.c | 13 +------------
> 3 files changed, 1 insertion(+), 38 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 9e74b675e92d..613d74d2e946 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -3693,19 +3693,6 @@ int dw_mci_runtime_resume(struct device *dev)
> EXPORT_SYMBOL(dw_mci_runtime_resume);
> #endif /* CONFIG_PM */
>
> -static int __init dw_mci_init(void)
> -{
> - pr_info("Synopsys Designware Multimedia Card Interface Driver\n");
> - return 0;
> -}
> -
> -static void __exit dw_mci_exit(void)
> -{
> -}
> -
> -module_init(dw_mci_init);
> -module_exit(dw_mci_exit);
> -
> MODULE_DESCRIPTION("DW Multimedia Card Interface driver");
> MODULE_AUTHOR("NXP Semiconductor VietNam");
> MODULE_AUTHOR("Imagination Technologies Ltd");
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 7f6ac636f040..d4fb60c1ef69 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -215,19 +215,6 @@ const struct dev_pm_ops sdhci_pltfm_pmops = {
> };
> EXPORT_SYMBOL_GPL(sdhci_pltfm_pmops);
>
> -static int __init sdhci_pltfm_drv_init(void)
> -{
> - pr_info("sdhci-pltfm: SDHCI platform and OF driver helper\n");
> -
> - return 0;
> -}
> -module_init(sdhci_pltfm_drv_init);
> -
> -static void __exit sdhci_pltfm_drv_exit(void)
> -{
> -}
> -module_exit(sdhci_pltfm_drv_exit);
> -
> MODULE_DESCRIPTION("SDHCI platform and OF driver helper");
> MODULE_AUTHOR("Intel Corporation");
> MODULE_LICENSE("GPL v2");
> diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> index c459a08d01da..41e49c6cc751 100644
> --- a/drivers/mmc/host/sdhci-uhs2.c
> +++ b/drivers/mmc/host/sdhci-uhs2.c
> @@ -1126,7 +1126,7 @@ static irqreturn_t sdhci_uhs2_thread_irq(int irq, void *dev_id)
>
> /*****************************************************************************\
> * *
> - * Driver init/exit *
> + * Driver init *
> * *
> \*****************************************************************************/
>
> @@ -1138,17 +1138,6 @@ static int sdhci_uhs2_host_ops_init(struct sdhci_host *host)
> return 0;
> }
>
> -static int __init sdhci_uhs2_mod_init(void)
> -{
> - return 0;
> -}
> -module_init(sdhci_uhs2_mod_init);
> -
> -static void __exit sdhci_uhs2_mod_exit(void)
> -{
> -}
> -module_exit(sdhci_uhs2_mod_exit);
> -
> /*****************************************************************************\
> *
> * Device allocation/registration *
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mmc: remove unnecessary module_init/exit functions
2026-02-02 12:31 ` Ulf Hansson
@ 2026-02-02 20:40 ` Ethan Nelson-Moore
2026-02-02 20:41 ` Ethan Nelson-Moore
2026-02-03 11:15 ` Ulf Hansson
0 siblings, 2 replies; 12+ messages in thread
From: Ethan Nelson-Moore @ 2026-02-02 20:40 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Shawn Lin, Adrian Hunter
Hi, Ulf,
On Mon, Feb 2, 2026 at 4:32 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> The above doesn't mention that omitting the _init/exit and functions
> also makes the module unloadable.
I can add that in the next version.
> I think this should be perfectly fine for these cases, assuming that
> we never want to unload the modules as they are pure library
> functions. That said, please clarify this in the commit message.
My understanding is that modules can be unloaded if one of the
following is true:
- They have neither init nor exit functions
- They have both, and the exit function returns zero
but that if a module has an init function but no exit function, it
cannot be unloaded.
Therefore, this change would result in the modules being able to be
unloaded as they are currently.
Feel free to correct me if I'm wrong.
Ethan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mmc: remove unnecessary module_init/exit functions
2026-02-02 20:40 ` Ethan Nelson-Moore
@ 2026-02-02 20:41 ` Ethan Nelson-Moore
2026-02-03 11:15 ` Ulf Hansson
1 sibling, 0 replies; 12+ messages in thread
From: Ethan Nelson-Moore @ 2026-02-02 20:41 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Shawn Lin, Adrian Hunter
On Mon, Feb 2, 2026 at 12:40 PM Ethan Nelson-Moore
<enelsonmoore@gmail.com> wrote:
> and the exit function returns zero
Ignore this part. I forgot that the exit function returns void.
Ethan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mmc: remove unnecessary module_init/exit functions
2026-02-02 20:40 ` Ethan Nelson-Moore
2026-02-02 20:41 ` Ethan Nelson-Moore
@ 2026-02-03 11:15 ` Ulf Hansson
2026-02-10 2:25 ` Ethan Nelson-Moore
1 sibling, 1 reply; 12+ messages in thread
From: Ulf Hansson @ 2026-02-03 11:15 UTC (permalink / raw)
To: Ethan Nelson-Moore; +Cc: linux-mmc, Jaehoon Chung, Shawn Lin, Adrian Hunter
On Mon, 2 Feb 2026 at 21:40, Ethan Nelson-Moore <enelsonmoore@gmail.com> wrote:
>
> Hi, Ulf,
>
> On Mon, Feb 2, 2026 at 4:32 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > The above doesn't mention that omitting the _init/exit and functions
> > also makes the module unloadable.
> I can add that in the next version.
>
> > I think this should be perfectly fine for these cases, assuming that
> > we never want to unload the modules as they are pure library
> > functions. That said, please clarify this in the commit message.
> My understanding is that modules can be unloaded if one of the
> following is true:
> - They have neither init nor exit functions
I don't think that's correct. At least this is my understanding of how
this works.
> - They have both, and the exit function returns zero
> but that if a module has an init function but no exit function, it
> cannot be unloaded.
> Therefore, this change would result in the modules being able to be
> unloaded as they are currently.
> Feel free to correct me if I'm wrong.
>
> Ethan
Kind regards
Uffe
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mmc: remove unnecessary module_init/exit functions
2026-02-03 11:15 ` Ulf Hansson
@ 2026-02-10 2:25 ` Ethan Nelson-Moore
2026-02-10 13:04 ` Ulf Hansson
0 siblings, 1 reply; 12+ messages in thread
From: Ethan Nelson-Moore @ 2026-02-10 2:25 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Shawn Lin, Adrian Hunter
Hi, Uffe,
On Tue, Feb 3, 2026 at 3:16 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > - They have neither init nor exit functions
>
> I don't think that's correct. At least this is my understanding of how
> this works.
Yes, it is correct. You can easily verify it - for example,
drivers/net/mii.c has neither init nor exit functions, but you can
still freely run "rmmod mii", assuming you don't have anything loaded
that uses it.
Ethan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mmc: remove unnecessary module_init/exit functions
2026-02-10 2:25 ` Ethan Nelson-Moore
@ 2026-02-10 13:04 ` Ulf Hansson
2026-02-10 20:37 ` Ethan Nelson-Moore
0 siblings, 1 reply; 12+ messages in thread
From: Ulf Hansson @ 2026-02-10 13:04 UTC (permalink / raw)
To: Ethan Nelson-Moore; +Cc: linux-mmc, Jaehoon Chung, Shawn Lin, Adrian Hunter
On Tue, 10 Feb 2026 at 03:25, Ethan Nelson-Moore <enelsonmoore@gmail.com> wrote:
>
> Hi, Uffe,
>
> On Tue, Feb 3, 2026 at 3:16 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > > - They have neither init nor exit functions
> >
> > I don't think that's correct. At least this is my understanding of how
> > this works.
>
> Yes, it is correct. You can easily verify it - for example,
> drivers/net/mii.c has neither init nor exit functions, but you can
> still freely run "rmmod mii", assuming you don't have anything loaded
> that uses it.
That doesn't mean that module will be unloaded, as far as I understand.
If there is no exit function, the module will stick around in memory.
Kind regards
Uffe
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mmc: remove unnecessary module_init/exit functions
2026-02-10 13:04 ` Ulf Hansson
@ 2026-02-10 20:37 ` Ethan Nelson-Moore
2026-02-11 11:24 ` Ulf Hansson
0 siblings, 1 reply; 12+ messages in thread
From: Ethan Nelson-Moore @ 2026-02-10 20:37 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Shawn Lin, Adrian Hunter
Hi, Uffe,
On Tue, Feb 10, 2026 at 5:05 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> If there is no exit function, the module will stick around in memory.
No, it won't:
➜ ~ sudo grep mii /proc/modules
(nothing)
➜ ~ sudo modprobe mii
➜ ~ sudo grep mii /proc/modules
mii 20480 0 - Live 0xffffffffc2549000
➜ ~ sudo rmmod mii
➜ ~ sudo grep 0xffffffffc2549000 /proc/modules
(nothing)
➜ ~
Ethan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mmc: remove unnecessary module_init/exit functions
2026-02-10 20:37 ` Ethan Nelson-Moore
@ 2026-02-11 11:24 ` Ulf Hansson
0 siblings, 0 replies; 12+ messages in thread
From: Ulf Hansson @ 2026-02-11 11:24 UTC (permalink / raw)
To: Ethan Nelson-Moore; +Cc: linux-mmc, Jaehoon Chung, Shawn Lin, Adrian Hunter
On Tue, 10 Feb 2026 at 21:38, Ethan Nelson-Moore <enelsonmoore@gmail.com> wrote:
>
> Hi, Uffe,
>
> On Tue, Feb 10, 2026 at 5:05 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > If there is no exit function, the module will stick around in memory.
>
> No, it won't:
> ➜ ~ sudo grep mii /proc/modules
> (nothing)
> ➜ ~ sudo modprobe mii
> ➜ ~ sudo grep mii /proc/modules
> mii 20480 0 - Live 0xffffffffc2549000
> ➜ ~ sudo rmmod mii
> ➜ ~ sudo grep 0xffffffffc2549000 /proc/modules
> (nothing)
> ➜ ~
>
> Ethan
Thanks for re-confirming! Yes, it seems like I was wrong, sorry for
all the noise!
I had a look at the code for the delete_module sycall in
kernel/module/main.c states, which confirms this too! If there is no
init function, we don't need an exit function to allow a module to be
unloaded.
That said, I will apply your patch as is, as soon as we have v7.0-rc1.
Kind regards
Uffe
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mmc: remove unnecessary module_init/exit functions
2026-01-31 2:00 [PATCH] mmc: remove unnecessary module_init/exit functions Ethan Nelson-Moore
` (2 preceding siblings ...)
2026-02-02 12:31 ` Ulf Hansson
@ 2026-02-23 14:12 ` Ulf Hansson
3 siblings, 0 replies; 12+ messages in thread
From: Ulf Hansson @ 2026-02-23 14:12 UTC (permalink / raw)
To: Ethan Nelson-Moore; +Cc: linux-mmc, Jaehoon Chung, Shawn Lin, Adrian Hunter
On Sat, 31 Jan 2026 at 03:00, Ethan Nelson-Moore <enelsonmoore@gmail.com> wrote:
>
> Three MMC drivers have unnecessary module_init and module_exit functions
> that are empty or just print a message. Remove them. Note that if a
> module_init function exists, a module_exit function must also exist;
> otherwise, the module cannot be unloaded.
>
> Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/dw_mmc.c | 13 -------------
> drivers/mmc/host/sdhci-pltfm.c | 13 -------------
> drivers/mmc/host/sdhci-uhs2.c | 13 +------------
> 3 files changed, 1 insertion(+), 38 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 9e74b675e92d..613d74d2e946 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -3693,19 +3693,6 @@ int dw_mci_runtime_resume(struct device *dev)
> EXPORT_SYMBOL(dw_mci_runtime_resume);
> #endif /* CONFIG_PM */
>
> -static int __init dw_mci_init(void)
> -{
> - pr_info("Synopsys Designware Multimedia Card Interface Driver\n");
> - return 0;
> -}
> -
> -static void __exit dw_mci_exit(void)
> -{
> -}
> -
> -module_init(dw_mci_init);
> -module_exit(dw_mci_exit);
> -
> MODULE_DESCRIPTION("DW Multimedia Card Interface driver");
> MODULE_AUTHOR("NXP Semiconductor VietNam");
> MODULE_AUTHOR("Imagination Technologies Ltd");
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 7f6ac636f040..d4fb60c1ef69 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -215,19 +215,6 @@ const struct dev_pm_ops sdhci_pltfm_pmops = {
> };
> EXPORT_SYMBOL_GPL(sdhci_pltfm_pmops);
>
> -static int __init sdhci_pltfm_drv_init(void)
> -{
> - pr_info("sdhci-pltfm: SDHCI platform and OF driver helper\n");
> -
> - return 0;
> -}
> -module_init(sdhci_pltfm_drv_init);
> -
> -static void __exit sdhci_pltfm_drv_exit(void)
> -{
> -}
> -module_exit(sdhci_pltfm_drv_exit);
> -
> MODULE_DESCRIPTION("SDHCI platform and OF driver helper");
> MODULE_AUTHOR("Intel Corporation");
> MODULE_LICENSE("GPL v2");
> diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> index c459a08d01da..41e49c6cc751 100644
> --- a/drivers/mmc/host/sdhci-uhs2.c
> +++ b/drivers/mmc/host/sdhci-uhs2.c
> @@ -1126,7 +1126,7 @@ static irqreturn_t sdhci_uhs2_thread_irq(int irq, void *dev_id)
>
> /*****************************************************************************\
> * *
> - * Driver init/exit *
> + * Driver init *
> * *
> \*****************************************************************************/
>
> @@ -1138,17 +1138,6 @@ static int sdhci_uhs2_host_ops_init(struct sdhci_host *host)
> return 0;
> }
>
> -static int __init sdhci_uhs2_mod_init(void)
> -{
> - return 0;
> -}
> -module_init(sdhci_uhs2_mod_init);
> -
> -static void __exit sdhci_uhs2_mod_exit(void)
> -{
> -}
> -module_exit(sdhci_uhs2_mod_exit);
> -
> /*****************************************************************************\
> *
> * Device allocation/registration *
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-02-23 14:13 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-31 2:00 [PATCH] mmc: remove unnecessary module_init/exit functions Ethan Nelson-Moore
2026-02-02 1:04 ` Shawn Lin
2026-02-02 6:39 ` Adrian Hunter
2026-02-02 12:31 ` Ulf Hansson
2026-02-02 20:40 ` Ethan Nelson-Moore
2026-02-02 20:41 ` Ethan Nelson-Moore
2026-02-03 11:15 ` Ulf Hansson
2026-02-10 2:25 ` Ethan Nelson-Moore
2026-02-10 13:04 ` Ulf Hansson
2026-02-10 20:37 ` Ethan Nelson-Moore
2026-02-11 11:24 ` Ulf Hansson
2026-02-23 14:12 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox