- if (data && tags) {
- if (dev->useNANDECC) {
- retval =
- mtd->read_ecc(mtd, addr, dev->nBytesPerChunk,
- &dummy, data, dev->spareBuffer,
- NULL);
- } else {
- retval =
- mtd->read_ecc(mtd, addr, dev->nBytesPerChunk,
+ if (dev->inbandTags) {
+
+ if (!data) {
+ localData = 1;
+ data = yaffs_GetTempBuffer(dev, __LINE__);
+ }
+
+
+ }
+
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
+ if (dev->inbandTags || (data && !tags))
+ retval = mtd->read(mtd, addr, dev->totalBytesPerChunk,
+ &dummy, data);
+ else if (tags) {
+ ops.mode = MTD_OOB_AUTO;
+ ops.ooblen = sizeof(pt);
+ ops.len = data ? dev->nDataBytesPerChunk : sizeof(pt);
+ ops.ooboffs = 0;
+ ops.datbuf = data;
+ ops.oobbuf = dev->spareBuffer;
+ retval = mtd->read_oob(mtd, addr, &ops);
+ }
+#else
+ if (!dev->inbandTags && data && tags) {
+
+ retval = mtd->read_ecc(mtd, addr, dev->nDataBytesPerChunk,