diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-08-26 10:13:52 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-08-26 10:13:56 +0200 |
commit | a4cea873ff85d95c6f184cdef78a5d3ff0af5e1e (patch) | |
tree | eebd588b1c76d560bd770e77f4dc501f81de168c /drivers/mtd/nand/nand_imx.c | |
parent | 7536df20a8aefb35b83aebdb5eac636ef1df75fd (diff) | |
download | barebox-a4cea873ff85d95c6f184cdef78a5d3ff0af5e1e.tar.gz barebox-a4cea873ff85d95c6f184cdef78a5d3ff0af5e1e.tar.xz |
mtd: nand: Add and use static inline wrapper for getting nand_chip from mtd
All drivers in tree use mtd->priv for the nand_chip. Add and use a static
inline wrapper mtd_to_nand() which we already have in the kernel for
getting the nand_chip from the mtd_info struct. Next step would be to
embed a struct mtd_info into struct nand_chip.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/nand/nand_imx.c')
-rw-r--r-- | drivers/mtd/nand/nand_imx.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/mtd/nand/nand_imx.c b/drivers/mtd/nand/nand_imx.c index e0d840b14e..02ddc661a6 100644 --- a/drivers/mtd/nand/nand_imx.c +++ b/drivers/mtd/nand/nand_imx.c @@ -478,7 +478,7 @@ static void imx_nand_enable_hwecc_v3(struct nand_chip *chip, bool enable) static int imx_nand_correct_data_v1(struct mtd_info *mtd) { - struct nand_chip *nand_chip = mtd->priv; + struct nand_chip *nand_chip = mtd_to_nand(mtd); struct imx_nand_host *host = nand_chip->priv; if (host->eccstatus_v1 < 0) @@ -494,7 +494,7 @@ static int imx_nand_correct_data_v1(struct mtd_info *mtd) static int imx_nand_correct_data_v2_v3(struct mtd_info *mtd) { - struct nand_chip *nand_chip = mtd->priv; + struct nand_chip *nand_chip = mtd_to_nand(mtd); struct imx_nand_host *host = nand_chip->priv; u32 ecc_stat, err; int no_subpages; @@ -537,7 +537,7 @@ static int imx_nand_calculate_ecc(struct mtd_info *mtd, const u_char * dat, */ static u_char imx_nand_read_byte(struct mtd_info *mtd) { - struct nand_chip *nand_chip = mtd->priv; + struct nand_chip *nand_chip = mtd_to_nand(mtd); struct imx_nand_host *host = nand_chip->priv; u_char ret; @@ -568,7 +568,7 @@ static u_char imx_nand_read_byte(struct mtd_info *mtd) */ static u16 imx_nand_read_word(struct mtd_info *mtd) { - struct nand_chip *nand_chip = mtd->priv; + struct nand_chip *nand_chip = mtd_to_nand(mtd); struct imx_nand_host *host = nand_chip->priv; uint16_t ret; @@ -590,7 +590,7 @@ static u16 imx_nand_read_word(struct mtd_info *mtd) static void imx_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len) { - struct nand_chip *nand_chip = mtd->priv; + struct nand_chip *nand_chip = mtd_to_nand(mtd); struct imx_nand_host *host = nand_chip->priv; u16 col = host->buf_start; int n = mtd->oobsize + mtd->writesize - col; @@ -613,7 +613,7 @@ static void imx_nand_write_buf(struct mtd_info *mtd, */ static void imx_nand_read_buf(struct mtd_info *mtd, u_char * buf, int len) { - struct nand_chip *nand_chip = mtd->priv; + struct nand_chip *nand_chip = mtd_to_nand(mtd); struct imx_nand_host *host = nand_chip->priv; u16 col = host->buf_start; int n = mtd->oobsize + mtd->writesize - col; @@ -634,7 +634,7 @@ static void imx_nand_read_buf(struct mtd_info *mtd, u_char * buf, int len) */ static void copy_spare(struct mtd_info *mtd, int bfrom, void *buf) { - struct nand_chip *this = mtd->priv; + struct nand_chip *this = mtd_to_nand(mtd); struct imx_nand_host *host = this->priv; u16 i, j; u16 n = mtd->writesize >> 9; @@ -672,7 +672,7 @@ static void imx_nand_select_chip(struct mtd_info *mtd, int chip) static void mxc_do_addr_cycle(struct mtd_info *mtd, int column, int page_addr) { - struct nand_chip *nand_chip = mtd->priv; + struct nand_chip *nand_chip = mtd_to_nand(mtd); struct imx_nand_host *host = nand_chip->priv; /* @@ -738,7 +738,7 @@ static int get_eccsize(struct mtd_info *mtd) static void preset_v1(struct mtd_info *mtd) { - struct nand_chip *nand_chip = mtd->priv; + struct nand_chip *nand_chip = mtd_to_nand(mtd); struct imx_nand_host *host = nand_chip->priv; uint16_t config1 = 0; @@ -760,7 +760,7 @@ static void preset_v1(struct mtd_info *mtd) static void preset_v2(struct mtd_info *mtd) { - struct nand_chip *nand_chip = mtd->priv; + struct nand_chip *nand_chip = mtd_to_nand(mtd); struct imx_nand_host *host = nand_chip->priv; uint16_t config1 = 0; int mode; @@ -820,7 +820,7 @@ static void preset_v2(struct mtd_info *mtd) static void preset_v3(struct mtd_info *mtd) { - struct nand_chip *chip = mtd->priv; + struct nand_chip *chip = mtd_to_nand(mtd); struct imx_nand_host *host = chip->priv; uint32_t config2, config3; int i, addr_phases; @@ -962,7 +962,7 @@ static int imx_nand_read_page_raw(struct mtd_info *mtd, static void imx_nand_command(struct mtd_info *mtd, unsigned command, int column, int page_addr) { - struct nand_chip *nand_chip = mtd->priv; + struct nand_chip *nand_chip = mtd_to_nand(mtd); struct imx_nand_host *host = nand_chip->priv; dev_dbg(host->dev, |