linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Failure in re-load module
       [not found] <mailman.2847.1223488861.3127.linuxppc-embedded@ozlabs.org>
@ 2008-10-08 22:51 ` Duy-Ky Nguyen
  2008-10-08 22:54   ` Scott Wood
  0 siblings, 1 reply; 2+ messages in thread
From: Duy-Ky Nguyen @ 2008-10-08 22:51 UTC (permalink / raw)
  To: linuxppc-embedded; +Cc: v.selvamuthukumar

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 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Failure in re-load module
  2008-10-08 22:51 ` Failure in re-load module Duy-Ky Nguyen
@ 2008-10-08 22:54   ` Scott Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Scott Wood @ 2008-10-08 22:54 UTC (permalink / raw)
  To: Duy-Ky Nguyen; +Cc: v.selvamuthukumar, linuxppc-embedded

Duy-Ky Nguyen wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-08 22:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2847.1223488861.3127.linuxppc-embedded@ozlabs.org>
2008-10-08 22:51 ` Failure in re-load module Duy-Ky Nguyen
2008-10-08 22:54   ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).