Skip to contentSkip to conversation

clk: analogbits: Allow building the library as a module

PATCH Applied Samuel Holland 2 participants 4 messages Jul 25, 2023 – Oct 24, 2023

Subsystems (4)
lore
Share & tools
lore

Samuel Holland

author maintainer
#0 lore raw

PATCH v2 1/2 clk: analogbits: Allow building the library as a module

This library is only used by the SiFive PRCI driver. When that driver is built as a module, it makes sense to build this library as a module too.

---

Changes in v2:
- Add MODULE_AUTHOR and MODULE_DESCRIPTION

 drivers/clk/analogbits/Kconfig          | 2 +-
 drivers/clk/analogbits/wrpll-cln28hpc.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/clk/analogbits/Kconfig +1 -1
index 1e291b185438..7d73db0fcd49 100644
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config CLK_ANALOGBITS_WRPLL_CLN28HPC
-	bool
+	tristate
drivers/clk/analogbits/wrpll-cln28hpc.c +8 -0
index 09ca82356399..65d422a588e1 100644
@@ -28,6 +28,7 @@
 #include <linux/math64.h>
 #include <linux/math.h>
 #include <linux/minmax.h>
+#include <linux/module.h>
 
 #include <linux/clk/analogbits-wrpll-cln28hpc.h>
 
@@ -312,6 +313,7 @@ int wrpll_configure_for_rate(struct wrpll_cfg *c, u32 target_rate,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(wrpll_configure_for_rate);
 
 /**
  * wrpll_calc_output_rate() - calculate the PLL's target output rate
@@ -349,6 +351,7 @@ unsigned long wrpll_calc_output_rate(const struct wrpll_cfg *c,
 
 	return n;
 }
+EXPORT_SYMBOL_GPL(wrpll_calc_output_rate);
 
 /**
  * wrpll_calc_max_lock_us() - return the time for the PLL to lock
@@ -366,3 +369,8 @@ unsigned int wrpll_calc_max_lock_us(const struct wrpll_cfg *c)
 {
 	return MAX_LOCK_US;
 }
+EXPORT_SYMBOL_GPL(wrpll_calc_max_lock_us);
+
+MODULE_AUTHOR("Paul Walmsley <[email protected]>");
+MODULE_DESCRIPTION("Analog Bits Wide-Range PLL library");
+MODULE_LICENSE("GPL");
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH v2 2/2 clk: sifive: Allow building the driver as a module

This can reduce the kernel image size in multiplatform configurations.

---

Changes in v2:
- Add MODULE_AUTHOR and MODULE_DESCRIPTION

 drivers/clk/sifive/Kconfig       |  2 +-
 drivers/clk/sifive/sifive-prci.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/clk/sifive/Kconfig +1 -1
index 2322f634a910..49597d95602e 100644
@@ -10,7 +10,7 @@ menuconfig CLK_SIFIVE
 if CLK_SIFIVE
 
 config CLK_SIFIVE_PRCI
-	bool "PRCI driver for SiFive SoCs"
+	tristate "PRCI driver for SiFive SoCs"
 	default ARCH_SIFIVE
 	select RESET_CONTROLLER
 	select RESET_SIMPLE
drivers/clk/sifive/sifive-prci.c +5 -5
index e317f3454e93..09a76248a710 100644
@@ -7,6 +7,7 @@
 #include <linux/clkdev.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <linux/of_device.h>
 #include "sifive-prci.h"
 #include "fu540-prci.h"
@@ -618,9 +619,8 @@ static struct platform_driver sifive_prci_driver = {
 	},
 	.probe = sifive_prci_probe,
 };
+module_platform_driver(sifive_prci_driver);
 
-static int __init sifive_prci_init(void)
-{
-	return platform_driver_register(&sifive_prci_driver);
-}
-core_initcall(sifive_prci_init);
+MODULE_AUTHOR("Paul Walmsley <[email protected]>");
+MODULE_DESCRIPTION("SiFive Power Reset Clock Interface (PRCI) driver");
+MODULE_LICENSE("GPL");
Signature · 7 lines
2.40.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
maintainer Applied
#2 lore raw

Re: [PATCH v2 2/2] clk: sifive: Allow building the driver as a module

Quoting Samuel Holland (2023-07-24 17:42:48)

Quoted 4 lines

This can reduce the kernel image size in multiplatform configurations.

---

Applied to clk-next