]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mtd: spi-nor: swp: Explain the MEMLOCK ioctl implementation behaviour
authorMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 26 May 2026 14:56:32 +0000 (16:56 +0200)
committerPratyush Yadav <pratyush@kernel.org>
Tue, 26 May 2026 15:21:04 +0000 (17:21 +0200)
Add more details about how these requests are actually handled in the
SPI NOR core. Their behaviour was not entirely clear to me at first, and
explaining them in plain English sounds the way to go.

Reviewed-by: Michael Walle <mwalle@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
drivers/mtd/spi-nor/core.h

index e838c40a25897b70ceb8c98624483855eb70056c..65bb4b5e1e2b1abff429b3797a102264694e1ff4 100644 (file)
@@ -279,9 +279,14 @@ struct spi_nor_erase_map {
 
 /**
  * struct spi_nor_locking_ops - SPI NOR locking methods
- * @lock:      lock a region of the SPI NOR.
- * @unlock:    unlock a region of the SPI NOR.
- * @is_locked: check if a region of the SPI NOR is completely locked
+ * @lock:      lock a region of the SPI NOR, never locks more than what is
+ *             requested, ie. may lock less.
+ * @unlock:    unlock a region of the SPI NOR, may unlock more than what is
+ *             requested.
+ * @is_locked: check if a region of the SPI NOR is completely locked, returns
+ *             false otherwise. This feedback may be misleading because users
+ *             may get an "unlocked" status even though a subpart of the region
+ *             is effectively locked.
  */
 struct spi_nor_locking_ops {
        int (*lock)(struct spi_nor *nor, loff_t ofs, u64 len);