All of lore.kernel.org
 help / color / mirror / Atom feed
* [Help]Dedicated thread for each block partition?
@ 2011-07-04  2:20 柏均 葉
  2011-07-04  8:57 ` Arnaud Mouiche
  0 siblings, 1 reply; 2+ messages in thread
From: 柏均 葉 @ 2011-07-04  2:20 UTC (permalink / raw)
  To: linux-mtd


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.
 		 	   		  

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

* Re: [Help]Dedicated thread for each block partition?
  2011-07-04  2:20 [Help]Dedicated thread for each block partition? 柏均 葉
@ 2011-07-04  8:57 ` Arnaud Mouiche
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaud Mouiche @ 2011-07-04  8:57 UTC (permalink / raw)
  To: linux-mtd

Hello,

Getting the same issue in the past with 2.6.35, I suggest to get a look 
at the commit 008c751ec78587dd9b48bb62d4b10d616554fea2 from upstream, 
which I cherry-pick to fix my issue.

There is multiple thread in this mailing list describing the problem in 
the past.

regards,
arnaud

On 07/04/2011 04:20 AM, 柏均 葉 wrote:
> 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.
>   		 	   		
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2011-07-04  8:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-04  2:20 [Help]Dedicated thread for each block partition? 柏均 葉
2011-07-04  8:57 ` Arnaud Mouiche

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.