Skip to contentSkip to conversation

mtd: spi-nor: Uniformize the return value in spi_nor_*_ready()

PATCH In review [email protected] 2 participants 6 messages Apr 21, 2020 – Apr 29, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mtd: spi-nor: Uniformize the return value in spi_nor_*_ready()

From: Tudor Ambarus <[email protected]>

spi_nor_ready() returns 1 if ready, 0 if not ready and -errono on errors. Do the same in all the spi_nor_*_ready() children.

---
 drivers/mtd/spi-nor/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/core.c +1 -1
index cc68ea84318e..9dcc53bda8b0 100644
@@ -640,7 +640,7 @@ static int spi_nor_fsr_ready(struct spi_nor *nor)
 		return -EIO;
 	}
 
-	return nor->bouncebuf[0] & FSR_READY;
+	return !!(nor->bouncebuf[0] & FSR_READY);
 }
 
 /**
Signature · 5 lines
2.23.0

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#1 lore raw

PATCH 2/2 mtd: spi-nor: Fix description of the sr_ready() return value

From: Tudor Ambarus <[email protected]>

The functions return 1 if ready, 0 if not ready, -errno on errors.

---
 drivers/mtd/spi-nor/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/spi-nor/core.c +4 -4
index 9dcc53bda8b0..9611553e829f 100644
@@ -499,7 +499,7 @@ int spi_nor_xread_sr(struct spi_nor *nor, u8 *sr)
  * the flash is ready for new commands.
  * @nor:	pointer to 'struct spi_nor'.
  *
- * Return: 0 on success, -errno otherwise.
+ * Return: 1 if ready, 0 if not ready, -errno on errors.
  */
 static int spi_nor_xsr_ready(struct spi_nor *nor)
 {
@@ -542,7 +542,7 @@ static void spi_nor_clear_sr(struct spi_nor *nor)
  * for new commands.
  * @nor:	pointer to 'struct spi_nor'.
  *
- * Return: 0 on success, -errno otherwise.
+ * Return: 1 if ready, 0 if not ready, -errno on errors.
  */
 static int spi_nor_sr_ready(struct spi_nor *nor)
 {
@@ -606,7 +606,7 @@ static void spi_nor_clear_fsr(struct spi_nor *nor)
  * ready for new commands.
  * @nor:	pointer to 'struct spi_nor'.
  *
- * Return: 0 on success, -errno otherwise.
+ * Return: 1 if ready, 0 if not ready, -errno on errors.
  */
 static int spi_nor_fsr_ready(struct spi_nor *nor)
 {
@@ -647,7 +647,7 @@ static int spi_nor_fsr_ready(struct spi_nor *nor)
  * spi_nor_ready() - Query the flash to see if it is ready for new commands.
  * @nor:	pointer to 'struct spi_nor'.
  *
- * Return: 0 on success, -errno otherwise.
+ * Return: 1 if ready, 0 if not ready, -errno on errors.
  */
 static int spi_nor_ready(struct spi_nor *nor)
 {
Signature · 5 lines
2.23.0

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] mtd: spi-nor: Fix description of the sr_ready() return value

Quoted 3 lines · On 21/04/20 12:01 pm, [email protected] wrote:

From: Tudor Ambarus <[email protected]>

The functions return 1 if ready, 0 if not ready, -errno on errors.

Quoted 39 lines
---
 drivers/mtd/spi-nor/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/spi-nor/core.c +3 -3
index 9dcc53bda8b0..9611553e829f 100644
@@ -499,7 +499,7 @@ int spi_nor_xread_sr(struct spi_nor *nor, u8 *sr)
  * the flash is ready for new commands.
  * @nor:	pointer to 'struct spi_nor'.
  *
- * Return: 0 on success, -errno otherwise.
+ * Return: 1 if ready, 0 if not ready, -errno on errors.
  */
 static int spi_nor_xsr_ready(struct spi_nor *nor)
 {
@@ -542,7 +542,7 @@ static void spi_nor_clear_sr(struct spi_nor *nor)
  * for new commands.
  * @nor:	pointer to 'struct spi_nor'.
  *
- * Return: 0 on success, -errno otherwise.
+ * Return: 1 if ready, 0 if not ready, -errno on errors.
  */
 static int spi_nor_sr_ready(struct spi_nor *nor)
 {
@@ -606,7 +606,7 @@ static void spi_nor_clear_fsr(struct spi_nor *nor)
  * ready for new commands.
  * @nor:	pointer to 'struct spi_nor'.
  *
- * Return: 0 on success, -errno otherwise.
+ * Return: 1 if ready, 0 if not ready, -errno on errors.
  */
 static int spi_nor_fsr_ready(struct spi_nor *nor)
 {

drivers/mtd/spi-nor/core.c static int spi_nor_fsr_ready(struct spi_nor *nor) · line 653

Quoted 8 lines
drivers/mtd/spi-nor/core.c +1 -1
@@ -647,7 +647,7 @@ static int spi_nor_fsr_ready(struct spi_nor *nor)
  * spi_nor_ready() - Query the flash to see if it is ready for new commands.
  * @nor:	pointer to 'struct spi_nor'.
  *
- * Return: 0 on success, -errno otherwise.
+ * Return: 1 if ready, 0 if not ready, -errno on errors.
  */
 static int spi_nor_ready(struct spi_nor *nor)
 {

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author Applied
#3 lore raw

Re: [PATCH 2/2] mtd: spi-nor: Fix description of the sr_ready() return value

Quoted 11 lines · EEST Vignesh Raghavendra
Quoted 3 lines · On 21/04/20 12:01 pm, [email protected] wrote:

From: Tudor Ambarus <[email protected]>

The functions return 1 if ready, 0 if not ready, -errno on errors.

Quoted 4 lines

---
drivers/mtd/spi-nor/core.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)

Applied. Cheers.
ta

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

maintainer Reviewed-by on v1 1/2
#4 lore raw
In reply to [email protected]
Quoted 3 lines · On 21/04/20 12:01 pm, [email protected] wrote:

From: Tudor Ambarus <[email protected]>

spi_nor_ready() returns 1 if ready, 0 if not ready and -errono on errors.

s/-errono/-errno

With that:

Quoted 13 lines

Do the same in all the spi_nor_*_ready() children.

---
 drivers/mtd/spi-nor/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/core.c +0 -0
index cc68ea84318e..9dcc53bda8b0 100644

drivers/mtd/spi-nor/core.c static int spi_nor_fsr_ready(struct spi_nor *nor) · line 646

Quoted 8 lines
drivers/mtd/spi-nor/core.c +1 -1
@@ -640,7 +640,7 @@ static int spi_nor_fsr_ready(struct spi_nor *nor)
 		return -EIO;
 	}
 
-	return nor->bouncebuf[0] & FSR_READY;
+	return !!(nor->bouncebuf[0] & FSR_READY);
 }
 
 /**

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#5 lore raw
Quoted 9 lines · EEST Vignesh Raghavendra
Quoted 3 lines

From: Tudor Ambarus <[email protected]>

spi_nor_ready() returns 1 if ready, 0 if not ready and -errono on errors.

s/-errono/-errno

With that:

Fixed the typo and applied. Cheers.

Quoted 6 lines
Quoted 6 lines

Do the same in all the spi_nor_*_ready() children.

---
drivers/mtd/spi-nor/core.c | 2 +-

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/