* [PATCH 1/2] nvmem: qcom-spmi-sdam: fix module autoloading
2023-01-26 13:30 [PATCH 0/2] nvmem: qcom-spmi-sdam: fix module autoloading Johan Hovold
@ 2023-01-26 13:30 ` Johan Hovold
2023-01-26 13:30 ` [PATCH 2/2] nvmem: qcom-spmi-sdam: register at device init time Johan Hovold
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Johan Hovold @ 2023-01-26 13:30 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Greg Kroah-Hartman,
linux-arm-msm, linux-kernel, Johan Hovold, stable
Add the missing module device table so that the driver can be autoloaded
when built as a module.
Fixes: 40ce9798794f ("nvmem: add QTI SDAM driver")
Cc: stable@vger.kernel.org # 5.6
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/nvmem/qcom-spmi-sdam.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvmem/qcom-spmi-sdam.c b/drivers/nvmem/qcom-spmi-sdam.c
index 4fcb63507ecd..8499892044b7 100644
--- a/drivers/nvmem/qcom-spmi-sdam.c
+++ b/drivers/nvmem/qcom-spmi-sdam.c
@@ -166,6 +166,7 @@ static const struct of_device_id sdam_match_table[] = {
{ .compatible = "qcom,spmi-sdam" },
{},
};
+MODULE_DEVICE_TABLE(of, sdam_match_table);
static struct platform_driver sdam_driver = {
.driver = {
--
2.39.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] nvmem: qcom-spmi-sdam: register at device init time
2023-01-26 13:30 [PATCH 0/2] nvmem: qcom-spmi-sdam: fix module autoloading Johan Hovold
2023-01-26 13:30 ` [PATCH 1/2] " Johan Hovold
@ 2023-01-26 13:30 ` Johan Hovold
2023-01-26 16:10 ` [PATCH 0/2] nvmem: qcom-spmi-sdam: fix module autoloading Bjorn Andersson
2023-01-27 9:30 ` Srinivas Kandagatla
3 siblings, 0 replies; 5+ messages in thread
From: Johan Hovold @ 2023-01-26 13:30 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Greg Kroah-Hartman,
linux-arm-msm, linux-kernel, Johan Hovold
There are currently no in-tree users of the Qualcomm SDAM nvmem driver
and there is generally no point in registering a driver that can be
built as a module at subsys init time.
Register the driver at the normal device init time instead and let
driver core sort out the probe order.
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/nvmem/qcom-spmi-sdam.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/nvmem/qcom-spmi-sdam.c b/drivers/nvmem/qcom-spmi-sdam.c
index 8499892044b7..f822790db49e 100644
--- a/drivers/nvmem/qcom-spmi-sdam.c
+++ b/drivers/nvmem/qcom-spmi-sdam.c
@@ -175,18 +175,7 @@ static struct platform_driver sdam_driver = {
},
.probe = sdam_probe,
};
-
-static int __init sdam_init(void)
-{
- return platform_driver_register(&sdam_driver);
-}
-subsys_initcall(sdam_init);
-
-static void __exit sdam_exit(void)
-{
- return platform_driver_unregister(&sdam_driver);
-}
-module_exit(sdam_exit);
+module_platform_driver(sdam_driver);
MODULE_DESCRIPTION("QCOM SPMI SDAM driver");
MODULE_LICENSE("GPL v2");
--
2.39.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] nvmem: qcom-spmi-sdam: fix module autoloading
2023-01-26 13:30 [PATCH 0/2] nvmem: qcom-spmi-sdam: fix module autoloading Johan Hovold
2023-01-26 13:30 ` [PATCH 1/2] " Johan Hovold
2023-01-26 13:30 ` [PATCH 2/2] nvmem: qcom-spmi-sdam: register at device init time Johan Hovold
@ 2023-01-26 16:10 ` Bjorn Andersson
2023-01-27 9:30 ` Srinivas Kandagatla
3 siblings, 0 replies; 5+ messages in thread
From: Bjorn Andersson @ 2023-01-26 16:10 UTC (permalink / raw)
To: Johan Hovold
Cc: Srinivas Kandagatla, Andy Gross, Konrad Dybcio,
Greg Kroah-Hartman, linux-arm-msm, linux-kernel
On Thu, Jan 26, 2023 at 02:30:32PM +0100, Johan Hovold wrote:
> The Qualcomm SDAM nvme driver did not have a module device table, which
> prevents userspace from autoloading the driver when built as a module.
>
> The driver was also being registered at subsys init time when built in
> despite the fact that it can also be built as a module, which makes
> little sense. There are currently no in-tree users of this driver and
> there's no reason why we can't just let driver core sort out the probe
> order.
>
> Note that this driver will be used to implement support for the PMIC RTC
> on Qualcomm platforms where the time registers are read-only (sic).
>
> Johan
>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
>
> Johan Hovold (2):
> nvmem: qcom-spmi-sdam: fix module autoloading
> nvmem: qcom-spmi-sdam: register at device init time
>
> drivers/nvmem/qcom-spmi-sdam.c | 14 ++------------
> 1 file changed, 2 insertions(+), 12 deletions(-)
>
> --
> 2.39.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] nvmem: qcom-spmi-sdam: fix module autoloading
2023-01-26 13:30 [PATCH 0/2] nvmem: qcom-spmi-sdam: fix module autoloading Johan Hovold
` (2 preceding siblings ...)
2023-01-26 16:10 ` [PATCH 0/2] nvmem: qcom-spmi-sdam: fix module autoloading Bjorn Andersson
@ 2023-01-27 9:30 ` Srinivas Kandagatla
3 siblings, 0 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2023-01-27 9:30 UTC (permalink / raw)
To: Johan Hovold
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Greg Kroah-Hartman,
linux-arm-msm, linux-kernel
On 26/01/2023 13:30, Johan Hovold wrote:
> The Qualcomm SDAM nvme driver did not have a module device table, which
> prevents userspace from autoloading the driver when built as a module.
>
> The driver was also being registered at subsys init time when built in
> despite the fact that it can also be built as a module, which makes
> little sense. There are currently no in-tree users of this driver and
> there's no reason why we can't just let driver core sort out the probe
> order.
>
> Note that this driver will be used to implement support for the PMIC RTC
> on Qualcomm platforms where the time registers are read-only (sic).
>
> Johan
>
Applied thanks,
--srin
>
> Johan Hovold (2):
> nvmem: qcom-spmi-sdam: fix module autoloading
> nvmem: qcom-spmi-sdam: register at device init time
>
> drivers/nvmem/qcom-spmi-sdam.c | 14 ++------------
> 1 file changed, 2 insertions(+), 12 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread