On 26/07/2017 03:28, Philippe Mathieu-Daudé wrote: > On 07/25/2017 10:48 AM, Paolo Bonzini wrote: >> Test divider reset and UIP behavior. >> >> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> >> --- >> tests/rtc-test.c | 82 >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++- >> 1 file changed, 81 insertions(+), 1 deletion(-) >> >> diff --git a/tests/rtc-test.c b/tests/rtc-test.c >> index 798cf5e..d7a96cb 100644 >> --- a/tests/rtc-test.c >> +++ b/tests/rtc-test.c >> @@ -325,6 +325,30 @@ static void set_datetime_bcd(int h, int min, int >> s, int d, int m, int y) >> cmos_write(RTC_DAY_OF_MONTH, d); >> } >> > > I'm not sure why this function is in tests/ ...
Not sure I understand? >> +static void set_datetime_dec(int h, int min, int s, int d, int m, int y) >> +{ > > Following is set_time_regs() > >> + cmos_write(RTC_HOURS, h); >> + cmos_write(RTC_MINUTES, min); >> + cmos_write(RTC_SECONDS, s); > > Maybe we can use here: > > if (mode & REG_B_DM /* dec */) { > >> + cmos_write(RTC_YEAR, y % 100); >> + cmos_write(RTC_CENTURY, y / 100); > > } else /* bcd */ { > ... > } > > instead of having 2 set_datetime() Because this function does not have a "mode" argument. Paolo