[patch/rfc 2.6.29 1/2] MTD: driver model updates

David Brownell david-b at pacbell.net
Sat Apr 4 13:18:19 EDT 2009


On Friday 03 April 2009, Kevin Cernekee wrote:
> @@ -413,6 +590,12 @@ done:
> 
>  static int __init init_mtd(void)
>  {
> +       mtd_class = class_create(THIS_MODULE, "mtd");
> +
> +       if (IS_ERR(mtd_class)) {
> +               pr_err("Error creating mtd class.\n");
> +               return PTR_ERR(mtd_class);
> +       }

The reason I had the class creation code in its own initcall
is to ensure that it's there even when procfs isn't.  This
init_mtd() stuff is only there if procfs is configured.

So I don't much like this part of Kevin's change ... unless
MTD becomes dependent on procfs.  If there's an issue with
CONFIG_MTD=m then there's a better fix than this.


>         if ((proc_mtd = create_proc_entry( "mtd", 0, NULL )))
>                 proc_mtd->read_proc = mtd_read_proc;
>         return 0;
> @@ -422,6 +605,7 @@ static void __exit cleanup_mtd(void)
>  {
>          if (proc_mtd)
>                 remove_proc_entry( "mtd", NULL);
> +       class_destroy(mtd_class);
>  }
> 
>  module_init(init_mtd);





More information about the linux-mtd mailing list