[PATCH v2] hwclock: define cmos_interface only if necessary

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

 



From: Carlos Santos <unixmania@xxxxxxxxx>

Make the static declaration of the cmos_interface struct and related
functions conditional to i386/x86_64, preventing several "defined but
not used" compiler warnings.

Signed-off-by: Carlos Santos <unixmania@xxxxxxxxx>
---
 sys-utils/hwclock-cmos.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/sys-utils/hwclock-cmos.c b/sys-utils/hwclock-cmos.c
index a11f676b8..51a405f42 100644
--- a/sys-utils/hwclock-cmos.c
+++ b/sys-utils/hwclock-cmos.c
@@ -75,17 +75,6 @@ static int inb(int c __attribute__((__unused__)))
 	return 0;
 }
 # endif				/* __i386__ __x86_64__ */
-#else
-# warning "disable cmos access - not i386 or x86_64"
-static void outb(int a __attribute__((__unused__)),
-		 int b __attribute__((__unused__)))
-{
-}
-
-static int inb(int c __attribute__((__unused__)))
-{
-	return 0;
-}
 #endif				/* for inb, outb */
 
 #include "hwclock.h"
@@ -100,6 +89,8 @@ static int inb(int c __attribute__((__unused__)))
  */
 #define TM_EPOCH 1900
 
+#if defined(__i386__) || defined(__x86_64__)
+
 static unsigned short clock_ctl_addr = 0x70;
 static unsigned short clock_data_addr = 0x71;
 
@@ -360,7 +351,6 @@ static int set_hardware_clock_cmos(const struct hwclock_control *ctl
 	return 0;
 }
 
-#if defined(__i386__) || defined(__x86_64__)
 # if defined(HAVE_IOPL)
 static int i386_iopl(const int level)
 {
@@ -373,12 +363,6 @@ static int i386_iopl(const int level __attribute__ ((__unused__)))
 	return ioperm(clock_ctl_addr, 2, 1);
 }
 # endif
-#else
-static int i386_iopl(const int level __attribute__ ((__unused__)))
-{
-	return IOPL_NOT_IMPLEMENTED;
-}
-#endif
 
 static int get_permissions_cmos(void)
 {
@@ -407,6 +391,8 @@ static struct clock_ops cmos_interface = {
 	get_device_path,
 };
 
+#endif
+
 /*
  * return &cmos if cmos clock present, NULL otherwise.
  */
-- 
2.18.1




[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