Skip to content

Commit

Permalink
mtd: nandsim: use nand_get_controller_data()
Browse files Browse the repository at this point in the history
Commit d699ed2 ("mtd: nand: make use of
nand_set/get_controller_data() helpers") overlooked some uses of
nand_chip::priv.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
  • Loading branch information
Brian Norris committed Jan 7, 2016
1 parent f118902 commit c66b651
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions drivers/mtd/nand/nandsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,8 @@ static void switch_state(struct nandsim *ns)

static u_char ns_nand_read_byte(struct mtd_info *mtd)
{
struct nandsim *ns = mtd_to_nand(mtd)->priv;
struct nand_chip *chip = mtd_to_nand(mtd);
struct nandsim *ns = nand_get_controller_data(chip);
u_char outb = 0x00;

/* Sanity and correctness checks */
Expand Down Expand Up @@ -1969,7 +1970,8 @@ static u_char ns_nand_read_byte(struct mtd_info *mtd)

static void ns_nand_write_byte(struct mtd_info *mtd, u_char byte)
{
struct nandsim *ns = mtd_to_nand(mtd)->priv;
struct nand_chip *chip = mtd_to_nand(mtd);
struct nandsim *ns = nand_get_controller_data(chip);

/* Sanity and correctness checks */
if (!ns->lines.ce) {
Expand Down Expand Up @@ -2123,7 +2125,8 @@ static void ns_nand_write_byte(struct mtd_info *mtd, u_char byte)

static void ns_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int bitmask)
{
struct nandsim *ns = mtd_to_nand(mtd)->priv;
struct nand_chip *chip = mtd_to_nand(mtd);
struct nandsim *ns = nand_get_controller_data(chip);

ns->lines.cle = bitmask & NAND_CLE ? 1 : 0;
ns->lines.ale = bitmask & NAND_ALE ? 1 : 0;
Expand All @@ -2150,7 +2153,8 @@ static uint16_t ns_nand_read_word(struct mtd_info *mtd)

static void ns_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
{
struct nandsim *ns = mtd_to_nand(mtd)->priv;
struct nand_chip *chip = mtd_to_nand(mtd);
struct nandsim *ns = nand_get_controller_data(chip);

/* Check that chip is expecting data input */
if (!(ns->state & STATE_DATAIN_MASK)) {
Expand All @@ -2177,7 +2181,8 @@ static void ns_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)

static void ns_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
{
struct nandsim *ns = mtd_to_nand(mtd)->priv;
struct nand_chip *chip = mtd_to_nand(mtd);
struct nandsim *ns = nand_get_controller_data(chip);

/* Sanity and correctness checks */
if (!ns->lines.ce) {
Expand Down Expand Up @@ -2404,7 +2409,8 @@ module_init(ns_init_module);
*/
static void __exit ns_cleanup_module(void)
{
struct nandsim *ns = mtd_to_nand(nsmtd)->priv;
struct nand_chip *chip = mtd_to_nand(nsmtd);
struct nandsim *ns = nand_get_controller_data(chip);
int i;

nandsim_debugfs_remove(ns);
Expand Down

0 comments on commit c66b651

Please sign in to comment.