Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28b8b26b authored by Brian Norris's avatar Brian Norris
Browse files

mtd: add get/set of_node/flash_node helpers



We are going to begin using the mtd->dev.of_node field for MTD device
nodes, so let's add helpers for it. Also, we'll be making some
conversions on spi_nor (and nand_chip eventually) too, so get that ready
with their own helpers.

Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent bf9c37cb
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -254,6 +254,17 @@ struct mtd_info {
	int usecount;
};

static inline void mtd_set_of_node(struct mtd_info *mtd,
				   struct device_node *np)
{
	mtd->dev.of_node = np;
}

static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)
{
	return mtd->dev.of_node;
}

int mtd_erase(struct mtd_info *mtd, struct erase_info *instr);
int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
	      void **virt, resource_size_t *phys);
+11 −0
Original line number Diff line number Diff line
@@ -719,6 +719,17 @@ struct nand_chip {
	void *priv;
};

static inline void nand_set_flash_node(struct nand_chip *chip,
				       struct device_node *np)
{
	chip->flash_node = np;
}

static inline struct device_node *nand_get_flash_node(struct nand_chip *chip)
{
	return chip->flash_node;
}

/*
 * NAND Flash Manufacturer ID Codes
 */
+11 −0
Original line number Diff line number Diff line
@@ -185,6 +185,17 @@ struct spi_nor {
	void *priv;
};

static inline void spi_nor_set_flash_node(struct spi_nor *nor,
					  struct device_node *np)
{
	nor->flash_node = np;
}

static inline struct device_node *spi_nor_get_flash_node(struct spi_nor *nor)
{
	return nor->flash_node;
}

/**
 * spi_nor_scan() - scan the SPI NOR
 * @nor:	the spi_nor structure