[tip:tools/kvm] kvm tools, rtc: Introduce 'struct rtc_device'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  80f81ac48228e13fe0d3e5c388cb6d73b76b8503
Gitweb:     http://git.kernel.org/tip/80f81ac48228e13fe0d3e5c388cb6d73b76b8503
Author:     Pekka Enberg <penberg@xxxxxxxxxx>
AuthorDate: Mon, 28 Nov 2011 21:02:19 +0200
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Mon, 28 Nov 2011 21:02:19 +0200

kvm tools, rtc: Introduce 'struct rtc_device'

This patch introduces a 'struct rtc_device' in preparation for implementing
missing RTC features like alarms which need auxiliary data structures.

Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/hw/rtc.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/tools/kvm/hw/rtc.c b/tools/kvm/hw/rtc.c
index c6879cc..f351e1a 100644
--- a/tools/kvm/hw/rtc.c
+++ b/tools/kvm/hw/rtc.c
@@ -5,8 +5,6 @@
 
 #include <time.h>
 
-static u8 cmos_index;
-
 #define CMOS_RTC_SECONDS		0x00
 #define CMOS_RTC_MINUTES		0x02
 #define CMOS_RTC_HOURS			0x04
@@ -14,6 +12,12 @@ static u8 cmos_index;
 #define CMOS_RTC_MONTH			0x08
 #define CMOS_RTC_YEAR			0x09
 
+struct rtc_device {
+	u8			cmos_idx;
+};
+
+static struct rtc_device	rtc;
+
 static inline unsigned char bin2bcd(unsigned val)
 {
 	return ((val / 10) << 4) + val % 10;
@@ -28,7 +32,7 @@ static bool cmos_ram_data_in(struct ioport *ioport, struct kvm *kvm, u16 port, v
 
 	tm = gmtime(&ti);
 
-	switch (cmos_index) {
+	switch (rtc.cmos_idx) {
 	case CMOS_RTC_SECONDS:
 		ioport__write8(data, bin2bcd(tm->tm_sec));
 		break;
@@ -64,13 +68,11 @@ static struct ioport_operations cmos_ram_data_ioport_ops = {
 
 static bool cmos_ram_index_out(struct ioport *ioport, struct kvm *kvm, u16 port, void *data, int size)
 {
-	u8 value;
-
-	value	= ioport__read8(data);
+	u8 value = ioport__read8(data);
 
 	kvm->nmi_disabled	= value & (1UL << 7);
 
-	cmos_index		= value & ~(1UL << 7);
+	rtc.cmos_idx		= value & ~(1UL << 7);
 
 	return true;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux