[PATCH v2] rtc: amlogic-a4: Optimize global variables

Xianwei Zhao via B4 Relay posted 1 patch 2 months, 2 weeks ago
drivers/rtc/rtc-amlogic-a4.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
[PATCH v2] rtc: amlogic-a4: Optimize global variables
Posted by Xianwei Zhao via B4 Relay 2 months, 2 weeks ago
From: Xianwei Zhao <xianwei.zhao@amlogic.com>

Convert a global variable into a local one of aml_rtc_probe().

Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
Convert a global variable into a local one of aml_rtc_probe().
---
Changes in v2:
- Modify the submission description.
- Link to v1: https://lore.kernel.org/r/20250717-rtc-regmap-v1-1-ad19736ccb09@amlogic.com
---
 drivers/rtc/rtc-amlogic-a4.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/rtc/rtc-amlogic-a4.c b/drivers/rtc/rtc-amlogic-a4.c
index 09d78c2cc691..1928b29c1045 100644
--- a/drivers/rtc/rtc-amlogic-a4.c
+++ b/drivers/rtc/rtc-amlogic-a4.c
@@ -72,13 +72,6 @@ struct aml_rtc_data {
 	const struct aml_rtc_config *config;
 };
 
-static const struct regmap_config aml_rtc_regmap_config = {
-	.reg_bits = 32,
-	.val_bits = 32,
-	.reg_stride = 4,
-	.max_register = RTC_REAL_TIME,
-};
-
 static inline u32 gray_to_binary(u32 gray)
 {
 	u32 bcd = gray;
@@ -328,6 +321,13 @@ static int aml_rtc_probe(struct platform_device *pdev)
 	void __iomem *base;
 	int ret = 0;
 
+	const struct regmap_config aml_rtc_regmap_config = {
+		.reg_bits = 32,
+		.val_bits = 32,
+		.reg_stride = 4,
+		.max_register = RTC_REAL_TIME,
+	};
+
 	rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL);
 	if (!rtc)
 		return -ENOMEM;

---
base-commit: 0bafe291cb429d39b5ff70bcf7b2f3ab026dcb02
change-id: 20250717-rtc-regmap-140ee38b7bf7

Best regards,
-- 
Xianwei Zhao <xianwei.zhao@amlogic.com>
Re: [PATCH v2] rtc: amlogic-a4: Optimize global variables
Posted by Alexandre Belloni 11 hours ago
On Tue, 22 Jul 2025 19:30:48 +0800, Xianwei Zhao wrote:
> Convert a global variable into a local one of aml_rtc_probe().
> 
> 

Applied, thanks!

[1/1] rtc: amlogic-a4: Optimize global variables
      https://git.kernel.org/abelloni/c/f38bdd730914

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com