if (mtd->writesize == 512)
mtd_set_ooblayout(mtd, &rb4xx_nand_ecclayout_ops);
- nand->chip.ecc.mode = NAND_ECC_SOFT;
- nand->chip.ecc.algo = NAND_ECC_HAMMING;
- nand->chip.options = NAND_NO_SUBPAGE_WRITE;
- nand->chip.priv = nand;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
+ nand->chip.ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
+ nand->chip.ecc.algo = NAND_ECC_ALGO_HAMMING;
+#else
+ nand->chip.ecc.mode = NAND_ECC_SOFT;
+ nand->chip.ecc.algo = NAND_ECC_HAMMING;
+#endif
+ nand->chip.options = NAND_NO_SUBPAGE_WRITE;
+ nand->chip.priv = nand;
nand->chip.legacy.read_byte = rb4xx_nand_read_byte;
nand->chip.legacy.write_buf = rb4xx_nand_write_buf;
ret = mtd_device_register(mtd, NULL, 0);
if (ret) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
+ mtd_device_unregister(nand_to_mtd(&nand->chip));
+ nand_cleanup(&nand->chip);
+#else
nand_release(&nand->chip);
+#endif
return ret;
}
{
struct rb4xx_nand *nand = platform_get_drvdata(pdev);
- nand_release(&nand->chip);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
+ mtd_device_unregister(nand_to_mtd(&nand->chip));
+ nand_cleanup(&nand->chip);
+#else
+ nand_release(&nand->chip);
+#endif
return 0;
}