summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/spi-nor/core.h
diff options
context:
space:
mode:
authorTudor Ambarus <tudor.ambarus@microchip.com>2021-10-29 20:26:10 +0300
committerTudor Ambarus <tudor.ambarus@microchip.com>2021-11-17 14:36:01 +0200
commit7158c86e560789a4a07fe161cc284f8058d52ccc (patch)
tree64adc7d3dcf807ae1d1b95e1e32d8496288b98d2 /drivers/mtd/spi-nor/core.h
parenta360ae43217c45fb7ca37603ffb6c06aad2b3929 (diff)
downloadlinux-7158c86e560789a4a07fe161cc284f8058d52ccc.tar.bz2
mtd: spi-nor: core: Use container_of to get the pointer to struct spi_nor
"struct mtd_info mtd" is member of "struct spi_nor", there's no need to use "mtd->priv". Get the pointer to the containing struct spi_nor by using container_of. While here, make the function inline and get rid of the __maybe_unused. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: Michael Walle <michael@walle.cc> Reviewed-by: Pratyush Yadav <p.yadav@ti.com> Link: https://lore.kernel.org/r/20211029172633.886453-3-tudor.ambarus@microchip.com
Diffstat (limited to 'drivers/mtd/spi-nor/core.h')
-rw-r--r--drivers/mtd/spi-nor/core.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index da3fd3636d3c..223a03769950 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -551,9 +551,9 @@ void spi_nor_try_unlock_all(struct spi_nor *nor);
void spi_nor_register_locking_ops(struct spi_nor *nor);
void spi_nor_otp_init(struct spi_nor *nor);
-static struct spi_nor __maybe_unused *mtd_to_spi_nor(struct mtd_info *mtd)
+static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd)
{
- return mtd->priv;
+ return container_of(mtd, struct spi_nor, mtd);
}
#endif /* __LINUX_MTD_SPI_NOR_INTERNAL_H */