From: Brian Norris Date: Fri, 15 Mar 2019 14:14:30 +0000 (+0100) Subject: mtd: add get/set of_node/flash_node helpers X-Git-Tag: v2019.07-rc1~11^2~60 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=892a8682f71910aa12647c5636ec5304225c9e0f;p=oweals%2Fu-boot.git mtd: add get/set of_node/flash_node helpers Linux commit 28b8b26b308 ("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 Reviewed-by: Boris Brezillon [Philippe Reynes: only add function nand_set_flash_node and nand_get_flash_node because others were already backported] Signed-off-by: Philippe Reynes --- diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index 9f5dc81aca..e2bd598240 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -15,6 +15,7 @@ #include +#include #include #include #include @@ -961,6 +962,17 @@ struct nand_chip { void *priv; }; +static inline void nand_set_flash_node(struct nand_chip *chip, + ofnode node) +{ + chip->flash_node = ofnode_to_offset(node); +} + +static inline ofnode nand_get_flash_node(struct nand_chip *chip) +{ + return offset_to_ofnode(chip->flash_node); +} + static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd) { return container_of(mtd, struct nand_chip, mtd);