Skip to contentSkip to conversation

Do not print RTC frequency warning if it's already ok

PATCH New Guillem Jover 1 participant 1 message Dec 23, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Do not print RTC frequency warning if it's already ok

Hi,

This is a patch for a bug reported in Debian. It now only prints the RTC frequency warning when the current value is different than the one wanted.

Patch attached.

regards,
guillem

Package: qemu
Version: 0.6.1
Author: Guillem Jover <[email protected]>
Status: not-applied
Description:
Do not print warning if the current RTC frequency is ok.

vl.c +5 -1
diff -Naur qemu-0.6.1.orig/vl.c qemu-0.6.1/vl.c
@@ -852,10 +852,14 @@
 
 static int start_rtc_timer(void)
 {
+    unsigned long current_rtc_freq = 0;
+
     rtc_fd = open("/dev/rtc", O_RDONLY);
     if (rtc_fd < 0)
         return -1;
-    if (ioctl(rtc_fd, RTC_IRQP_SET, RTC_FREQ) < 0) {
+    ioctl(rtc_fd, RTC_IRQP_READ, &current_rtc_freq);
+    if (current_rtc_freq != RTC_FREQ &&
+        ioctl(rtc_fd, RTC_IRQP_SET, RTC_FREQ) < 0) {
         fprintf(stderr, "Could not configure '/dev/rtc' to have a 1024 Hz timer. This is not a fatal\n"
                 "error, but for better emulation accuracy either use a 2.6 host Linux kernel or\n"
                 "type 'echo 1024 > /proc/sys/dev/rtc/max-user-freq' as root.\n");