Listing 4. Accessing a PCI Device's Resource Memory

/* get access to our device's memory */
location = pci_resource_start (pdev, 0);
size = pci_resource_len (pdev, 0);
ctrl->hpc_reg = ioremap(location, size);
if (!ctrl->hpc_reg) {
        err("cannot remap MMIO region %lx @ %lx\n",
            location, size);
        rc = -ENODEV;
        goto err_free_mem_region;
}

/* get the device number */
dev_num = readb(ctrl->hpc_reg + SLOT_MASK) >> 4;

/* Mask all general input interrupts */
       writel(0xFFFFFFFF, ctrl->hpc_reg + INT_MASK);

....

/* release our memory */
iounmap (ctrl->hpc_reg);