From: Andrew Cooper Subject: [PATCH] x86/time: Remove redundant RTC REG_B read Date: Tue, 25 Feb 2014 10:44:39 +0000 Message-ID: <1393325079-28303-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Keir Fraser , Jan Beulich List-Id: xen-devel@lists.xenproject.org RTC_ALWAYS_BCD is always defined by default, meaning that we will unconditionally enter the if statement. Reordering the condition allows short-circult evaluation to remove a redundant CMOS read. Signed-off-by: Andrew Cooper CC: Keir Fraser CC: Jan Beulich --- xen/arch/x86/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 6e31e1f..82492c1 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -661,7 +661,7 @@ static unsigned long __get_cmos_time(void) mon = CMOS_READ(RTC_MONTH); year = CMOS_READ(RTC_YEAR); - if ( !(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD ) + if ( RTC_ALWAYS_BCD || !(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) ) { BCD_TO_BIN(sec); BCD_TO_BIN(min); -- 1.7.10.4