[PATCH] hwclock [m68k]: unbreak FTBFS with recent (>= 2.4.18?) kernels

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

 



>From 28d695e0a5cbe446b4696a3fb381c83721163de8 Mon Sep 17 00:00:00 2001
From: Thorsten Glaser <tg@xxxxxxxxxx>
Date: Sun, 7 Nov 2010 14:00:04 +0000
Subject: [PATCH] hwclock [m68k]: unbreak FTBFS with recent (>= 2.4.18?) kernels

The old KDGHWCLK ioctl was removed from the Linux kernel quite some
time ago. The kd.c source file of hwclock contains fallback code to
handle this, but the fallback code never could have compiled or was
not fixed along other code changes. The Linux kernel nowadays igno-
res the ioctl entirely so removing it unless provided by the kernel
headers, to keep it working on very old kernels, seems the sensible
thing to do, as the comments say m68k only and deprecated (which is
correct AFAICT).

This problem was discovered in Debian/m68k and first submitted to:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578168

According to pickaxe on gitweb, it was removed in 2002:
http://git.kernel.org/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git;a=commit;h=a915e414af5fc541ff62ef0bfec847457ae650bc

Signed-off-by: Thorsten Glaser <tg@xxxxxxxxxx>
---
 AUTHORS      |    1 +
 hwclock/kd.c |   43 ++++++++++++++++++-------------------------
 2 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index d6a6a62..4284620 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -210,6 +210,7 @@ CONTRIBUTORS:
       Sven Jost <sven.jost@xxxxxxxxxxxxxx>
       Theodore Ts'o <tytso@xxxxxxx>
       Thomas Fehr <fehr@xxxxxxx>
+      Thorsten Glaser <tg@xxxxxxxxxx>
       Tilman Schmidt <tilman@xxxxxxx>
       Timo Juhani Lindfors <timo.lindfors@xxxxxx>
       Tom Prince <tom.prince@xxxxxxxxxxxx>
diff --git a/hwclock/kd.c b/hwclock/kd.c
index 3da87ca..790aad7 100644
--- a/hwclock/kd.c
+++ b/hwclock/kd.c
@@ -2,14 +2,7 @@
 
 #include "clock.h"
 
-#ifndef __m68k__
-
-struct clock_ops *
-probe_for_kd_clock() {
-	return NULL;
-}
-
-#else /* __m68k__ */
+#ifdef __m68k__
 
 #include <unistd.h>		/* for close() */
 #include <fcntl.h>		/* for O_RDONLY */
@@ -19,26 +12,26 @@ probe_for_kd_clock() {
 #include "nls.h"
 #include "usleep.h"
 
-static int con_fd = -1;		/* opened by probe_for_kd_clock() */
-				/* never closed */
-static char *con_fd_filename;	/* usually "/dev/tty1" */
-
 /* Get defines for KDGHWCLK and KDSHWCLK (m68k) */
 #include <linux/kd.h>
-#ifndef KDGHWCLK
-#define KDGHWCLK        0x4B50     /* get hardware clock */
-#define KDSHWCLK        0x4B51     /* set hardware clock */
-struct hwclk_time {
-        unsigned        sec;    /* 0..59 */
-        unsigned        min;    /* 0..59 */
-        unsigned        hour;   /* 0..23 */
-        unsigned        day;    /* 1..31 */
-        unsigned        mon;    /* 0..11 */
-        unsigned        year;   /* 70... */
-        int             wday;   /* 0..6, 0 is Sunday, -1 means unknown/don't set */
-};
+
+/* Even on m68k, if KDGHWCLK (antique) is not defined, don't build this */
+
 #endif
 
+#if !defined(__m68k__) || !defined(KDGHWCLK)
+
+struct clock_ops *
+probe_for_kd_clock() {
+	return NULL;
+}
+
+#else /* __m68k__ && KDGHWCLK */
+
+static int con_fd = -1;		/* opened by probe_for_kd_clock() */
+				/* never closed */
+static char *con_fd_filename;	/* usually "/dev/tty1" */
+
 static int
 synchronize_to_clock_tick_kd(void) {
 /*----------------------------------------------------------------------------
@@ -183,4 +176,4 @@ probe_for_kd_clock() {
 	}
 	return ret;
 }
-#endif /* __m68k__ */
+#endif /* __m68k__ && KDGHWCLK */
-- 
1.6.3.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux