[PATCH RFC 02/10] rtc: prepare for struct device member groups becoming a constant array

From: Heiner Kallweit

Date: Tue Feb 17 2026 - 17:27:17 EST


This prepares for making struct device member groups a constant array.
The assignment groups = rtc->dev.groups would result in a "discarding
const qualifier" warning with this change.
No functional change intended.

Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx>
---
drivers/rtc/sysfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/sysfs.c b/drivers/rtc/sysfs.c
index 4ab05e105a7..ae5e1252b4c 100644
--- a/drivers/rtc/sysfs.c
+++ b/drivers/rtc/sysfs.c
@@ -308,7 +308,7 @@ const struct attribute_group **rtc_get_dev_attribute_groups(void)
int rtc_add_groups(struct rtc_device *rtc, const struct attribute_group **grps)
{
size_t old_cnt = 0, add_cnt = 0, new_cnt;
- const struct attribute_group **groups, **old;
+ const struct attribute_group **groups, *const *old;

if (grps) {
for (groups = grps; *groups; groups++)
@@ -320,9 +320,9 @@ int rtc_add_groups(struct rtc_device *rtc, const struct attribute_group **grps)
return -EINVAL;
}

- groups = rtc->dev.groups;
- if (groups)
- for (; *groups; groups++)
+ old = rtc->dev.groups;
+ if (old)
+ while (*old++)
old_cnt++;

new_cnt = old_cnt + add_cnt + 1;
--
2.53.0