kernel: fix nand_release() usage.
[librecmc/librecmc.git] / target / linux / ar71xx / files / drivers / mtd / nand / rb750_nand.c
index dbada68dd0f804b5607182b0d26e52d9ebb6c6ca..a578c54ad351773c5ad0a423bd8679d1cd85ea98 100644 (file)
@@ -8,15 +8,19 @@
  *  by the Free Software Foundation.
  */
 
+#include <linux/version.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
 #include <linux/mtd/nand.h>
+#else
+#include <linux/mtd/rawnand.h>
+#endif
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/slab.h>
-#include <linux/version.h>
 
 #include <asm/mach-ath79/ar71xx_regs.h>
 #include <asm/mach-ath79/ath79.h>
@@ -389,7 +393,7 @@ static int rb750_nand_probe(struct platform_device *pdev)
        return 0;
 
 err_release_nand:
-       nand_release(mtd);
+       nand_release(&info->chip);
 err_set_drvdata:
        platform_set_drvdata(pdev, NULL);
 err_free_info:
@@ -401,7 +405,7 @@ static int rb750_nand_remove(struct platform_device *pdev)
 {
        struct rb750_nand_info *info = platform_get_drvdata(pdev);
 
-       nand_release(rbinfo_to_mtd(info));
+       nand_release(&info->chip);
        platform_set_drvdata(pdev, NULL);
        kfree(info);