drivers: rtc: set 'rtc_driver_api' as 'static const'

This change marks each instance of the 'rtc_driver_api' as 'static const'.
The rationale is that 'rtc_driver_api' is used for declaring internal
module interfaces and is not intended to be modified at runtime.
By using 'static const', we ensure immutability, leading to usage of only
.rodata and a reduction in the .data area.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This commit is contained in:
Pisit Sawangvonganan 2023-12-25 00:10:03 +07:00 committed by Fabio Baltieri
commit 250d50e8b6
6 changed files with 6 additions and 6 deletions

View file

@ -461,7 +461,7 @@ static int rtc_emul_get_calibration(const struct device *dev, int32_t *calibrati
} }
#endif /* CONFIG_RTC_CALIBRATION */ #endif /* CONFIG_RTC_CALIBRATION */
struct rtc_driver_api rtc_emul_driver_api = { static const struct rtc_driver_api rtc_emul_driver_api = {
.set_time = rtc_emul_set_time, .set_time = rtc_emul_set_time,
.get_time = rtc_emul_get_time, .get_time = rtc_emul_get_time,
#ifdef CONFIG_RTC_ALARM #ifdef CONFIG_RTC_ALARM

View file

@ -70,7 +70,7 @@ static void fake_rtc_reset_rule_before(const struct ztest_unit_test *test, void
ZTEST_RULE(fake_rtc_reset_rule, fake_rtc_reset_rule_before, NULL); ZTEST_RULE(fake_rtc_reset_rule, fake_rtc_reset_rule_before, NULL);
#endif /* CONFIG_ZTEST */ #endif /* CONFIG_ZTEST */
struct rtc_driver_api rtc_fake_driver_api = { static const struct rtc_driver_api rtc_fake_driver_api = {
.set_time = rtc_fake_set_time, .set_time = rtc_fake_set_time,
.get_time = rtc_fake_get_time, .get_time = rtc_fake_get_time,
#ifdef CONFIG_RTC_ALARM #ifdef CONFIG_RTC_ALARM

View file

@ -390,7 +390,7 @@ static int rtc_stm32_get_calibration(const struct device *dev, int32_t *calibrat
#endif #endif
#endif /* CONFIG_RTC_CALIBRATION */ #endif /* CONFIG_RTC_CALIBRATION */
struct rtc_driver_api rtc_stm32_driver_api = { static const struct rtc_driver_api rtc_stm32_driver_api = {
.set_time = rtc_stm32_set_time, .set_time = rtc_stm32_set_time,
.get_time = rtc_stm32_get_time, .get_time = rtc_stm32_get_time,
/* RTC_ALARM not supported */ /* RTC_ALARM not supported */

View file

@ -495,7 +495,7 @@ static void rtc_mc146818_isr(const struct device *dev)
#endif #endif
} }
struct rtc_driver_api rtc_mc146818_driver_api = { static const struct rtc_driver_api rtc_mc146818_driver_api = {
.set_time = rtc_mc146818_set_time, .set_time = rtc_mc146818_set_time,
.get_time = rtc_mc146818_get_time, .get_time = rtc_mc146818_get_time,
#if defined(CONFIG_RTC_ALARM) #if defined(CONFIG_RTC_ALARM)

View file

@ -645,7 +645,7 @@ static int rtc_sam_get_calibration(const struct device *dev, int32_t *calibratio
} }
#endif /* CONFIG_RTC_CALIBRATION */ #endif /* CONFIG_RTC_CALIBRATION */
static struct rtc_driver_api rtc_sam_driver_api = { static const struct rtc_driver_api rtc_sam_driver_api = {
.set_time = rtc_sam_set_time, .set_time = rtc_sam_set_time,
.get_time = rtc_sam_get_time, .get_time = rtc_sam_get_time,
#ifdef CONFIG_RTC_ALARM #ifdef CONFIG_RTC_ALARM

View file

@ -561,7 +561,7 @@ static int rtc_smartbond_update_set_callback(const struct device *dev, rtc_updat
} }
#endif #endif
struct rtc_driver_api rtc_smartbond_driver_api = { static const struct rtc_driver_api rtc_smartbond_driver_api = {
.get_time = rtc_smartbond_get_time, .get_time = rtc_smartbond_get_time,
.set_time = rtc_smartbond_set_time, .set_time = rtc_smartbond_set_time,
#if defined(CONFIG_RTC_ALARM) #if defined(CONFIG_RTC_ALARM)