]> git.hungrycats.org Git - linux/commitdiff
annotate HPET driver memory-mapped PCI usage
authorLinus Torvalds <torvalds@evo.osdl.org>
Sun, 12 Sep 2004 03:47:59 +0000 (20:47 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 12 Sep 2004 03:47:59 +0000 (20:47 -0700)
arch/i386/kernel/time_hpet.c
drivers/char/hpet.c
include/linux/hpet.h

index 0ec677d9e1a3aa31b9dc49356813366dcc64bb3a..52fc526618c031c133303f3e555c5294cf9eab17 100644 (file)
@@ -29,7 +29,7 @@ unsigned long hpet_address;   /* hpet memory map physical address */
 
 static int use_hpet;           /* can be used for runtime check of hpet */
 static int boot_hpet_disable;  /* boottime override for HPET timer */
-static unsigned long hpet_virt_address;        /* hpet kernel virtual address */
+static void __iomem * hpet_virt_address;       /* hpet kernel virtual address */
 
 #define FSEC_TO_USEC (1000000000UL)
 
@@ -76,8 +76,7 @@ int __init hpet_enable(void)
        if (!hpet_address) {
                return -1;
        }
-       hpet_virt_address = (unsigned long) ioremap_nocache(hpet_address,
-                                                           HPET_MMAP_SIZE);
+       hpet_virt_address = ioremap_nocache(hpet_address, HPET_MMAP_SIZE);
        /*
         * Read the period, compute tick and quotient.
         */
@@ -162,11 +161,11 @@ int __init hpet_enable(void)
                hd.hd_irq[0] = HPET_LEGACY_8254;
                hd.hd_irq[1] = HPET_LEGACY_RTC;
                if (ntimer > 2) {
-                       struct hpet             *hpet;
-                       struct hpet_timer       *timer;
+                       struct hpet __iomem     *hpet;
+                       struct hpet_timer __iomem *timer;
                        int                     i;
 
-                       hpet = (struct hpet *) hpet_virt_address;
+                       hpet = hpet_virt_address;
 
                        for (i = 2, timer = &hpet->hpet_timers[2]; i < ntimer;
                                timer++, i++)
index dc0a6a67fa45265dc0ac94f7b688b1b5629d9743..8f3f9128674d92f910e2965a954602154ef61a4c 100644 (file)
@@ -60,8 +60,8 @@ static spinlock_t hpet_task_lock = SPIN_LOCK_UNLOCKED;
 
 struct hpet_dev {
        struct hpets *hd_hpets;
-       struct hpet *hd_hpet;
-       struct hpet_timer *hd_timer;
+       struct hpet __iomem *hd_hpet;
+       struct hpet_timer __iomem *hd_timer;
        unsigned long hd_ireqfreq;
        unsigned long hd_irqdata;
        wait_queue_head_t hd_waitqueue;
@@ -75,7 +75,7 @@ struct hpet_dev {
 
 struct hpets {
        struct hpets *hp_next;
-       struct hpet *hp_hpet;
+       struct hpet __iomem *hp_hpet;
        unsigned long hp_period;
        unsigned long hp_delta;
        unsigned int hp_ntimer;
@@ -98,14 +98,14 @@ static struct hpets *hpets;
 #endif
 
 #ifndef readq
-static unsigned long long __inline readq(void *addr)
+static unsigned long long __inline readq(void __iomem *addr)
 {
        return readl(addr) | (((unsigned long long)readl(addr + 4)) << 32LL);
 }
 #endif
 
 #ifndef writeq
-static void __inline writeq(unsigned long long v, void *addr)
+static void __inline writeq(unsigned long long v, void __iomem *addr)
 {
        writel(v & 0xffffffff, addr);
        writel(v >> 32, addr + 4);
@@ -300,7 +300,7 @@ static int hpet_fasync(int fd, struct file *file, int on)
 static int hpet_release(struct inode *inode, struct file *file)
 {
        struct hpet_dev *devp;
-       struct hpet_timer *timer;
+       struct hpet_timer __iomem *timer;
        int irq = 0;
 
        devp = file->private_data;
@@ -352,8 +352,8 @@ hpet_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 
 static int hpet_ioctl_ieon(struct hpet_dev *devp)
 {
-       struct hpet_timer *timer;
-       struct hpet *hpet;
+       struct hpet_timer __iomem *timer;
+       struct hpet __iomem *hpet;
        struct hpets *hpetp;
        int irq;
        unsigned long g, v, t, m;
@@ -435,8 +435,8 @@ static inline unsigned long hpet_time_div(unsigned long dis)
 static int
 hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
 {
-       struct hpet_timer *timer;
-       struct hpet *hpet;
+       struct hpet_timer __iomem *timer;
+       struct hpet __iomem *hpet;
        struct hpets *hpetp;
        int err;
        unsigned long v;
@@ -547,7 +547,7 @@ int hpet_register(struct hpet_task *tp, int periodic)
 {
        unsigned int i;
        u64 mask;
-       struct hpet_timer *timer;
+       struct hpet_timer __iomem *timer;
        struct hpet_dev *devp;
        struct hpets *hpetp;
 
@@ -615,7 +615,7 @@ static inline int hpet_tpcheck(struct hpet_task *tp)
 int hpet_unregister(struct hpet_task *tp)
 {
        struct hpet_dev *devp;
-       struct hpet_timer *timer;
+       struct hpet_timer __iomem *timer;
        int err;
 
        if ((err = hpet_tpcheck(tp)))
@@ -714,11 +714,11 @@ static struct ctl_table_header *sysctl_header;
 
 static unsigned long __init hpet_calibrate(struct hpets *hpetp)
 {
-       struct hpet_timer *timer = NULL;
+       struct hpet_timer __iomem *timer = NULL;
        unsigned long t, m, count, i, flags, start;
        struct hpet_dev *devp;
        int j;
-       struct hpet *hpet;
+       struct hpet __iomem *hpet;
 
        for (j = 0, devp = hpetp->hp_dev; j < hpetp->hp_ntimer; j++, devp++)
                if ((devp->hd_flags & HPET_OPEN) == 0) {
@@ -756,7 +756,7 @@ int __init hpet_alloc(struct hpet_data *hdp)
        u32 i, ntimer;
        struct hpets *hpetp;
        size_t siz;
-       struct hpet *hpet;
+       struct hpet __iomem *hpet;
        static struct hpets *last __initdata = (struct hpets *)0;
        unsigned long ns;
 
@@ -766,7 +766,7 @@ int __init hpet_alloc(struct hpet_data *hdp)
         * ACPI also reports hpet, then we catch it here.
         */
        for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next)
-               if (hpetp->hp_hpet == (struct hpet *)(hdp->hd_address))
+               if (hpetp->hp_hpet == hdp->hd_address)
                        return 0;
 
        siz = sizeof(struct hpets) + ((hdp->hd_nirqs - 1) *
@@ -780,7 +780,7 @@ int __init hpet_alloc(struct hpet_data *hdp)
        memset(hpetp, 0, siz);
 
        hpetp->hp_which = hpet_nhpet++;
-       hpetp->hp_hpet = (struct hpet *)hdp->hd_address;
+       hpetp->hp_hpet = hdp->hd_address;
 
        hpetp->hp_ntimer = hdp->hd_nirqs;
 
@@ -832,7 +832,7 @@ int __init hpet_alloc(struct hpet_data *hdp)
        for (i = 0, devp = hpetp->hp_dev; i < hpetp->hp_ntimer;
             i++, hpet_ntimer++, devp++) {
                unsigned long v;
-               struct hpet_timer *timer;
+               struct hpet_timer __iomem *timer;
 
                timer = &hpet->hpet_timers[devp - hpetp->hp_dev];
                v = readq(&timer->hpet_config);
@@ -873,11 +873,10 @@ static acpi_status __init hpet_resources(struct acpi_resource *res, void *data)
                unsigned long size;
 
                size = addr.max_address_range - addr.min_address_range + 1;
-               hdp->hd_address =
-                   (unsigned long)ioremap(addr.min_address_range, size);
+               hdp->hd_address = ioremap(addr.min_address_range, size);
 
                for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next)
-                       if (hpetp->hp_hpet == (struct hpet *)(hdp->hd_address))
+                       if (hpetp->hp_hpet == hdp->hd_address)
                                return -EBUSY;
        } else if (res->id == ACPI_RSTYPE_EXT_IRQ) {
                struct acpi_resource_ext_irq *irqp;
index af4da7d302d88f6aa66146926507b223eb242b00..142de4a93b5b856ca08e9ec9651cf1abb373c285 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef        __HPET__
 #define        __HPET__ 1
 
+#include <linux/compiler.h>
+
 /*
  * Offsets into HPET Registers
  */
@@ -110,7 +112,7 @@ struct hpet_task {
 };
 
 struct hpet_data {
-       unsigned long hd_address;
+       void __iomem *hd_address;
        unsigned short hd_nirqs;
        unsigned short hd_flags;
        unsigned int hd_state;  /* timer allocated */