Commit f07dcb90 authored by Boris BREZILLON's avatar Boris BREZILLON Committed by Brian Norris

staging: mt29f_spinand: 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: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent d699ed25
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
static inline struct spinand_state *mtd_to_state(struct mtd_info *mtd) static inline struct spinand_state *mtd_to_state(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd_to_nand(mtd); struct nand_chip *chip = mtd_to_nand(mtd);
struct spinand_info *info = (struct spinand_info *)chip->priv; struct spinand_info *info = nand_get_controller_data(chip);
struct spinand_state *state = (struct spinand_state *)info->priv; struct spinand_state *state = (struct spinand_state *)info->priv;
return state; return state;
...@@ -633,7 +633,7 @@ static int spinand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -633,7 +633,7 @@ static int spinand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
u8 *p = buf; u8 *p = buf;
int eccsize = chip->ecc.size; int eccsize = chip->ecc.size;
int eccsteps = chip->ecc.steps; int eccsteps = chip->ecc.steps;
struct spinand_info *info = (struct spinand_info *)chip->priv; struct spinand_info *info = nand_get_controller_data(chip);
enable_read_hw_ecc = 1; enable_read_hw_ecc = 1;
...@@ -679,7 +679,7 @@ static u8 spinand_read_byte(struct mtd_info *mtd) ...@@ -679,7 +679,7 @@ static u8 spinand_read_byte(struct mtd_info *mtd)
static int spinand_wait(struct mtd_info *mtd, struct nand_chip *chip) static int spinand_wait(struct mtd_info *mtd, struct nand_chip *chip)
{ {
struct spinand_info *info = (struct spinand_info *)chip->priv; struct spinand_info *info = nand_get_controller_data(chip);
unsigned long timeo = jiffies; unsigned long timeo = jiffies;
int retval, state = chip->state; int retval, state = chip->state;
...@@ -745,7 +745,7 @@ static void spinand_cmdfunc(struct mtd_info *mtd, unsigned int command, ...@@ -745,7 +745,7 @@ static void spinand_cmdfunc(struct mtd_info *mtd, unsigned int command,
int column, int page) int column, int page)
{ {
struct nand_chip *chip = mtd_to_nand(mtd); struct nand_chip *chip = mtd_to_nand(mtd);
struct spinand_info *info = (struct spinand_info *)chip->priv; struct spinand_info *info = nand_get_controller_data(chip);
struct spinand_state *state = (struct spinand_state *)info->priv; struct spinand_state *state = (struct spinand_state *)info->priv;
switch (command) { switch (command) {
...@@ -894,7 +894,7 @@ static int spinand_probe(struct spi_device *spi_nand) ...@@ -894,7 +894,7 @@ static int spinand_probe(struct spi_device *spi_nand)
#endif #endif
nand_set_flash_node(chip, spi_nand->dev.of_node); nand_set_flash_node(chip, spi_nand->dev.of_node);
chip->priv = info; nand_set_controller_data(chip, info);
chip->read_buf = spinand_read_buf; chip->read_buf = spinand_read_buf;
chip->write_buf = spinand_write_buf; chip->write_buf = spinand_write_buf;
chip->read_byte = spinand_read_byte; chip->read_byte = spinand_read_byte;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment