aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorXiaojuan Yang <yangxiaojuan@loongson.cn>2022-07-01 17:34:02 +0800
committerRichard Henderson <richard.henderson@linaro.org>2022-07-04 11:08:58 +0530
commit582788c3fbce95d9c43e30a7d806ee02eb1c13d0 (patch)
tree00380714f3b93c89eb828ef17d6b1dfea6eee377 /hw
parent6935f132e595a03eb023b5e9a0703509b3f0c2a1 (diff)
downloadqemu-582788c3fbce95d9c43e30a7d806ee02eb1c13d0.zip
qemu-582788c3fbce95d9c43e30a7d806ee02eb1c13d0.tar.gz
qemu-582788c3fbce95d9c43e30a7d806ee02eb1c13d0.tar.bz2
hw/rtc/ls7a_rtc: Use tm struct pointer as arguments in toy_time_to_val()
Use pointer as arguments in toy_time_to_val() instead of struct tm. Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220701093407.2150607-7-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/rtc/ls7a_rtc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/rtc/ls7a_rtc.c b/hw/rtc/ls7a_rtc.c
index a36aeea..85cd2d2 100644
--- a/hw/rtc/ls7a_rtc.c
+++ b/hw/rtc/ls7a_rtc.c
@@ -125,15 +125,15 @@ static inline void toy_val_to_time_year(uint64_t toy_year, struct tm *tm)
}
/* parse struct tm to toy value */
-static inline uint64_t toy_time_to_val_mon(struct tm tm)
+static inline uint64_t toy_time_to_val_mon(struct tm *tm)
{
uint64_t val = 0;
- val = FIELD_DP32(val, TOY, MON, tm.tm_mon + 1);
- val = FIELD_DP32(val, TOY, DAY, tm.tm_mday);
- val = FIELD_DP32(val, TOY, HOUR, tm.tm_hour);
- val = FIELD_DP32(val, TOY, MIN, tm.tm_min);
- val = FIELD_DP32(val, TOY, SEC, tm.tm_sec);
+ val = FIELD_DP32(val, TOY, MON, tm->tm_mon + 1);
+ val = FIELD_DP32(val, TOY, DAY, tm->tm_mday);
+ val = FIELD_DP32(val, TOY, HOUR, tm->tm_hour);
+ val = FIELD_DP32(val, TOY, MIN, tm->tm_min);
+ val = FIELD_DP32(val, TOY, SEC, tm->tm_sec);
return val;
}
@@ -235,7 +235,7 @@ static uint64_t ls7a_rtc_read(void *opaque, hwaddr addr, unsigned size)
case SYS_TOYREAD0:
if (toy_enabled(s)) {
qemu_get_timedate(&tm, s->offset_toy);
- val = toy_time_to_val_mon(tm);
+ val = toy_time_to_val_mon(&tm);
} else {
/* return 0 when toy disabled */
val = 0;