From 279eb7c5c0ec3f39943960557ce794e3688c3127 Mon Sep 17 00:00:00 2001 From: Philip Edelbrock Date: Sat, 5 Dec 1998 04:23:52 +0000 Subject: [PATCH] (Phil) Fixed a couple 2.1.x issues: - The schedule() and timeout issue (since 2.1.127 I think) - A syntax error in piix4 (pci func 3 sensing code Frodo wrote) git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@37 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/busses/i2c-piix4.c | 6 +++--- kernel/compat.h | 5 +++++ kernel/include/compat.h | 5 +++++ src/compat.h | 5 +++++ src/piix4.c | 6 +++--- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/kernel/busses/i2c-piix4.c b/kernel/busses/i2c-piix4.c index 8aa06bbb..aaa18d81 100644 --- a/kernel/busses/i2c-piix4.c +++ b/kernel/busses/i2c-piix4.c @@ -110,7 +110,7 @@ int piix4_setup(void) do PIIX4_dev = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, PIIX4_dev); - while(PIIX4_dev && (PCI_FUNC(PIIX4_dev->devfn) != 3); + while(PIIX4_dev && (PCI_FUNC(PIIX4_dev->devfn) != 3)); if(PIIX4_dev == NULL) { #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,1,54) */ for (i = 0; @@ -194,8 +194,8 @@ END: void piix4_do_pause( unsigned int amount ) { current->state = TASK_INTERRUPTIBLE; - current->timeout = jiffies + amount; - schedule(); + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(amount); } /* Another internally used function */ diff --git a/kernel/compat.h b/kernel/compat.h index 0c21b1de..fbf9170a 100644 --- a/kernel/compat.h +++ b/kernel/compat.h @@ -49,6 +49,11 @@ #define get_user_data(to,from) get_user(to,from) #endif +/* Add a scheduling fix for the new code in kernel 2.1.127 */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,127)) +#define schedule_timeout(x) ( current->timeout = jiffies + (x), schedule() ) +#endif + /* If the new PCI interface is not present, fall back on the old PCI BIOS interface. We also define some things to unite both interfaces. Not very nice, but it works like a charm. diff --git a/kernel/include/compat.h b/kernel/include/compat.h index 0c21b1de..fbf9170a 100644 --- a/kernel/include/compat.h +++ b/kernel/include/compat.h @@ -49,6 +49,11 @@ #define get_user_data(to,from) get_user(to,from) #endif +/* Add a scheduling fix for the new code in kernel 2.1.127 */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,127)) +#define schedule_timeout(x) ( current->timeout = jiffies + (x), schedule() ) +#endif + /* If the new PCI interface is not present, fall back on the old PCI BIOS interface. We also define some things to unite both interfaces. Not very nice, but it works like a charm. diff --git a/src/compat.h b/src/compat.h index 0c21b1de..fbf9170a 100644 --- a/src/compat.h +++ b/src/compat.h @@ -49,6 +49,11 @@ #define get_user_data(to,from) get_user(to,from) #endif +/* Add a scheduling fix for the new code in kernel 2.1.127 */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,127)) +#define schedule_timeout(x) ( current->timeout = jiffies + (x), schedule() ) +#endif + /* If the new PCI interface is not present, fall back on the old PCI BIOS interface. We also define some things to unite both interfaces. Not very nice, but it works like a charm. diff --git a/src/piix4.c b/src/piix4.c index 8aa06bbb..aaa18d81 100644 --- a/src/piix4.c +++ b/src/piix4.c @@ -110,7 +110,7 @@ int piix4_setup(void) do PIIX4_dev = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, PIIX4_dev); - while(PIIX4_dev && (PCI_FUNC(PIIX4_dev->devfn) != 3); + while(PIIX4_dev && (PCI_FUNC(PIIX4_dev->devfn) != 3)); if(PIIX4_dev == NULL) { #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,1,54) */ for (i = 0; @@ -194,8 +194,8 @@ END: void piix4_do_pause( unsigned int amount ) { current->state = TASK_INTERRUPTIBLE; - current->timeout = jiffies + amount; - schedule(); + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(amount); } /* Another internally used function */