This patchset mainly support MTK_SMI could be modular. No other function add.
The MTK_IOMMU config will be another patchset.
rebase on v5.11-rc1.
Yong Wu (3):
memory: mtk-smi: Use platform_register_drivers
memory: mtk-smi: Add module_exit and module_license
memory: mtk-smi: Switch MTK_SMI to tristate
drivers/memory/Kconfig | 2 +-
drivers/memory/mtk-smi.c | 33 +++++++++++++++------------------
include/soc/mediatek/smi.h | 2 +-
3 files changed, 17 insertions(+), 20 deletions(-)
--
2.18.0
In this file, we have 2 drivers, smi-common and smi-larb.
Use platform_register_drivers.
Signed-off-by: Yong Wu <[email protected]>
---
drivers/memory/mtk-smi.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index ac350f8d1e20..e2aebd2bfa8e 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -587,26 +587,13 @@ static struct platform_driver mtk_smi_common_driver = {
}
};
+static struct platform_driver * const smidrivers[] = {
+ &mtk_smi_common_driver,
+ &mtk_smi_larb_driver,
+};
+
static int __init mtk_smi_init(void)
{
- int ret;
-
- ret = platform_driver_register(&mtk_smi_common_driver);
- if (ret != 0) {
- pr_err("Failed to register SMI driver\n");
- return ret;
- }
-
- ret = platform_driver_register(&mtk_smi_larb_driver);
- if (ret != 0) {
- pr_err("Failed to register SMI-LARB driver\n");
- goto err_unreg_smi;
- }
- return ret;
-
-err_unreg_smi:
- platform_driver_unregister(&mtk_smi_common_driver);
- return ret;
+ return platform_register_drivers(smidrivers, ARRAY_SIZE(smidrivers));
}
-
module_init(mtk_smi_init);
--
2.18.0
The config MTK_SMI always depends on MTK_IOMMU which is built-in
currently. Thus we don't have module_exit before. This patch adds
module_exit and module_license. It is a preparing patch for supporting
MTK_SMI could been built as a module.
Signed-off-by: Yong Wu <[email protected]>
---
drivers/memory/mtk-smi.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index e2aebd2bfa8e..aa2a25abf04f 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -597,3 +597,13 @@ static int __init mtk_smi_init(void)
return platform_register_drivers(smidrivers, ARRAY_SIZE(smidrivers));
}
module_init(mtk_smi_init);
+
+static void __exit mtk_smi_exit(void)
+{
+ platform_unregister_drivers(smidrivers, ARRAY_SIZE(smidrivers));
+}
+module_exit(mtk_smi_exit);
+
+MODULE_DESCRIPTION("MediaTek SMI driver");
+MODULE_ALIAS("platform:MediaTek-SMI");
+MODULE_LICENSE("GPL v2");
--
2.18.0
This patch switches MTK_SMI to tristate. Support it could be 'm'.
Meanwhile, Fix a build issue while MTK_SMI is built as module.
Signed-off-by: Yong Wu <[email protected]>
---
This patch has a little conflict with the mt8192 iommu patch which
delete the MTK_LARB_NR_MAX in smi.h(It's still reviewing).
This patch rebase on the clean v5.11-rc1.
---
drivers/memory/Kconfig | 2 +-
include/soc/mediatek/smi.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index 3ea6913df176..d5f0f4680880 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -173,7 +173,7 @@ config JZ4780_NEMC
memory devices such as NAND and SRAM.
config MTK_SMI
- bool "Mediatek SoC Memory Controller driver" if COMPILE_TEST
+ tristate "Mediatek SoC Memory Controller driver" if COMPILE_TEST
depends on ARCH_MEDIATEK || COMPILE_TEST
help
This driver is for the Memory Controller module in MediaTek SoCs,
diff --git a/include/soc/mediatek/smi.h b/include/soc/mediatek/smi.h
index 5a34b87d89e3..29e2fb8f33d6 100644
--- a/include/soc/mediatek/smi.h
+++ b/include/soc/mediatek/smi.h
@@ -9,7 +9,7 @@
#include <linux/bitops.h>
#include <linux/device.h>
-#ifdef CONFIG_MTK_SMI
+#if IS_ENABLED(CONFIG_MTK_SMI)
#define MTK_LARB_NR_MAX 16
--
2.18.0
On Thu, Jan 21, 2021 at 02:24:27PM +0800, Yong Wu wrote:
> In this file, we have 2 drivers, smi-common and smi-larb.
> Use platform_register_drivers.
>
> Signed-off-by: Yong Wu <[email protected]>
> ---
> drivers/memory/mtk-smi.c | 25 ++++++-------------------
> 1 file changed, 6 insertions(+), 19 deletions(-)
Thanks, applied.
Best regards,
Krzysztof
On Thu, Jan 21, 2021 at 02:24:28PM +0800, Yong Wu wrote:
> The config MTK_SMI always depends on MTK_IOMMU which is built-in
> currently. Thus we don't have module_exit before. This patch adds
> module_exit and module_license. It is a preparing patch for supporting
> MTK_SMI could been built as a module.
>
> Signed-off-by: Yong Wu <[email protected]>
> ---
> drivers/memory/mtk-smi.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> index e2aebd2bfa8e..aa2a25abf04f 100644
> --- a/drivers/memory/mtk-smi.c
> +++ b/drivers/memory/mtk-smi.c
> @@ -597,3 +597,13 @@ static int __init mtk_smi_init(void)
> return platform_register_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> }
> module_init(mtk_smi_init);
> +
> +static void __exit mtk_smi_exit(void)
> +{
> + platform_unregister_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> +}
> +module_exit(mtk_smi_exit);
> +
> +MODULE_DESCRIPTION("MediaTek SMI driver");
> +MODULE_ALIAS("platform:MediaTek-SMI");
Drivers do not use capital letters, so I have doubts whether this alias
is correct.
Adding all these should be squashed with changing Kconfig into tristate.
It does not have sense on its own.
Best regards,
Krzysztof
On Thu, Jan 21, 2021 at 02:24:29PM +0800, Yong Wu wrote:
> This patch switches MTK_SMI to tristate. Support it could be 'm'.
>
> Meanwhile, Fix a build issue while MTK_SMI is built as module.
s/Fix/fix.
What error is being fixed here? How can I reproduce it? Aren't you just
adjusting it to being buildable by module?
Best regards,
Krzysztof
>
> Signed-off-by: Yong Wu <[email protected]>
> ---
> This patch has a little conflict with the mt8192 iommu patch which
> delete the MTK_LARB_NR_MAX in smi.h(It's still reviewing).
> This patch rebase on the clean v5.11-rc1.
> ---
> drivers/memory/Kconfig | 2 +-
> include/soc/mediatek/smi.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
> index 3ea6913df176..d5f0f4680880 100644
> --- a/drivers/memory/Kconfig
> +++ b/drivers/memory/Kconfig
> @@ -173,7 +173,7 @@ config JZ4780_NEMC
> memory devices such as NAND and SRAM.
>
> config MTK_SMI
> - bool "Mediatek SoC Memory Controller driver" if COMPILE_TEST
> + tristate "Mediatek SoC Memory Controller driver" if COMPILE_TEST
> depends on ARCH_MEDIATEK || COMPILE_TEST
> help
> This driver is for the Memory Controller module in MediaTek SoCs,
> diff --git a/include/soc/mediatek/smi.h b/include/soc/mediatek/smi.h
> index 5a34b87d89e3..29e2fb8f33d6 100644
> --- a/include/soc/mediatek/smi.h
> +++ b/include/soc/mediatek/smi.h
> @@ -9,7 +9,7 @@
> #include <linux/bitops.h>
> #include <linux/device.h>
>
> -#ifdef CONFIG_MTK_SMI
> +#if IS_ENABLED(CONFIG_MTK_SMI)
On Fri, 2021-01-22 at 22:35 +0100, Krzysztof Kozlowski wrote:
> On Thu, Jan 21, 2021 at 02:24:29PM +0800, Yong Wu wrote:
> > This patch switches MTK_SMI to tristate. Support it could be 'm'.
> >
> > Meanwhile, Fix a build issue while MTK_SMI is built as module.
>
> s/Fix/fix.
>
> What error is being fixed here? How can I reproduce it? Aren't you just
> adjusting it to being buildable by module?
Sorry, I didn't copy the fail log here. This is the build log:
In file included from .../drivers/iommu/mtk_iommu.c:34:0:
.../drivers/iommu/mtk_iommu.h:84:28: error: array type has incomplete
element type 'struct mtk_smi_larb_iommu'
struct mtk_smi_larb_iommu larb_imu[MTK_LARB_NR_MAX];
Our iommu driver will use this structure. but it was contained by
"#ifdef CONFIG_MTK_SMI". thus I change it to "#if
IS_ENABLED(CONFIG_MTK_SMI)"
If reproducing it, we should change mtk-iommu to module_init[1]. and
switch kconfig MTK_IOMMU to tristate, then change the CONFIG_MTK_IOMMU
to m. we could get the fail log.
In this case, Should I squash this change into this patch? I though this
is a preparing patch and the fail is caused by MTK_SMI. thus I squash
that into this patch. or change it as a independent patch and send when
I change MTK_IOMMU to tristate?
[1]
https://lore.kernel.org/linux-mediatek/[email protected]/
>
> Best regards,
> Krzysztof
>
>
> >
> > Signed-off-by: Yong Wu <[email protected]>
> > ---
> > This patch has a little conflict with the mt8192 iommu patch which
> > delete the MTK_LARB_NR_MAX in smi.h(It's still reviewing).
> > This patch rebase on the clean v5.11-rc1.
> > ---
> > drivers/memory/Kconfig | 2 +-
> > include/soc/mediatek/smi.h | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
> > index 3ea6913df176..d5f0f4680880 100644
> > --- a/drivers/memory/Kconfig
> > +++ b/drivers/memory/Kconfig
> > @@ -173,7 +173,7 @@ config JZ4780_NEMC
> > memory devices such as NAND and SRAM.
> >
> > config MTK_SMI
> > - bool "Mediatek SoC Memory Controller driver" if COMPILE_TEST
> > + tristate "Mediatek SoC Memory Controller driver" if COMPILE_TEST
> > depends on ARCH_MEDIATEK || COMPILE_TEST
> > help
> > This driver is for the Memory Controller module in MediaTek SoCs,
> > diff --git a/include/soc/mediatek/smi.h b/include/soc/mediatek/smi.h
> > index 5a34b87d89e3..29e2fb8f33d6 100644
> > --- a/include/soc/mediatek/smi.h
> > +++ b/include/soc/mediatek/smi.h
> > @@ -9,7 +9,7 @@
> > #include <linux/bitops.h>
> > #include <linux/device.h>
> >
> > -#ifdef CONFIG_MTK_SMI
> > +#if IS_ENABLED(CONFIG_MTK_SMI)
On Fri, 2021-01-22 at 22:34 +0100, Krzysztof Kozlowski wrote:
> On Thu, Jan 21, 2021 at 02:24:28PM +0800, Yong Wu wrote:
> > The config MTK_SMI always depends on MTK_IOMMU which is built-in
> > currently. Thus we don't have module_exit before. This patch adds
> > module_exit and module_license. It is a preparing patch for supporting
> > MTK_SMI could been built as a module.
> >
> > Signed-off-by: Yong Wu <[email protected]>
> > ---
> > drivers/memory/mtk-smi.c | 10 ++++++++++
> > 1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> > index e2aebd2bfa8e..aa2a25abf04f 100644
> > --- a/drivers/memory/mtk-smi.c
> > +++ b/drivers/memory/mtk-smi.c
> > @@ -597,3 +597,13 @@ static int __init mtk_smi_init(void)
> > return platform_register_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> > }
> > module_init(mtk_smi_init);
> > +
> > +static void __exit mtk_smi_exit(void)
> > +{
> > + platform_unregister_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> > +}
> > +module_exit(mtk_smi_exit);
> > +
> > +MODULE_DESCRIPTION("MediaTek SMI driver");
> > +MODULE_ALIAS("platform:MediaTek-SMI");
>
> Drivers do not use capital letters, so I have doubts whether this alias
> is correct.
I didn't care the upper/lower-case. I will change to lower case in next
time.
MODULE_ALIAS("platform:MediaTek-smi")
>
> Adding all these should be squashed with changing Kconfig into tristate.
> It does not have sense on its own.
Thanks very much for review.
Only confirm: Squash whole this patch or only squash the MODULE_x into
the next patch?
>
> Best regards,
> Krzysztof
On Mon, Jan 25, 2021 at 02:49:41PM +0800, Yong Wu wrote:
> On Fri, 2021-01-22 at 22:34 +0100, Krzysztof Kozlowski wrote:
> > On Thu, Jan 21, 2021 at 02:24:28PM +0800, Yong Wu wrote:
> > > The config MTK_SMI always depends on MTK_IOMMU which is built-in
> > > currently. Thus we don't have module_exit before. This patch adds
> > > module_exit and module_license. It is a preparing patch for supporting
> > > MTK_SMI could been built as a module.
> > >
> > > Signed-off-by: Yong Wu <[email protected]>
> > > ---
> > > drivers/memory/mtk-smi.c | 10 ++++++++++
> > > 1 file changed, 10 insertions(+)
> > >
> > > diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> > > index e2aebd2bfa8e..aa2a25abf04f 100644
> > > --- a/drivers/memory/mtk-smi.c
> > > +++ b/drivers/memory/mtk-smi.c
> > > @@ -597,3 +597,13 @@ static int __init mtk_smi_init(void)
> > > return platform_register_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> > > }
> > > module_init(mtk_smi_init);
> > > +
> > > +static void __exit mtk_smi_exit(void)
> > > +{
> > > + platform_unregister_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> > > +}
> > > +module_exit(mtk_smi_exit);
> > > +
> > > +MODULE_DESCRIPTION("MediaTek SMI driver");
> > > +MODULE_ALIAS("platform:MediaTek-SMI");
> >
> > Drivers do not use capital letters, so I have doubts whether this alias
> > is correct.
>
> I didn't care the upper/lower-case. I will change to lower case in next
> time.
Then why do you need the alias? The name does not match driver name, so
what's the purpose of this alias/
>
> MODULE_ALIAS("platform:MediaTek-smi")
>
> >
> > Adding all these should be squashed with changing Kconfig into tristate.
> > It does not have sense on its own.
>
> Thanks very much for review.
>
> Only confirm: Squash whole this patch or only squash the MODULE_x into
> the next patch?
This entire patch 2/3 should be with 3/3.
Best regards,
Krzysztof
On Mon, 2021-01-25 at 09:40 +0100, Krzysztof Kozlowski wrote:
> On Mon, Jan 25, 2021 at 02:49:41PM +0800, Yong Wu wrote:
> > On Fri, 2021-01-22 at 22:34 +0100, Krzysztof Kozlowski wrote:
> > > On Thu, Jan 21, 2021 at 02:24:28PM +0800, Yong Wu wrote:
> > > > The config MTK_SMI always depends on MTK_IOMMU which is built-in
> > > > currently. Thus we don't have module_exit before. This patch adds
> > > > module_exit and module_license. It is a preparing patch for supporting
> > > > MTK_SMI could been built as a module.
> > > >
> > > > Signed-off-by: Yong Wu <[email protected]>
> > > > ---
> > > > drivers/memory/mtk-smi.c | 10 ++++++++++
> > > > 1 file changed, 10 insertions(+)
> > > >
> > > > diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> > > > index e2aebd2bfa8e..aa2a25abf04f 100644
> > > > --- a/drivers/memory/mtk-smi.c
> > > > +++ b/drivers/memory/mtk-smi.c
> > > > @@ -597,3 +597,13 @@ static int __init mtk_smi_init(void)
> > > > return platform_register_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> > > > }
> > > > module_init(mtk_smi_init);
> > > > +
> > > > +static void __exit mtk_smi_exit(void)
> > > > +{
> > > > + platform_unregister_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> > > > +}
> > > > +module_exit(mtk_smi_exit);
> > > > +
> > > > +MODULE_DESCRIPTION("MediaTek SMI driver");
> > > > +MODULE_ALIAS("platform:MediaTek-SMI");
> > >
> > > Drivers do not use capital letters, so I have doubts whether this alias
> > > is correct.
> >
> > I didn't care the upper/lower-case. I will change to lower case in next
> > time.
>
> Then why do you need the alias? The name does not match driver name, so
> what's the purpose of this alias/
I think it is not so necessary for us. I will delete this line in next
version.
Only curious what's alias is fit in our case? normally it should be the
file name: mtk-smi?
>
> >
> > MODULE_ALIAS("platform:MediaTek-smi")
> >
> > >
> > > Adding all these should be squashed with changing Kconfig into tristate.
> > > It does not have sense on its own.
> >
> > Thanks very much for review.
> >
> > Only confirm: Squash whole this patch or only squash the MODULE_x into
> > the next patch?
>
> This entire patch 2/3 should be with 3/3.
Thanks for the confirm.
>
> Best regards,
> Krzysztof
On Mon, Jan 25, 2021 at 05:28:05PM +0800, Yong Wu wrote:
> On Mon, 2021-01-25 at 09:40 +0100, Krzysztof Kozlowski wrote:
> > On Mon, Jan 25, 2021 at 02:49:41PM +0800, Yong Wu wrote:
> > > On Fri, 2021-01-22 at 22:34 +0100, Krzysztof Kozlowski wrote:
> > > > On Thu, Jan 21, 2021 at 02:24:28PM +0800, Yong Wu wrote:
> > > > > The config MTK_SMI always depends on MTK_IOMMU which is built-in
> > > > > currently. Thus we don't have module_exit before. This patch adds
> > > > > module_exit and module_license. It is a preparing patch for supporting
> > > > > MTK_SMI could been built as a module.
> > > > >
> > > > > Signed-off-by: Yong Wu <[email protected]>
> > > > > ---
> > > > > drivers/memory/mtk-smi.c | 10 ++++++++++
> > > > > 1 file changed, 10 insertions(+)
> > > > >
> > > > > diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> > > > > index e2aebd2bfa8e..aa2a25abf04f 100644
> > > > > --- a/drivers/memory/mtk-smi.c
> > > > > +++ b/drivers/memory/mtk-smi.c
> > > > > @@ -597,3 +597,13 @@ static int __init mtk_smi_init(void)
> > > > > return platform_register_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> > > > > }
> > > > > module_init(mtk_smi_init);
> > > > > +
> > > > > +static void __exit mtk_smi_exit(void)
> > > > > +{
> > > > > + platform_unregister_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> > > > > +}
> > > > > +module_exit(mtk_smi_exit);
> > > > > +
> > > > > +MODULE_DESCRIPTION("MediaTek SMI driver");
> > > > > +MODULE_ALIAS("platform:MediaTek-SMI");
> > > >
> > > > Drivers do not use capital letters, so I have doubts whether this alias
> > > > is correct.
> > >
> > > I didn't care the upper/lower-case. I will change to lower case in next
> > > time.
> >
> > Then why do you need the alias? The name does not match driver name, so
> > what's the purpose of this alias/
>
> I think it is not so necessary for us. I will delete this line in next
> version.
>
> Only curious what's alias is fit in our case? normally it should be the
> file name: mtk-smi?
If autoloading of your module works, then remove it. The alias is
necessary for some cases when a device table is missing (e.g. platform
driver is matched via devicetree but not having the platform_device_id
table) or matching is done via different method (e.g. driver is matched
from MFD via devicetree compatible even though there is a
platform_device_id table).
Best regards,
Krzysztof
On Mon, 2021-01-25 at 09:44 +0100, Krzysztof Kozlowski wrote:
> On Mon, Jan 25, 2021 at 02:49:44PM +0800, Yong Wu wrote:
> > On Fri, 2021-01-22 at 22:35 +0100, Krzysztof Kozlowski wrote:
> > > On Thu, Jan 21, 2021 at 02:24:29PM +0800, Yong Wu wrote:
> > > > This patch switches MTK_SMI to tristate. Support it could be 'm'.
> > > >
> > > > Meanwhile, Fix a build issue while MTK_SMI is built as module.
> > >
> > > s/Fix/fix.
> > >
> > > What error is being fixed here? How can I reproduce it? Aren't you just
> > > adjusting it to being buildable by module?
> >
> > Sorry, I didn't copy the fail log here. This is the build log:
> >
> > In file included from .../drivers/iommu/mtk_iommu.c:34:0:
> > .../drivers/iommu/mtk_iommu.h:84:28: error: array type has incomplete
> > element type 'struct mtk_smi_larb_iommu'
> > struct mtk_smi_larb_iommu larb_imu[MTK_LARB_NR_MAX];
> >
> > Our iommu driver will use this structure. but it was contained by
> > "#ifdef CONFIG_MTK_SMI". thus I change it to "#if
> > IS_ENABLED(CONFIG_MTK_SMI)"
> >
> > If reproducing it, we should change mtk-iommu to module_init[1]. and
> > switch kconfig MTK_IOMMU to tristate, then change the CONFIG_MTK_IOMMU
> > to m. we could get the fail log.
> >
> > In this case, Should I squash this change into this patch? I though this
> > is a preparing patch and the fail is caused by MTK_SMI. thus I squash
> > that into this patch. or change it as a independent patch and send when
> > I change MTK_IOMMU to tristate?
>
> If I understand correctly, there is no error before this patch. In such
> case just don't mention the error to fix, because it is simply part of
> making things modular.
Yes. No error before this patch.
Appreciate for your help. I will remove this in the comment message in
the next version.
>
> Best regards,
> Krzysztof
>
On Mon, Jan 25, 2021 at 02:49:44PM +0800, Yong Wu wrote:
> On Fri, 2021-01-22 at 22:35 +0100, Krzysztof Kozlowski wrote:
> > On Thu, Jan 21, 2021 at 02:24:29PM +0800, Yong Wu wrote:
> > > This patch switches MTK_SMI to tristate. Support it could be 'm'.
> > >
> > > Meanwhile, Fix a build issue while MTK_SMI is built as module.
> >
> > s/Fix/fix.
> >
> > What error is being fixed here? How can I reproduce it? Aren't you just
> > adjusting it to being buildable by module?
>
> Sorry, I didn't copy the fail log here. This is the build log:
>
> In file included from .../drivers/iommu/mtk_iommu.c:34:0:
> .../drivers/iommu/mtk_iommu.h:84:28: error: array type has incomplete
> element type 'struct mtk_smi_larb_iommu'
> struct mtk_smi_larb_iommu larb_imu[MTK_LARB_NR_MAX];
>
> Our iommu driver will use this structure. but it was contained by
> "#ifdef CONFIG_MTK_SMI". thus I change it to "#if
> IS_ENABLED(CONFIG_MTK_SMI)"
>
> If reproducing it, we should change mtk-iommu to module_init[1]. and
> switch kconfig MTK_IOMMU to tristate, then change the CONFIG_MTK_IOMMU
> to m. we could get the fail log.
>
> In this case, Should I squash this change into this patch? I though this
> is a preparing patch and the fail is caused by MTK_SMI. thus I squash
> that into this patch. or change it as a independent patch and send when
> I change MTK_IOMMU to tristate?
If I understand correctly, there is no error before this patch. In such
case just don't mention the error to fix, because it is simply part of
making things modular.
Best regards,
Krzysztof
On Mon, 2021-01-25 at 11:40 +0100, Krzysztof Kozlowski wrote:
> On Mon, Jan 25, 2021 at 05:28:05PM +0800, Yong Wu wrote:
> > On Mon, 2021-01-25 at 09:40 +0100, Krzysztof Kozlowski wrote:
> > > On Mon, Jan 25, 2021 at 02:49:41PM +0800, Yong Wu wrote:
> > > > On Fri, 2021-01-22 at 22:34 +0100, Krzysztof Kozlowski wrote:
> > > > > On Thu, Jan 21, 2021 at 02:24:28PM +0800, Yong Wu wrote:
> > > > > > The config MTK_SMI always depends on MTK_IOMMU which is built-in
> > > > > > currently. Thus we don't have module_exit before. This patch adds
> > > > > > module_exit and module_license. It is a preparing patch for supporting
> > > > > > MTK_SMI could been built as a module.
> > > > > >
> > > > > > Signed-off-by: Yong Wu <[email protected]>
> > > > > > ---
> > > > > > drivers/memory/mtk-smi.c | 10 ++++++++++
> > > > > > 1 file changed, 10 insertions(+)
> > > > > >
> > > > > > diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> > > > > > index e2aebd2bfa8e..aa2a25abf04f 100644
> > > > > > --- a/drivers/memory/mtk-smi.c
> > > > > > +++ b/drivers/memory/mtk-smi.c
> > > > > > @@ -597,3 +597,13 @@ static int __init mtk_smi_init(void)
> > > > > > return platform_register_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> > > > > > }
> > > > > > module_init(mtk_smi_init);
> > > > > > +
> > > > > > +static void __exit mtk_smi_exit(void)
> > > > > > +{
> > > > > > + platform_unregister_drivers(smidrivers, ARRAY_SIZE(smidrivers));
> > > > > > +}
> > > > > > +module_exit(mtk_smi_exit);
> > > > > > +
> > > > > > +MODULE_DESCRIPTION("MediaTek SMI driver");
> > > > > > +MODULE_ALIAS("platform:MediaTek-SMI");
> > > > >
> > > > > Drivers do not use capital letters, so I have doubts whether this alias
> > > > > is correct.
> > > >
> > > > I didn't care the upper/lower-case. I will change to lower case in next
> > > > time.
> > >
> > > Then why do you need the alias? The name does not match driver name, so
> > > what's the purpose of this alias/
> >
> > I think it is not so necessary for us. I will delete this line in next
> > version.
> >
> > Only curious what's alias is fit in our case? normally it should be the
> > file name: mtk-smi?
>
> If autoloading of your module works, then remove it. The alias is
> necessary for some cases when a device table is missing (e.g. platform
> driver is matched via devicetree but not having the platform_device_id
> table) or matching is done via different method (e.g. driver is matched
> from MFD via devicetree compatible even though there is a
> platform_device_id table).
Thanks for explaination so detailly. v2 is sent just now.
>
> Best regards,
> Krzysztof