diff --git a/arch/arm/src/at32/at32_rtc_lowerhalf.c b/arch/arm/src/at32/at32_rtc_lowerhalf.c index b23e1861159f6..b9eb5974c856c 100644 --- a/arch/arm/src/at32/at32_rtc_lowerhalf.c +++ b/arch/arm/src/at32/at32_rtc_lowerhalf.c @@ -511,6 +511,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower, struct tm time; time_t seconds; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -522,7 +523,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); /* Get the current time in broken out format */ @@ -552,7 +553,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower, ret = at32_setalarm(lower, &setalarm); } - sched_unlock(); + leave_critical_section(flags); } return ret; @@ -565,6 +566,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower, #endif struct timespec ts; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0); priv = (struct at32_lowerhalf_s *)lower; @@ -575,7 +577,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); /* Get the current time in seconds */ @@ -585,7 +587,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower, ret = up_rtc_getdatetime(&time); if (ret < 0) { - sched_unlock(); + leave_critical_section(flags); return ret; } @@ -598,7 +600,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower, ret = up_rtc_gettime(&ts); if (ret < 0) { - sched_unlock(); + leave_critical_section(flags); return ret; } #else @@ -629,7 +631,7 @@ static int at32_setrelative(struct rtc_lowerhalf_s *lower, cbinfo->priv = NULL; } - sched_unlock(); + leave_critical_section(flags); } return ret; @@ -734,6 +736,7 @@ static int at32_rdalarm(struct rtc_lowerhalf_s *lower, { struct alm_rdalarm_s lowerinfo; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -744,14 +747,14 @@ static int at32_rdalarm(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); lowerinfo.ar_id = alarminfo->id; lowerinfo.ar_time = alarminfo->time; ret = at32_rtc_rdalarm(&lowerinfo); - sched_unlock(); + leave_critical_section(flags); } return ret; diff --git a/arch/arm/src/cxd56xx/cxd56_rtc_lowerhalf.c b/arch/arm/src/cxd56xx/cxd56_rtc_lowerhalf.c index abfc7a7e2e041..618427d3f3a7c 100644 --- a/arch/arm/src/cxd56xx/cxd56_rtc_lowerhalf.c +++ b/arch/arm/src/cxd56xx/cxd56_rtc_lowerhalf.c @@ -361,6 +361,7 @@ static int cxd56_setrelative(struct rtc_lowerhalf_s *lower, struct timespec ts; time_t seconds; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL); DEBUGASSERT((RTC_ALARM0 <= alarminfo->id) && @@ -372,7 +373,7 @@ static int cxd56_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); #if defined(CONFIG_RTC_HIRES) /* Get the higher resolution time */ @@ -380,7 +381,7 @@ static int cxd56_setrelative(struct rtc_lowerhalf_s *lower, ret = up_rtc_gettime(&ts); if (ret < 0) { - sched_unlock(); + leave_critical_section(flags); return ret; } #else @@ -406,7 +407,7 @@ static int cxd56_setrelative(struct rtc_lowerhalf_s *lower, ret = cxd56_setalarm(lower, &setalarm); - sched_unlock(); + leave_critical_section(flags); } return ret; diff --git a/arch/arm/src/kinetis/kinetis_rtc_lowerhalf.c b/arch/arm/src/kinetis/kinetis_rtc_lowerhalf.c index 65676fcf59fa1..ef596268ad65a 100644 --- a/arch/arm/src/kinetis/kinetis_rtc_lowerhalf.c +++ b/arch/arm/src/kinetis/kinetis_rtc_lowerhalf.c @@ -363,6 +363,7 @@ kinetis_setrelative(struct rtc_lowerhalf_s *lower, time_t seconds; struct timespec ts; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA); @@ -374,7 +375,7 @@ kinetis_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); #if defined(CONFIG_RTC_DATETIME) /* Get the broken out time and convert to seconds */ @@ -382,7 +383,7 @@ kinetis_setrelative(struct rtc_lowerhalf_s *lower, ret = up_rtc_getdatetime(&time); if (ret < 0) { - sched_unlock(); + leave_critical_section(flags); return ret; } @@ -394,7 +395,7 @@ kinetis_setrelative(struct rtc_lowerhalf_s *lower, ret = up_rtc_gettime(&ts); if (ret < 0) { - sched_unlock(); + leave_critical_section(flags); return ret; } #endif @@ -421,7 +422,7 @@ kinetis_setrelative(struct rtc_lowerhalf_s *lower, ret = kinetis_setalarm(lower, &setalarm); - sched_unlock(); + leave_critical_section(flags); } return ret; @@ -498,6 +499,7 @@ static int kinetis_rdalarm(struct rtc_lowerhalf_s *lower, { struct timespec ts; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA); @@ -508,12 +510,12 @@ static int kinetis_rdalarm(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); ret = kinetis_rtc_rdalarm(&ts); localtime_r((const time_t *)&ts.tv_sec, (struct tm *)alarminfo->time); - sched_unlock(); + leave_critical_section(flags); } return ret; diff --git a/arch/arm/src/lpc54xx/lpc54_rtc_lowerhalf.c b/arch/arm/src/lpc54xx/lpc54_rtc_lowerhalf.c index 51ef847136a84..2a91635b1b107 100644 --- a/arch/arm/src/lpc54xx/lpc54_rtc_lowerhalf.c +++ b/arch/arm/src/lpc54xx/lpc54_rtc_lowerhalf.c @@ -365,6 +365,7 @@ static int lpc54_setrelative(struct rtc_lowerhalf_s *lower, struct lpc54_cbinfo_s *cbinfo; struct timespec ts; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0); priv = (struct lpc54_lowerhalf_s *)lower; @@ -375,7 +376,7 @@ static int lpc54_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); /* Get the current time in seconds */ @@ -403,7 +404,7 @@ static int lpc54_setrelative(struct rtc_lowerhalf_s *lower, cbinfo->priv = NULL; } - sched_unlock(); + leave_critical_section(flags); } return ret; diff --git a/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c b/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c index 2f8c993c798ce..c9e855629e87a 100644 --- a/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c +++ b/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c @@ -430,6 +430,7 @@ static int max326_setrelative(struct rtc_lowerhalf_s *lower, #endif struct timespec ts; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0); priv = (struct max326_lowerhalf_s *)lower; @@ -440,7 +441,7 @@ static int max326_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); /* Get the current time in seconds */ @@ -450,7 +451,7 @@ static int max326_setrelative(struct rtc_lowerhalf_s *lower, ret = up_rtc_getdatetime(&time); if (ret < 0) { - sched_unlock(); + leave_critical_section(flags); return ret; } @@ -463,7 +464,7 @@ static int max326_setrelative(struct rtc_lowerhalf_s *lower, ret = up_rtc_gettime(&ts); if (ret < 0) { - sched_unlock(); + leave_critical_section(flags); return ret; } #else @@ -494,7 +495,7 @@ static int max326_setrelative(struct rtc_lowerhalf_s *lower, cbinfo->priv = NULL; } - sched_unlock(); + leave_critical_section(flags); } return ret; diff --git a/arch/arm/src/stm32/stm32_rtc_lowerhalf.c b/arch/arm/src/stm32/stm32_rtc_lowerhalf.c index 0f277c8fc86d7..2daa841299321 100644 --- a/arch/arm/src/stm32/stm32_rtc_lowerhalf.c +++ b/arch/arm/src/stm32/stm32_rtc_lowerhalf.c @@ -515,6 +515,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, struct tm time; time_t seconds; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -526,7 +527,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); /* Get the current time in broken out format */ @@ -556,7 +557,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, ret = stm32_setalarm(lower, &setalarm); } - sched_unlock(); + leave_critical_section(flags); } return ret; @@ -569,6 +570,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, #endif struct timespec ts; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0); priv = (struct stm32_lowerhalf_s *)lower; @@ -579,7 +581,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); /* Get the current time in seconds */ @@ -589,7 +591,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, ret = up_rtc_getdatetime(&time); if (ret < 0) { - sched_unlock(); + leave_critical_section(flags); return ret; } @@ -602,7 +604,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, ret = up_rtc_gettime(&ts); if (ret < 0) { - sched_unlock(); + leave_critical_section(flags); return ret; } #else @@ -633,7 +635,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, cbinfo->priv = NULL; } - sched_unlock(); + leave_critical_section(flags); } return ret; @@ -738,6 +740,7 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower, { struct alm_rdalarm_s lowerinfo; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -748,14 +751,14 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); lowerinfo.ar_id = alarminfo->id; lowerinfo.ar_time = alarminfo->time; ret = stm32_rtc_rdalarm(&lowerinfo); - sched_unlock(); + leave_critical_section(flags); } return ret; diff --git a/arch/arm/src/stm32f7/stm32_rtc_lowerhalf.c b/arch/arm/src/stm32f7/stm32_rtc_lowerhalf.c index af26ba0a1f7c3..6f7c88b995bee 100644 --- a/arch/arm/src/stm32f7/stm32_rtc_lowerhalf.c +++ b/arch/arm/src/stm32f7/stm32_rtc_lowerhalf.c @@ -433,6 +433,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, struct tm time; time_t seconds; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -444,7 +445,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); /* Get the current time in broken out format */ @@ -474,7 +475,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, ret = stm32_setalarm(lower, &setalarm); } - sched_unlock(); + leave_critical_section(flags); } return ret; @@ -558,6 +559,7 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower, { struct alm_rdalarm_s lowerinfo; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -568,14 +570,14 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); lowerinfo.ar_id = alarminfo->id; lowerinfo.ar_time = alarminfo->time; ret = stm32_rtc_rdalarm(&lowerinfo); - sched_unlock(); + leave_critical_section(flags); } return ret; diff --git a/arch/arm/src/stm32h7/stm32_rtc_lowerhalf.c b/arch/arm/src/stm32h7/stm32_rtc_lowerhalf.c index 490c4df83f36a..6eeecf314eb5e 100644 --- a/arch/arm/src/stm32h7/stm32_rtc_lowerhalf.c +++ b/arch/arm/src/stm32h7/stm32_rtc_lowerhalf.c @@ -434,6 +434,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, struct tm time; time_t seconds; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -445,7 +446,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); /* Get the current time in broken out format */ @@ -475,7 +476,7 @@ static int stm32_setrelative(struct rtc_lowerhalf_s *lower, ret = stm32_setalarm(lower, &setalarm); } - sched_unlock(); + leave_critical_section(flags); } return ret; @@ -559,6 +560,7 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower, { struct alm_rdalarm_s lowerinfo; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -569,14 +571,14 @@ static int stm32_rdalarm(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); lowerinfo.ar_id = alarminfo->id; lowerinfo.ar_time = alarminfo->time; ret = stm32_rtc_rdalarm(&lowerinfo); - sched_unlock(); + leave_critical_section(flags); } return ret; diff --git a/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c b/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c index 70275bfabab89..a56201a6d2623 100644 --- a/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c +++ b/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c @@ -399,6 +399,7 @@ stm32l4_setrelative(struct rtc_lowerhalf_s *lower, struct tm time; time_t seconds; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -410,7 +411,7 @@ stm32l4_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); /* Get the current time in broken out format */ @@ -440,7 +441,7 @@ stm32l4_setrelative(struct rtc_lowerhalf_s *lower, ret = stm32l4_setalarm(lower, &setalarm); } - sched_unlock(); + leave_critical_section(flags); } return ret; @@ -525,6 +526,7 @@ static int stm32l4_rdalarm(struct rtc_lowerhalf_s *lower, { struct alm_rdalarm_s lowerinfo; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -535,14 +537,14 @@ static int stm32l4_rdalarm(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); lowerinfo.ar_id = alarminfo->id; lowerinfo.ar_time = alarminfo->time; ret = stm32l4_rtc_rdalarm(&lowerinfo); - sched_unlock(); + leave_critical_section(flags); } return ret; diff --git a/arch/arm/src/stm32wb/stm32wb_rtc_lowerhalf.c b/arch/arm/src/stm32wb/stm32wb_rtc_lowerhalf.c index d5e582e9025aa..fd2b51cb74120 100644 --- a/arch/arm/src/stm32wb/stm32wb_rtc_lowerhalf.c +++ b/arch/arm/src/stm32wb/stm32wb_rtc_lowerhalf.c @@ -398,6 +398,7 @@ stm32wb_setrelative(struct rtc_lowerhalf_s *lower, struct tm time; time_t seconds; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -409,7 +410,7 @@ stm32wb_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); /* Get the current time in broken out format */ @@ -439,7 +440,7 @@ stm32wb_setrelative(struct rtc_lowerhalf_s *lower, ret = stm32wb_setalarm(lower, &setalarm); } - sched_unlock(); + leave_critical_section(flags); } return ret; @@ -523,6 +524,7 @@ static int stm32wb_rdalarm(struct rtc_lowerhalf_s *lower, { struct alm_rdalarm_s lowerinfo; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL); DEBUGASSERT(alarminfo->id == RTC_ALARMA || alarminfo->id == RTC_ALARMB); @@ -533,14 +535,14 @@ static int stm32wb_rdalarm(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); lowerinfo.ar_id = alarminfo->id; lowerinfo.ar_time = alarminfo->time; ret = stm32wb_rtc_rdalarm(&lowerinfo); - sched_unlock(); + leave_critical_section(flags); } return ret; diff --git a/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c b/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c index 05d269427ab67..af8eca502122a 100644 --- a/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c +++ b/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c @@ -416,6 +416,7 @@ static int rx65n_setrelative(struct rtc_lowerhalf_s *lower, struct timespec rtc_time; time_t seconds; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL); @@ -425,7 +426,7 @@ static int rx65n_setrelative(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); #if defined(CONFIG_RTC_DATETIME) /* Get the broken out time and convert to seconds */ @@ -434,7 +435,7 @@ static int rx65n_setrelative(struct rtc_lowerhalf_s *lower, ret = up_rtc_getdatetime(&time); if (ret < 0) { - sched_unlock(); + leave_critical_section(flags); return ret; } @@ -478,7 +479,7 @@ static int rx65n_setrelative(struct rtc_lowerhalf_s *lower, /* Remember the callback information */ - sched_unlock(); + leave_critical_section(flags); } return ret; @@ -546,6 +547,7 @@ static int rx65n_rdalarm(struct rtc_lowerhalf_s *lower, { struct alm_rdalarm_s lowerinfo; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL); if (alarminfo->id >= 0) @@ -554,14 +556,14 @@ static int rx65n_rdalarm(struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); lowerinfo.ar_id = alarminfo->id; lowerinfo.ar_time = alarminfo->time; ret = rx65n_rtc_rdalarm(&lowerinfo); - sched_unlock(); + leave_critical_section(flags); } return ret; diff --git a/arch/z80/src/ez80/ez80_rtc_lowerhalf.c b/arch/z80/src/ez80/ez80_rtc_lowerhalf.c index daba8401efde5..dfec0a29843be 100644 --- a/arch/z80/src/ez80/ez80_rtc_lowerhalf.c +++ b/arch/z80/src/ez80/ez80_rtc_lowerhalf.c @@ -405,6 +405,7 @@ static int ez80_setrelative(FAR struct rtc_lowerhalf_s *lower, struct tm time; time_t seconds; int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->id == 0); @@ -412,7 +413,7 @@ static int ez80_setrelative(FAR struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); /* Get the current time in broken out format */ @@ -441,7 +442,7 @@ static int ez80_setrelative(FAR struct rtc_lowerhalf_s *lower, ret = ez80_setalarm(lower, &setalarm); } - sched_unlock(); + leave_critical_section(flags); return ret; } #endif @@ -516,6 +517,7 @@ static int ez80_rdalarm(FAR struct rtc_lowerhalf_s *lower, FAR struct lower_rdalarm_s *alarminfo) { int ret = -EINVAL; + irqstate_t flags; DEBUGASSERT(lower != NULL && alarminfo != NULL && alarminfo->time != NULL && alarminfo->id == 0); @@ -524,9 +526,9 @@ static int ez80_rdalarm(FAR struct rtc_lowerhalf_s *lower, * about being suspended and working on an old time. */ - sched_lock(); + flags = enter_critical_section(); ret = ez80_rtc_rdalarm((FAR struct tm *)alarminfo->time); - sched_unlock(); + leave_critical_section(flags); return ret; }