From 6b06669e2a11c80fbf951b07126ca5d748df70bd Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Tue, 26 Jul 2016 08:33:32 +0100 Subject: hwclock: clarify cmos inb and outb preprocessor directives The cmos only works when architecture is i386, x86_64, or alpha. Reviewed-by: J William Piggott Signed-off-by: Sami Kerola --- sys-utils/hwclock-cmos.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'sys-utils/hwclock-cmos.c') diff --git a/sys-utils/hwclock-cmos.c b/sys-utils/hwclock-cmos.c index 284077eb8..ee293daec 100644 --- a/sys-utils/hwclock-cmos.c +++ b/sys-utils/hwclock-cmos.c @@ -56,29 +56,26 @@ #include "nls.h" #include "pathnames.h" +/* for inb, outb */ #if defined(__i386__) || defined(__x86_64__) # ifdef HAVE_SYS_IO_H # include # elif defined(HAVE_ASM_IO_H) -# include /* for inb, outb */ +# include # else -/* - * Disable cmos access; we can no longer use asm/io.h, since the kernel does - * not export that header. - */ -#undef __i386__ -#undef __x86_64__ -void outb(int a __attribute__ ((__unused__)), - int b __attribute__ ((__unused__))) +# undef __i386__ +# undef __x86_64__ +# warning "disable cmos access - no sys/io.h or asm/io.h" +void outb(int a __attribute__((__unused__)), + int b __attribute__((__unused__))) { } -int inb(int c __attribute__ ((__unused__))) +int inb(int c __attribute__((__unused__))) { return 0; } -#endif /* __i386__ __x86_64__ */ - +# endif /* __i386__ __x86_64__ */ #elif defined(__alpha__) # ifdef HAVE_SYS_IO_H # include @@ -88,17 +85,18 @@ extern unsigned int inb(unsigned long port); extern void outb(unsigned char b, unsigned long port); extern int iopl(int level); # endif -#else -static void outb(int a __attribute__ ((__unused__)), - int b __attribute__ ((__unused__))) +#else /* __alpha__ */ +# warning "disable cmos access - not i386, x86_64, or alpha" +static void outb(int a __attribute__((__unused__)), + int b __attribute__((__unused__))) { } -static int inb(int c __attribute__ ((__unused__))) +static int inb(int c __attribute__((__unused__))) { return 0; } -#endif /* __alpha__ */ +#endif /* for inb, outb */ #include "hwclock.h" -- cgit v1.2.3-55-g7522