diff options
author | Boris BREZILLON <boris.brezillon@free-electrons.com> | 2015-12-10 09:00:41 +0100 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2016-01-07 10:23:41 -0800 |
commit | d699ed250c07384840263bbbf69cf7b90b45470c (patch) | |
tree | 954ed7cebade37cdf63b87df7e00d6713545c2c1 /drivers/mtd/nand/gpmi-nand | |
parent | d9dccc68c5cae4ef7b4a617a93a87b11c6f0c53a (diff) | |
download | blackbird-op-linux-d699ed250c07384840263bbbf69cf7b90b45470c.tar.gz blackbird-op-linux-d699ed250c07384840263bbbf69cf7b90b45470c.zip |
mtd: nand: make use of nand_set/get_controller_data() helpers
New helpers have been added to avoid directly accessing chip->field. Use
them where appropriate.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Brian: fixed a few rebase conflicts]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/nand/gpmi-nand')
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index df61f49d3770..235ddcb58f39 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c @@ -857,7 +857,7 @@ error_alloc: static void gpmi_cmd_ctrl(struct mtd_info *mtd, int data, unsigned int ctrl) { struct nand_chip *chip = mtd_to_nand(mtd); - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); int ret; /* @@ -891,7 +891,7 @@ static void gpmi_cmd_ctrl(struct mtd_info *mtd, int data, unsigned int ctrl) static int gpmi_dev_ready(struct mtd_info *mtd) { struct nand_chip *chip = mtd_to_nand(mtd); - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); return gpmi_is_ready(this, this->current_chip); } @@ -899,7 +899,7 @@ static int gpmi_dev_ready(struct mtd_info *mtd) static void gpmi_select_chip(struct mtd_info *mtd, int chipnr) { struct nand_chip *chip = mtd_to_nand(mtd); - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); if ((this->current_chip < 0) && (chipnr >= 0)) gpmi_begin(this); @@ -912,7 +912,7 @@ static void gpmi_select_chip(struct mtd_info *mtd, int chipnr) static void gpmi_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) { struct nand_chip *chip = mtd_to_nand(mtd); - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); dev_dbg(this->dev, "len is %d\n", len); this->upper_buf = buf; @@ -924,7 +924,7 @@ static void gpmi_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void gpmi_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) { struct nand_chip *chip = mtd_to_nand(mtd); - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); dev_dbg(this->dev, "len is %d\n", len); this->upper_buf = (uint8_t *)buf; @@ -936,7 +936,7 @@ static void gpmi_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) static uint8_t gpmi_read_byte(struct mtd_info *mtd) { struct nand_chip *chip = mtd_to_nand(mtd); - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); uint8_t *buf = this->data_buffer_dma; gpmi_read_buf(mtd, buf, 1); @@ -994,7 +994,7 @@ static void block_mark_swapping(struct gpmi_nand_data *this, static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip, uint8_t *buf, int oob_required, int page) { - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); struct bch_geometry *nfc_geo = &this->bch_geometry; void *payload_virt; dma_addr_t payload_phys; @@ -1074,7 +1074,7 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip, static int gpmi_ecc_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, uint32_t offs, uint32_t len, uint8_t *buf, int page) { - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); void __iomem *bch_regs = this->resources.bch_regs; struct bch_geometry old_geo = this->bch_geometry; struct bch_geometry *geo = &this->bch_geometry; @@ -1162,7 +1162,7 @@ static int gpmi_ecc_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip, const uint8_t *buf, int oob_required, int page) { - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); struct bch_geometry *nfc_geo = &this->bch_geometry; const void *payload_virt; dma_addr_t payload_phys; @@ -1298,7 +1298,7 @@ exit_auxiliary: static int gpmi_ecc_read_oob(struct mtd_info *mtd, struct nand_chip *chip, int page) { - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); dev_dbg(this->dev, "page number is %d\n", page); /* clear the OOB buffer */ @@ -1359,7 +1359,7 @@ static int gpmi_ecc_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, uint8_t *buf, int oob_required, int page) { - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); struct bch_geometry *nfc_geo = &this->bch_geometry; int eccsize = nfc_geo->ecc_chunk_size; int eccbits = nfc_geo->ecc_strength * nfc_geo->gf_len; @@ -1448,7 +1448,7 @@ static int gpmi_ecc_write_page_raw(struct mtd_info *mtd, const uint8_t *buf, int oob_required, int page) { - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); struct bch_geometry *nfc_geo = &this->bch_geometry; int eccsize = nfc_geo->ecc_chunk_size; int eccbits = nfc_geo->ecc_strength * nfc_geo->gf_len; @@ -1539,7 +1539,7 @@ static int gpmi_ecc_write_oob_raw(struct mtd_info *mtd, struct nand_chip *chip, static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs) { struct nand_chip *chip = mtd_to_nand(mtd); - struct gpmi_nand_data *this = chip->priv; + struct gpmi_nand_data *this = nand_get_controller_data(chip); int ret = 0; uint8_t *block_mark; int column, page, status, chipnr; @@ -1897,7 +1897,7 @@ static int gpmi_nand_init(struct gpmi_nand_data *this) mtd->dev.parent = this->dev; /* init the nand_chip{}, we don't support a 16-bit NAND Flash bus. */ - chip->priv = this; + nand_set_controller_data(chip, this); nand_set_flash_node(chip, this->pdev->dev.of_node); chip->select_chip = gpmi_select_chip; chip->cmd_ctrl = gpmi_cmd_ctrl; |