}
 };
 
-
-#ifdef CONFIG_MTD_PARTITIONS
 /*
  * Default partition tables to be used if the partition information not
  * provided through platform data.
 #ifdef CONFIG_MTD_CMDLINE_PARTS
 const char *part_probes[] = { "cmdlinepart", NULL };
 #endif
-#endif
 
 /**
  * struct fsmc_nand_data - structure for FSMC NAND device state
         * platform data,
         * default partition information present in driver.
         */
-#ifdef CONFIG_MTD_PARTITIONS
 #ifdef CONFIG_MTD_CMDLINE_PARTS
        /*
         * Check if partition info passed via command line
        }
 #endif
 
-       if (host->partitions) {
-               ret = add_mtd_partitions(&host->mtd, host->partitions,
-                               host->nr_partitions);
-               if (ret)
-                       goto err_probe;
-       }
-#else
-       dev_info(&pdev->dev, "Registering %s as whole device\n", mtd->name);
-       if (!add_mtd_device(mtd)) {
-               ret = -ENXIO;
+       ret = mtd_device_register(&host->mtd, host->partitions,
+                                 host->nr_partitions);
+       if (ret)
                goto err_probe;
-       }
-#endif
 
        platform_set_drvdata(pdev, host);
        dev_info(&pdev->dev, "FSMC NAND driver registration successful\n");
        platform_set_drvdata(pdev, NULL);
 
        if (host) {
-#ifdef CONFIG_MTD_PARTITIONS
-               del_mtd_partitions(&host->mtd);
-#else
-               del_mtd_device(&host->mtd);
-#endif
+               mtd_device_unregister(&host->mtd);
                clk_disable(host->clk);
                clk_put(host->clk);