diff options
Diffstat (limited to 'drivers/mtd/nand/txx9ndfmc.c')
-rw-r--r-- | drivers/mtd/nand/txx9ndfmc.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c index 8572519b8441..27488ee44386 100644 --- a/drivers/mtd/nand/txx9ndfmc.c +++ b/drivers/mtd/nand/txx9ndfmc.c @@ -63,7 +63,6 @@ struct txx9ndfmc_priv { struct platform_device *dev; struct nand_chip chip; - struct mtd_info mtd; int cs; const char *mtdname; }; @@ -79,7 +78,7 @@ struct txx9ndfmc_drvdata { static struct platform_device *mtd_to_platdev(struct mtd_info *mtd) { - struct nand_chip *chip = mtd->priv; + struct nand_chip *chip = mtd_to_nand(mtd); struct txx9ndfmc_priv *txx9_priv = chip->priv; return txx9_priv->dev; } @@ -135,7 +134,7 @@ static void txx9ndfmc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void txx9ndfmc_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) { - struct nand_chip *chip = mtd->priv; + struct nand_chip *chip = mtd_to_nand(mtd); struct txx9ndfmc_priv *txx9_priv = chip->priv; struct platform_device *dev = txx9_priv->dev; struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); @@ -175,7 +174,7 @@ static int txx9ndfmc_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat, uint8_t *ecc_code) { struct platform_device *dev = mtd_to_platdev(mtd); - struct nand_chip *chip = mtd->priv; + struct nand_chip *chip = mtd_to_nand(mtd); int eccbytes; u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); @@ -195,7 +194,7 @@ static int txx9ndfmc_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat, static int txx9ndfmc_correct_data(struct mtd_info *mtd, unsigned char *buf, unsigned char *read_ecc, unsigned char *calc_ecc) { - struct nand_chip *chip = mtd->priv; + struct nand_chip *chip = mtd_to_nand(mtd); int eccsize; int corrected = 0; int stat; @@ -257,7 +256,7 @@ static void txx9ndfmc_initialize(struct platform_device *dev) static int txx9ndfmc_nand_scan(struct mtd_info *mtd) { - struct nand_chip *chip = mtd->priv; + struct nand_chip *chip = mtd_to_nand(mtd); int ret; ret = nand_scan_ident(mtd, 1, NULL); @@ -322,11 +321,9 @@ static int __init txx9ndfmc_probe(struct platform_device *dev) if (!txx9_priv) continue; chip = &txx9_priv->chip; - mtd = &txx9_priv->mtd; + mtd = nand_to_mtd(chip); mtd->dev.parent = &dev->dev; - mtd->priv = chip; - chip->read_byte = txx9ndfmc_read_byte; chip->read_buf = txx9ndfmc_read_buf; chip->write_buf = txx9ndfmc_write_buf; @@ -391,7 +388,7 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev) if (!mtd) continue; - chip = mtd->priv; + chip = mtd_to_nand(mtd); txx9_priv = chip->priv; nand_release(mtd); |