#include <asm/hpet.h>
#include <asm/io.h>
-#define HPET_MASK 0xFFFFFFFF
+#define HPET_MASK CLOCKSOURCE_MASK(32)
#define HPET_SHIFT 22
/* FSEC = 10^-15 NSEC = 10^-9 */
.name = "hpet",
.rating = 250,
.read = read_hpet,
- .mask = (cycle_t)HPET_MASK,
+ .mask = HPET_MASK,
.mult = 0, /* set below */
.shift = HPET_SHIFT,
.is_continuous = 1,
unsigned long hpet_period;
void __iomem* hpet_base;
u64 tmp;
+ int err;
- if (!hpet_address)
+ if (!is_hpet_enabled())
return -ENODEV;
/* calculate the hpet address: */
do_div(tmp, FSEC_PER_NSEC);
clocksource_hpet.mult = (u32)tmp;
- return clocksource_register(&clocksource_hpet);
+ err = clocksource_register(&clocksource_hpet);
+ if (err)
+ iounmap(hpet_base);
+
+ return err;
}
module_init(init_hpet_clocksource);