*/
#ifndef __UBOOT__
+#include <log.h>
+#include <dm/devres.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ptrace.h>
#include <linux/gfp.h>
#include <linux/slab.h>
#else
+#include <linux/bitops.h>
+#include <linux/bug.h>
#include <linux/err.h>
#include <ubi_uboot.h>
#endif
.resume = mtd_cls_resume,
};
#else
-struct mtd_info *mtd_table[MAX_MTD_DEVICES];
-
#define MAX_IDR_ID 64
struct idr_layer {
return -EINVAL;
if (ops->ooblen) {
- u64 maxooblen;
+ size_t maxooblen;
if (ops->ooboffs >= mtd_oobavail(mtd, ops))
return -EINVAL;
- maxooblen = ((mtd_div_by_ws(mtd->size, mtd) -
- mtd_div_by_ws(offs, mtd)) *
+ maxooblen = ((size_t)(mtd_div_by_ws(mtd->size, mtd) -
+ mtd_div_by_ws(offs, mtd)) *
mtd_oobavail(mtd, ops)) - ops->ooboffs;
if (ops->ooblen > maxooblen)
return -EINVAL;
if (!mtd || section < 0)
return -EINVAL;
- if (!mtd->ooblayout || !mtd->ooblayout->free)
+ if (!mtd->ooblayout || !mtd->ooblayout->rfree)
return -ENOTSUPP;
- return mtd->ooblayout->free(mtd, section, oobfree);
+ return mtd->ooblayout->rfree(mtd, section, oobfree);
}
EXPORT_SYMBOL_GPL(mtd_ooblayout_free);