HOSTADDRESS physaddr;
ulong nbytes;
void __iomem *mapped;
- BOOL requested;
};
static int mapit(struct memregion *memregion);
ulong physaddr = (ulong)(memregion->physaddr);
ulong nbytes = memregion->nbytes;
- memregion->requested = FALSE;
if (!request_mem_region(physaddr, nbytes, MYDRVNAME))
return -EBUSY;
- memregion->requested = TRUE;
memregion->mapped = ioremap_cache(physaddr, nbytes);
- if (!memregion->mapped) {
- memregion->requested = TRUE;
+ if (!memregion->mapped)
return -EFAULT;
- }
return 0;
}
static void
unmapit(struct memregion *memregion)
{
- if (memregion->mapped != NULL) {
+ if (memregion->mapped) {
iounmap(memregion->mapped);
memregion->mapped = NULL;
- }
- if (memregion->requested) {
- release_mem_region((ulong)(memregion->physaddr),
+ release_mem_region((unsigned long)memregion->physaddr,
memregion->nbytes);
- memregion->requested = FALSE;
}
}