diff options
Diffstat (limited to 'drivers/clocksource/acpi_pm.c')
| -rw-r--r-- | drivers/clocksource/acpi_pm.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index 82e882028fcf..6b5cf02c35c8 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
| 24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/async.h> | ||
| 27 | #include <asm/io.h> | 26 | #include <asm/io.h> |
| 28 | 27 | ||
| 29 | /* | 28 | /* |
| @@ -180,15 +179,17 @@ static int verify_pmtmr_rate(void) | |||
| 180 | /* Number of reads we try to get two different values */ | 179 | /* Number of reads we try to get two different values */ |
| 181 | #define ACPI_PM_READ_CHECKS 10000 | 180 | #define ACPI_PM_READ_CHECKS 10000 |
| 182 | 181 | ||
| 183 | static void __init acpi_pm_clocksource_async(void *unused, async_cookie_t cookie) | 182 | static int __init init_acpi_pm_clocksource(void) |
| 184 | { | 183 | { |
| 185 | cycle_t value1, value2; | 184 | cycle_t value1, value2; |
| 186 | unsigned int i, j = 0; | 185 | unsigned int i, j = 0; |
| 187 | 186 | ||
| 187 | if (!pmtmr_ioport) | ||
| 188 | return -ENODEV; | ||
| 188 | 189 | ||
| 189 | /* "verify" this timing source: */ | 190 | /* "verify" this timing source: */ |
| 190 | for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { | 191 | for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { |
| 191 | usleep_range(100 * j, 100 * j + 100); | 192 | udelay(100 * j); |
| 192 | value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); | 193 | value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
| 193 | for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { | 194 | for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { |
| 194 | value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); | 195 | value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
| @@ -202,34 +203,25 @@ static void __init acpi_pm_clocksource_async(void *unused, async_cookie_t cookie | |||
| 202 | " 0x%#llx, 0x%#llx - aborting.\n", | 203 | " 0x%#llx, 0x%#llx - aborting.\n", |
| 203 | value1, value2); | 204 | value1, value2); |
| 204 | pmtmr_ioport = 0; | 205 | pmtmr_ioport = 0; |
| 205 | return; | 206 | return -EINVAL; |
| 206 | } | 207 | } |
| 207 | if (i == ACPI_PM_READ_CHECKS) { | 208 | if (i == ACPI_PM_READ_CHECKS) { |
| 208 | printk(KERN_INFO "PM-Timer failed consistency check " | 209 | printk(KERN_INFO "PM-Timer failed consistency check " |
| 209 | " (0x%#llx) - aborting.\n", value1); | 210 | " (0x%#llx) - aborting.\n", value1); |
| 210 | pmtmr_ioport = 0; | 211 | pmtmr_ioport = 0; |
| 211 | return; | 212 | return -ENODEV; |
| 212 | } | 213 | } |
| 213 | } | 214 | } |
| 214 | 215 | ||
| 215 | if (verify_pmtmr_rate() != 0){ | 216 | if (verify_pmtmr_rate() != 0){ |
| 216 | pmtmr_ioport = 0; | 217 | pmtmr_ioport = 0; |
| 217 | return; | 218 | return -ENODEV; |
| 218 | } | 219 | } |
| 219 | 220 | ||
| 220 | clocksource_register_hz(&clocksource_acpi_pm, | 221 | return clocksource_register_hz(&clocksource_acpi_pm, |
| 221 | PMTMR_TICKS_PER_SEC); | 222 | PMTMR_TICKS_PER_SEC); |
| 222 | } | 223 | } |
| 223 | 224 | ||
| 224 | static int __init init_acpi_pm_clocksource(void) | ||
| 225 | { | ||
| 226 | if (!pmtmr_ioport) | ||
| 227 | return -ENODEV; | ||
| 228 | |||
| 229 | async_schedule(acpi_pm_clocksource_async, NULL); | ||
| 230 | return 0; | ||
| 231 | } | ||
| 232 | |||
| 233 | /* We use fs_initcall because we want the PCI fixups to have run | 225 | /* We use fs_initcall because we want the PCI fixups to have run |
| 234 | * but we still need to load before device_initcall | 226 | * but we still need to load before device_initcall |
| 235 | */ | 227 | */ |
