diff options
author | Tilman Sauerbeck <tilman@code-monkey.de> | 2006-07-08 19:55:53 +0200 |
---|---|---|
committer | Tilman Sauerbeck <tilman@code-monkey.de> | 2006-07-08 19:55:53 +0200 |
commit | 39b2f7b2182aedb1ab45415efb4c263012ace512 (patch) | |
tree | 9e30c2c5bbe69bc6dda6064994fe4c3ebaf20131 /hw | |
parent | 63f13e01ee6e7df1753f2113f4cff9538596be0a (diff) |
Bug #3042: Use autoconf to get the correct name of a struct member.
This allows us to remove the kernel version ifdefs from the code, which
are ugly and broken.
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_io.c | 38 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_kbd.c | 38 |
2 files changed, 10 insertions, 66 deletions
diff --git a/hw/xfree86/os-support/linux/lnx_io.c b/hw/xfree86/os-support/linux/lnx_io.c index 32f660108..eb8cd537e 100644 --- a/hw/xfree86/os-support/linux/lnx_io.c +++ b/hw/xfree86/os-support/linux/lnx_io.c @@ -67,25 +67,6 @@ xf86GetKbdLeds() return(leds); } -/* kbd rate stuff based on kbdrate.c from Rik Faith <faith@cs.unc.edu> et.al. - * from util-linux-2.9t package */ - -#include <linux/kd.h> -#include <linux/version.h> -#ifdef __sparc__ -#include <asm/param.h> -#include <asm/kbio.h> -#endif - -/* Deal with spurious kernel header change in struct kbd_repeat. - We undo this define after the routine using that struct is over, - so as not to interfere with other 'rate' elements. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# define rate period -# endif -#endif - static int KDKBDREP_ioctl_ok(int rate, int delay) { #if defined(KDKBDREP) && !defined(__sparc__) @@ -94,18 +75,18 @@ KDKBDREP_ioctl_ok(int rate, int delay) { struct kbd_repeat kbdrep_s; /* don't change, just test */ - kbdrep_s.rate = -1; + kbdrep_s.LNX_KBD_PERIOD_NAME = -1; kbdrep_s.delay = -1; if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { return 0; } /* do the change */ if (rate == 0) /* switch repeat off */ - kbdrep_s.rate = 0; + kbdrep_s.LNX_KBD_PERIOD_NAME = 0; else - kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ - if (kbdrep_s.rate < 1) - kbdrep_s.rate = 1; + kbdrep_s.LNX_KBD_PERIOD_NAME = 10000 / rate; /* convert cps to msec */ + if (kbdrep_s.LNX_KBD_PERIOD_NAME < 1) + kbdrep_s.LNX_KBD_PERIOD_NAME = 1; kbdrep_s.delay = delay; if (kbdrep_s.delay < 1) kbdrep_s.delay = 1; @@ -120,15 +101,6 @@ KDKBDREP_ioctl_ok(int rate, int delay) { #endif /* KDKBDREP */ } -#undef rate - -/* Undo the earlier define for the struct kbd_repeat problem. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# undef rate -# endif -#endif - static int KIOCSRATE_ioctl_ok(int rate, int delay) { #ifdef KIOCSRATE diff --git a/hw/xfree86/os-support/linux/lnx_kbd.c b/hw/xfree86/os-support/linux/lnx_kbd.c index 504c52710..2912f1699 100644 --- a/hw/xfree86/os-support/linux/lnx_kbd.c +++ b/hw/xfree86/os-support/linux/lnx_kbd.c @@ -97,25 +97,6 @@ GetKbdLeds(InputInfoPtr pInfo) return(leds); } -/* kbd rate stuff based on kbdrate.c from Rik Faith <faith@cs.unc.edu> et.al. - * from util-linux-2.9t package */ - -#include <linux/kd.h> -#include <linux/version.h> -#ifdef __sparc__ -#include <asm/param.h> -#include <asm/kbio.h> -#endif - -/* Deal with spurious kernel header change in struct kbd_repeat. - We undo this define after the routine using that struct is over, - so as not to interfere with other 'rate' elements. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# define rate period -# endif -#endif - static int KDKBDREP_ioctl_ok(int rate, int delay) { #if defined(KDKBDREP) && !defined(__sparc__) @@ -124,7 +105,7 @@ KDKBDREP_ioctl_ok(int rate, int delay) { struct kbd_repeat kbdrep_s; /* don't change, just test */ - kbdrep_s.rate = -1; + kbdrep_s.LNX_KBD_PERIOD_NAME = -1; kbdrep_s.delay = -1; if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { return 0; @@ -132,11 +113,11 @@ KDKBDREP_ioctl_ok(int rate, int delay) { /* do the change */ if (rate == 0) /* switch repeat off */ - kbdrep_s.rate = 0; + kbdrep_s.LNX_KBD_PERIOD_NAME = 0; else - kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ - if (kbdrep_s.rate < 1) - kbdrep_s.rate = 1; + kbdrep_s.LNX_KBD_PERIOD_NAME = 10000 / rate; /* convert cps to msec */ + if (kbdrep_s.LNX_KBD_PERIOD_NAME < 1) + kbdrep_s.LNX_KBD_PERIOD_NAME = 1; kbdrep_s.delay = delay; if (kbdrep_s.delay < 1) kbdrep_s.delay = 1; @@ -151,15 +132,6 @@ KDKBDREP_ioctl_ok(int rate, int delay) { #endif /* KDKBDREP */ } -#undef rate - -/* Undo the earlier define for the struct kbd_repeat problem. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# undef rate -# endif -#endif - static int KIOCSRATE_ioctl_ok(int rate, int delay) { #ifdef KIOCSRATE |