Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 288779
b: refs/heads/master
c: b519508
h: refs/heads/master
i:
  288777: 803050f
  288775: b8ef356
v: v3
  • Loading branch information
Arjan van de Ven authored and John Stultz committed Feb 2, 2012
1 parent d00c858 commit d60dfd6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 12d6d41276def096cb3f7dc36f438db9ed6a0a8d
refs/heads/master: b519508298e0292e1771eecf14aaf67755adc39d
24 changes: 16 additions & 8 deletions trunk/drivers/clocksource/acpi_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/async.h>
#include <asm/io.h>

/*
Expand Down Expand Up @@ -179,17 +180,15 @@ static int verify_pmtmr_rate(void)
/* Number of reads we try to get two different values */
#define ACPI_PM_READ_CHECKS 10000

static int __init init_acpi_pm_clocksource(void)
static void __init acpi_pm_clocksource_async(void *unused, async_cookie_t cookie)
{
cycle_t value1, value2;
unsigned int i, j = 0;

if (!pmtmr_ioport)
return -ENODEV;

/* "verify" this timing source: */
for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) {
udelay(100 * j);
usleep_range(100 * j, 100 * j + 100);
value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
for (i = 0; i < ACPI_PM_READ_CHECKS; i++) {
value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
Expand All @@ -203,25 +202,34 @@ static int __init init_acpi_pm_clocksource(void)
" 0x%#llx, 0x%#llx - aborting.\n",
value1, value2);
pmtmr_ioport = 0;
return -EINVAL;
return;
}
if (i == ACPI_PM_READ_CHECKS) {
printk(KERN_INFO "PM-Timer failed consistency check "
" (0x%#llx) - aborting.\n", value1);
pmtmr_ioport = 0;
return -ENODEV;
return;
}
}

if (verify_pmtmr_rate() != 0){
pmtmr_ioport = 0;
return -ENODEV;
return;
}

return clocksource_register_hz(&clocksource_acpi_pm,
clocksource_register_hz(&clocksource_acpi_pm,
PMTMR_TICKS_PER_SEC);
}

static int __init init_acpi_pm_clocksource(void)
{
if (!pmtmr_ioport)
return -ENODEV;

async_schedule(acpi_pm_clocksource_async, NULL);
return 0;
}

/* We use fs_initcall because we want the PCI fixups to have run
* but we still need to load before device_initcall
*/
Expand Down

0 comments on commit d60dfd6

Please sign in to comment.