The second argument represents the operation which takes the lock. Add a new SPI_NOR_OPS_IS_LOCKED and use it. Fixes: 5bf0e69b67a5 ("mtd: spi-nor: add mtd_is_locked() support") Signed-off-by: Michael Walle <michael@xxxxxxxx> --- drivers/mtd/spi-nor/spi-nor.c | 4 ++-- include/linux/mtd/spi-nor.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 5cc4c0b331b3..d422aead9f36 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -2071,13 +2071,13 @@ static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) struct spi_nor *nor = mtd_to_spi_nor(mtd); int ret; - ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_UNLOCK); + ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_IS_LOCKED); if (ret) return ret; ret = nor->params.locking_ops->is_locked(nor, ofs, len); - spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); + spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_IS_LOCKED); return ret; } diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index b661fd948a25..a8fcb1d70510 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -235,6 +235,7 @@ enum spi_nor_ops { SPI_NOR_OPS_ERASE, SPI_NOR_OPS_LOCK, SPI_NOR_OPS_UNLOCK, + SPI_NOR_OPS_IS_LOCKED, }; enum spi_nor_option_flags { -- 2.20.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/