--- initial
+++ final
@@ -1,80 +1,80 @@
 static int fsl_ifc_nand_probe(struct platform_device *dev) {
   struct fsl_ifc_runtime __iomem *ifc;
   struct fsl_ifc_mtd *priv;
   struct resource res;
   static const char *part_probe_types[] = {"cmdlinepart", "RedBoot", "ofpart", NULL};
   int ret;
   int bank;
   struct device_node *node = dev->dev.of_node;
   struct mtd_info *mtd;
   if (!fsl_ifc_ctrl_dev || !fsl_ifc_ctrl_dev->rregs) return -ENODEV;
   ifc = fsl_ifc_ctrl_dev->rregs;
   /* get, allocate and map the memory resource */
   ret = of_address_to_resource(node, 0, &res);
   if (ret) {
     dev_err(&dev->dev, "%s: failed to get resource\n", __func__);
     return ret;
   }
   /* find which chip select it is connected to */
   for (bank = 0; bank < fsl_ifc_ctrl_dev->banks; bank++) {
     if (match_bank(fsl_ifc_ctrl_dev->gregs, bank, res.start)) break;
   }
   if (bank >= fsl_ifc_ctrl_dev->banks) {
     dev_err(&dev->dev, "%s: address did not match any chip selects\n", __func__);
     return -ENODEV;
   }
   priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL);
   if (!priv) return -ENOMEM;
   mutex_lock(&fsl_ifc_nand_mutex);
   if (!fsl_ifc_ctrl_dev->nand) {
     ifc_nand_ctrl = kzalloc(sizeof(*ifc_nand_ctrl), GFP_KERNEL);
     if (!ifc_nand_ctrl) {
       mutex_unlock(&fsl_ifc_nand_mutex);
       return -ENOMEM;
     }
     ifc_nand_ctrl->read_bytes = 0;
     ifc_nand_ctrl->index = 0;
     ifc_nand_ctrl->addr = NULL;
     fsl_ifc_ctrl_dev->nand = ifc_nand_ctrl;
     nand_controller_init(&ifc_nand_ctrl->controller);
   } else {
     ifc_nand_ctrl = fsl_ifc_ctrl_dev->nand;
   }
   mutex_unlock(&fsl_ifc_nand_mutex);
   ifc_nand_ctrl->chips[bank] = priv;
   priv->bank = bank;
   priv->ctrl = fsl_ifc_ctrl_dev;
   priv->dev = &dev->dev;
   priv->vbase = ioremap(res.start, resource_size(&res));
   if (!priv->vbase) {
     dev_err(priv->dev, "%s: failed to map chip region\n", __func__);
     ret = -ENOMEM;
     goto err;
   }
   dev_set_drvdata(priv->dev, priv);
   ifc_out32(IFC_NAND_EVTER_EN_OPC_EN | IFC_NAND_EVTER_EN_FTOER_EN | IFC_NAND_EVTER_EN_WPER_EN, &ifc->ifc_nand.nand_evter_en);
   /* enable NAND Machine Interrupts */
   ifc_out32(IFC_NAND_EVTER_INTR_OPCIR_EN | IFC_NAND_EVTER_INTR_FTOERIR_EN | IFC_NAND_EVTER_INTR_WPERIR_EN, &ifc->ifc_nand.nand_evter_intr_en);
   mtd = nand_to_mtd(&priv->chip);
   mtd->name = kasprintf(GFP_KERNEL, "%llx.flash", (u64)res.start);
   if (!mtd->name) {
     ret = -ENOMEM;
     goto err;
   }
   ret = fsl_ifc_chip_init(priv);
   if (ret) goto err;
   priv->chip.controller->ops = &fsl_ifc_controller_ops;
-  ret = nand_scan(mtd, 1);
+  ret = nand_scan(&priv->chip, 1);
   if (ret) goto err;
   /* First look for RedBoot table or partitions on the command
    * line, these take precedence over device tree information */
   ret = mtd_device_parse_register(mtd, part_probe_types, NULL, NULL, 0);
   if (ret) goto cleanup_nand;
   dev_info(priv->dev, "IFC NAND device at 0x%llx, bank %d\n", (unsigned long long)res.start, priv->bank);
   return 0;
 cleanup_nand:
   nand_cleanup(&priv->chip);
 err:
   fsl_ifc_chip_remove(priv);
   return ret;
 }<sep>@@
expression board_mtd,this;
@@
board_mtd = nand_to_mtd(this)
...
-        nand_scan (board_mtd, 1)
+        nand_scan (this, 1)