[Help]Dedicated thread for each block partition?
柏均 葉
balado0318 at hotmail.com
Sun Jul 3 22:20:03 EDT 2011
Hi all,
Sorry for my poor English first.
I'm migrating my NAND controller driver from kernel 2.6.28 to 2.6.35.
I
encounter the weird situation in 2.6.35 that the NAND controller driver
can't be removed via rmmod because the column of "used by" in lsmod
isn't equal to 0.
I find the number of "used by" of NAND controller driver is relative to the registered partition number.
For example,
/usr # lsmod
Module Size Used by Not tainted
nand 32483 0
nand_ids 3097 1 nand
nand_ecc 3510 1 nand
mtdblock 3055 0
mtd_blkdevs 5653 1 mtdblock
mtd 17461 3 nand,mtd_blkdevs
When I insert my module into kernel, the lsmod shows as the following: (Note: I register 4 partitions in nandctl driver.)
/usr # insmod nandctl.ko
/usr # lsmod
Module Size Used by Not tainted
nandctl 12677 4
nand 32483 1 nandctl
nand_ids 3097 1 nand
nand_ecc 3510 1 nand
mtdblock 3055 4
mtd_blkdevs 5653 1 mtdblock
mtd 17461 8 ftnandc024v1_nand,nand,mtd_blkdevs
/usr # rmmod nandctl.ko
rmmod: can't unload 'nandctl': Resource temporarily unavailable
Remove the nandctl module isn't allowed due to the nonzero value of 'used by'.
========================================================
Tracing
the MTD layer and find this statement
,"__get_mtd_device(new->mtd);", in add_mtd_blktrans_dev function in
<kernel source>/driver/mtd/mtd_blkdevs.c
This function will increase the reference counter of nandctl for each partition.
Does anybody know how should I do to remove the module via rmmod in kernel 2.6.35??
Any suggestion is welcome.
More information about the linux-mtd
mailing list