Patchwork MTD: nandsim should delete its partitions on module unload

login
register
mail settings
Submitter Kevin Cernekee
Date April 2, 2009, 11:32 p.m.
Message ID <a95a62fe0904021632l14ddb299l7818f2f2d32c20ac@mail.gmail.com>
Download mbox | patch
Permalink /patch/25548/
State New, archived
Headers show

Comments

Kevin Cernekee - April 2, 2009, 11:32 p.m.
Signed-off-by: Kevin Cernekee <kpc.mtd@gmail.com>
---
 drivers/mtd/nand/nandsim.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

 	for (i = 0;i < ARRAY_SIZE(ns->partitions); ++i)
Adrian Hunter - April 3, 2009, 6:57 a.m.
Kevin Cernekee wrote:
> Signed-off-by: Kevin Cernekee <kpc.mtd@gmail.com>
> ---
>  drivers/mtd/nand/nandsim.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
> index cd0711b..f4fda9b 100644
> --- a/drivers/mtd/nand/nandsim.c
> +++ b/drivers/mtd/nand/nandsim.c
> @@ -2349,6 +2349,7 @@ static void __exit ns_cleanup_module(void)
>  	struct nandsim *ns = (struct nandsim *)(((struct nand_chip
> *)nsmtd->priv)->priv);
>  	int i;
> 
> +	del_mtd_partitions(nsmtd);
>  	free_nandsim(ns);    /* Free nandsim private resources */
>  	nand_release(nsmtd); /* Unregister driver */
>  	for (i = 0;i < ARRAY_SIZE(ns->partitions); ++i)

Doesn't nand_release() already do that?
Artem Bityutskiy - April 3, 2009, 7:01 a.m.
On Thu, 2009-04-02 at 16:32 -0700, Kevin Cernekee wrote:
> Signed-off-by: Kevin Cernekee <kpc.mtd@gmail.com>
> ---
>  drivers/mtd/nand/nandsim.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
> index cd0711b..f4fda9b 100644
> --- a/drivers/mtd/nand/nandsim.c
> +++ b/drivers/mtd/nand/nandsim.c
> @@ -2349,6 +2349,7 @@ static void __exit ns_cleanup_module(void)
>  	struct nandsim *ns = (struct nandsim *)(((struct nand_chip
> *)nsmtd->priv)->priv);
The patch is line-wrapped.

>  	int i;
> 
> +	del_mtd_partitions(nsmtd);
>  	free_nandsim(ns);    /* Free nandsim private resources */
>  	nand_release(nsmtd); /* Unregister driver */
>  	for (i = 0;i < ARRAY_SIZE(ns->partitions); ++i)
Kevin Cernekee - April 3, 2009, 8:20 p.m.
On Thu, Apr 2, 2009 at 11:57 PM, Adrian Hunter <adrian.hunter@nokia.com> wrote:
> Doesn't nand_release() already do that?

Yes.  The problem I was seeing (attempt to reregister mtd* sysfs
entries) was caused by something else.  I retract the patch.

Thanks.

Patch

diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index cd0711b..f4fda9b 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -2349,6 +2349,7 @@  static void __exit ns_cleanup_module(void)
 	struct nandsim *ns = (struct nandsim *)(((struct nand_chip
*)nsmtd->priv)->priv);
 	int i;

+	del_mtd_partitions(nsmtd);
 	free_nandsim(ns);    /* Free nandsim private resources */
 	nand_release(nsmtd); /* Unregister driver */