Skip to contentSkip to conversation

Failure in re-load module

DISCUSSION Duy-Ky Nguyen 2 participants 2 messages Oct 8, 2008 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hello,

I'm able to load driver and access HW without any problem
In removing the driver using command "rmmod", I have error relating to virtual address from ioremap() for physical adress IMMR_BASE = 0xE0000000

Trying to free nonexistent resource <00000000c98a0000-00000000c98affff>

But the driver appears removed when I check with command "lsmod" However, I'm NOT able to load the driver again due to error

PPC: can't get I/O port address 0xe0000000
insmod: cannot insert `ppc_drv.ko': No such device (-1): No such device

It appaers to me that the memory region was not lreleased successfully

My questions are
1) What is the right sequence in requesting and releasing memory region ?
2) Are the function request_region() and release_region() obsolete in kernel 2.6 as I have no such problem with kernel 2.4 ?

I have a driver with basic code segment below ///////////////////////////// Start of code //////////////////////////////////// Init
init:
if (! request_region(PPC_BASE, PPC_SIZE, DEVICE_NAME)) {
printk(KERN_INFO "PPC: can't get I/O port address 0x%lx\n", ppc_base); return -ENODEV;
}

ppc_base = (unsigned long) ioremap(PPC_BASE, PPC_SIZE);

result = register_chrdev(major, DEVICE_NAME, &ppc_fops);

//////////////////////////// exit
exit:
unregister_chrdev(major, DEVICE_NAME);

iounmap((void __iomem *)ppc_base);
iounmap((void __iomem *)lbc_base);

release_region(ppc_base,PPC_SIZE);
release_region(lbc_base,PPC_SIZE);
////////////////////////////// End of code

Thanks so much for your time and help.

Best Regards,

Duy-Ky

#2 lore raw
Quoted 2 lines · Duy-Ky Nguyen

release_region(ppc_base,PPC_SIZE);
release_region(lbc_base,PPC_SIZE);

This should be PPC_BASE/LBC_BASE (the physical address), not ppc_base/lbc_base (the virtual address).

-Scott