|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/vRTC: use available macros for BCD <-> BIN conversion
commit c780db53fa9451d05001360ca8c7aa8303893b05
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Jun 30 09:39:45 2026 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jun 30 09:39:45 2026 +0200
x86/vRTC: use available macros for BCD <-> BIN conversion
There's no need to open-code these. No functional change intended, even if
the | changes to + in to_bcd().
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
xen/arch/x86/hvm/rtc.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c
index e33a8ec108..4ba5881b24 100644
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -247,18 +247,18 @@ static void cf_check rtc_update_timer2(void *opaque)
static unsigned int to_bcd(const RTCState *s, unsigned int a)
{
- if ( s->hw.cmos_data[RTC_REG_B] & RTC_DM_BINARY )
- return a;
+ if ( !(s->hw.cmos_data[RTC_REG_B] & RTC_DM_BINARY) )
+ BIN_TO_BCD(a);
- return ((a / 10) << 4) | (a % 10);
+ return a;
}
static unsigned int from_bcd(const RTCState *s, unsigned int a)
{
- if ( s->hw.cmos_data[RTC_REG_B] & RTC_DM_BINARY )
- return a;
+ if ( !(s->hw.cmos_data[RTC_REG_B] & RTC_DM_BINARY) )
+ BCD_TO_BIN(a);
- return ((a >> 4) * 10) + (a & 0x0f);
+ return a;
}
/*
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |