summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/docg3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/devices/docg3.c')
-rw-r--r--drivers/mtd/devices/docg3.c43
1 files changed, 15 insertions, 28 deletions
diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index a40ba25632..fcf9403b8f 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Handles the M-Systems DiskOnChip G3 chip
*
* Copyright (C) 2011 Robert Jarzmik
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
* Taken from linux kernel.
*/
@@ -334,7 +325,7 @@ static int doc_ecc_bch_fix_data(struct docg3 *docg3, void *buf, u8 *hwecc)
for (i = 0; i < DOC_ECC_BCH_SIZE; i++)
ecc[i] = bitrev8(hwecc[i]);
- numerrs = decode_bch(docg3_bch, NULL, DOC_ECC_BCH_COVERED_BYTES,
+ numerrs = bch_decode(docg3_bch, NULL, DOC_ECC_BCH_COVERED_BYTES,
NULL, ecc, NULL, errorpos);
BUG_ON(numerrs == -EINVAL);
if (numerrs < 0)
@@ -852,7 +843,6 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *info)
doc_dbg("doc_erase(from=%lld, len=%lld\n", info->addr, info->len);
doc_set_device_id(docg3, docg3->device_id);
- info->state = MTD_ERASE_PENDING;
calc_block_sector(info->addr + info->len, &block0, &block1, &page,
&ofs, docg3->reliable);
ret = -EINVAL;
@@ -864,7 +854,6 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *info)
docg3->reliable);
doc_set_reliable_mode(docg3);
for (len = info->len; !ret && len > 0; len -= mtd->erasesize) {
- info->state = MTD_ERASING;
ret = doc_erase_block(docg3, block0, block1);
block0 += 2;
block1 += 2;
@@ -873,11 +862,9 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *info)
if (ret)
goto reset_err;
- info->state = MTD_ERASE_DONE;
return 0;
reset_err:
- info->state = MTD_ERASE_FAILED;
return ret;
}
@@ -1073,18 +1060,18 @@ static void __init doc_set_driver_info(int chip_id, struct mtd_info *mtd)
mtd->erasesize /= 2;
mtd->writesize = DOC_LAYOUT_PAGE_SIZE;
mtd->oobsize = DOC_LAYOUT_OOB_SIZE;
- mtd->read = doc_read;
- mtd->read_oob = doc_read_oob;
- mtd->block_isbad = doc_block_isbad;
+ mtd->_read = doc_read;
+ mtd->_read_oob = doc_read_oob;
+ mtd->_block_isbad = doc_block_isbad;
#ifdef CONFIG_MTD_WRITE
- mtd->erase = doc_erase;
- mtd->write = doc_write;
- mtd->write_oob = doc_write_oob;
+ mtd->_erase = doc_erase;
+ mtd->_write = doc_write;
+ mtd->_write_oob = doc_write_oob;
#endif
}
static struct mtd_info *doc_probe_device(void __iomem *base, int floor,
- struct device_d *dev)
+ struct device *dev)
{
int ret, bbt_nbpages;
u16 chip_id, chip_id_inv;
@@ -1144,7 +1131,7 @@ nomem1:
return ERR_PTR(ret);
}
-static int __init docg3_probe(struct device_d *dev)
+static int __init docg3_probe(struct device *dev)
{
struct resource *iores;
struct mtd_info *mtd;
@@ -1157,8 +1144,8 @@ static int __init docg3_probe(struct device_d *dev)
base = IOMEM(iores->start);
ret = -ENOMEM;
- docg3_bch = init_bch(DOC_ECC_BCH_M, DOC_ECC_BCH_T,
- DOC_ECC_BCH_PRIMPOLY);
+ docg3_bch = bch_init(DOC_ECC_BCH_M, DOC_ECC_BCH_T,
+ DOC_ECC_BCH_PRIMPOLY, false);
if (!docg3_bch)
goto nomem2;
@@ -1176,7 +1163,7 @@ static int __init docg3_probe(struct device_d *dev)
continue;
}
docg3_floors[floor] = mtd;
- mtd->parent = dev;
+ mtd->dev.parent = dev;
ret = add_mtd_device(mtd, NULL, DEVICE_ID_DYNAMIC);
if (ret)
goto err_probe;
@@ -1194,12 +1181,12 @@ notfound:
ret = -ENODEV;
dev_info(dev, "No supported DiskOnChip found\n");
err_probe:
- free_bch(docg3_bch);
+ bch_free(docg3_bch);
nomem2:
return ret;
}
-static struct driver_d g3_driver = {
+static struct driver g3_driver = {
.name = "docg3",
.probe = docg3_probe,
};