Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>

+33
+11
include/linux/mtd/mtd.h
··· 254 254 int usecount; 255 255 }; 256 256 257 + static inline void mtd_set_of_node(struct mtd_info *mtd, 258 + struct device_node *np) 259 + { 260 + mtd->dev.of_node = np; 261 + } 262 + 263 + static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd) 264 + { 265 + return mtd->dev.of_node; 266 + } 267 + 257 268 int mtd_erase(struct mtd_info *mtd, struct erase_info *instr); 258 269 int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, 259 270 void **virt, resource_size_t *phys);
+11
include/linux/mtd/nand.h
··· 719 719 void *priv; 720 720 }; 721 721 722 + static inline void nand_set_flash_node(struct nand_chip *chip, 723 + struct device_node *np) 724 + { 725 + chip->flash_node = np; 726 + } 727 + 728 + static inline struct device_node *nand_get_flash_node(struct nand_chip *chip) 729 + { 730 + return chip->flash_node; 731 + } 732 + 722 733 /* 723 734 * NAND Flash Manufacturer ID Codes 724 735 */
+11
include/linux/mtd/spi-nor.h
··· 185 185 void *priv; 186 186 }; 187 187 188 + static inline void spi_nor_set_flash_node(struct spi_nor *nor, 189 + struct device_node *np) 190 + { 191 + nor->flash_node = np; 192 + } 193 + 194 + static inline struct device_node *spi_nor_get_flash_node(struct spi_nor *nor) 195 + { 196 + return nor->flash_node; 197 + } 198 + 188 199 /** 189 200 * spi_nor_scan() - scan the SPI NOR 190 201 * @nor: the spi_nor structure