All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
@ 2023-11-29  6:43 ` AceLan Kao
  0 siblings, 0 replies; 30+ messages in thread
From: AceLan Kao @ 2023-11-29  6:43 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel

From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>

This commit updates the SPI subsystem, particularly affecting "SPI MEM"
drivers and core parts, by replacing the -ENOTSUPP error code with
-EOPNOTSUPP.

The key motivations for this change are as follows:
1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
might return ENOTSUPP. This update aims to unify the error reporting
within the SPI subsystem for clarity and consistency.

2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
mainly being reserved for NFS-related errors. To align with kernel coding
standards and recommendations, this change is being made.

3. By using EOPNOTSUPP, we provide more specific context to the error,
indicating that a particular operation is not supported. This helps
differentiate from the more generic ENOTSUPP error, allowing drivers to
better handle and respond to different error scenarios.

Risks and Considerations:
While this change is primarily intended as a code cleanup and error code
unification, there is a minor risk of breaking user-space applications
that rely on specific return codes for unsupported operations. However,
this risk is considered low, as such use-cases are unlikely to be common
or critical. Nevertheless, developers and users should be aware of this
change, especially if they have scripts or tools that specifically handle
SPI error codes.

This commit does not introduce any functional changes to the SPI subsystem
or the affected drivers.

Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

---
v5. distinguish -EOPNOTSUPP from -ENOTSUPP
v6. a. spi_nor_set_4byte_addr_mode() should check -EOPNOTSUPP, all
       callbacks of set_4byte_addr_mode() will eventually return
       -EOPNOTSUPP if the checking failed.
    b. Update comment to describe the reason for the patch and the
       affected parts.
    c. Update the kernel-doc of exec_op() in struct spi_controller_mem_ops
v7. added comment for the return code changes may affect userspace, and
    the risk after this change
---
 drivers/mtd/nand/spi/core.c | 2 +-
 drivers/mtd/spi-nor/core.c  | 2 +-
 drivers/spi/atmel-quadspi.c | 2 +-
 drivers/spi/spi-ath79.c     | 2 +-
 drivers/spi/spi-bcm-qspi.c  | 2 +-
 drivers/spi/spi-mem.c       | 6 +++---
 drivers/spi/spi-npcm-fiu.c  | 2 +-
 drivers/spi/spi-ti-qspi.c   | 4 ++--
 drivers/spi/spi-wpcm-fiu.c  | 2 +-
 include/linux/spi/spi-mem.h | 2 ++
 10 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 849ccfedbc72..e0b6715e5dfe 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -974,7 +974,7 @@ static int spinand_manufacturer_match(struct spinand_device *spinand,
 		spinand->manufacturer = manufacturer;
 		return 0;
 	}
-	return -ENOTSUPP;
+	return -EOPNOTSUPP;
 }
 
 static int spinand_id_detect(struct spinand_device *spinand)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 1c443fe568cf..87cb2047df80 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3146,7 +3146,7 @@ int spi_nor_set_4byte_addr_mode(struct spi_nor *nor, bool enable)
 	int ret;
 
 	ret = params->set_4byte_addr_mode(nor, enable);
-	if (ret && ret != -ENOTSUPP)
+	if (ret && ret != -EOPNOTSUPP)
 		return ret;
 
 	if (enable) {
diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
index 3d1252566134..370c4d1572ed 100644
--- a/drivers/spi/atmel-quadspi.c
+++ b/drivers/spi/atmel-quadspi.c
@@ -272,7 +272,7 @@ static int atmel_qspi_find_mode(const struct spi_mem_op *op)
 		if (atmel_qspi_is_compatible(op, &atmel_qspi_modes[i]))
 			return i;
 
-	return -ENOTSUPP;
+	return -EOPNOTSUPP;
 }
 
 static bool atmel_qspi_supports_op(struct spi_mem *mem,
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c
index c9f1d1e1dcf7..b7ada981464a 100644
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -146,7 +146,7 @@ static int ath79_exec_mem_op(struct spi_mem *mem,
 	/* Only use for fast-read op. */
 	if (op->cmd.opcode != 0x0b || op->data.dir != SPI_MEM_DATA_IN ||
 	    op->addr.nbytes != 3 || op->dummy.nbytes != 1)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	/* disable GPIO mode */
 	ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0);
diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
index ef08fcac2f6d..d96222e6d7d2 100644
--- a/drivers/spi/spi-bcm-qspi.c
+++ b/drivers/spi/spi-bcm-qspi.c
@@ -1199,7 +1199,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem,
 
 	if (!op->data.nbytes || !op->addr.nbytes || op->addr.nbytes > 4 ||
 	    op->data.dir != SPI_MEM_DATA_IN)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	buf = op->data.buf.in;
 	addr = op->addr.val;
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index edd7430d4c05..2dc8ceb85374 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -323,7 +323,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 		return ret;
 
 	if (!spi_mem_internal_supports_op(mem, op))
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	if (ctlr->mem_ops && ctlr->mem_ops->exec_op && !spi_get_csgpiod(mem->spi, 0)) {
 		ret = spi_mem_access_start(mem);
@@ -339,7 +339,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 		 * read path) and expect the core to use the regular SPI
 		 * interface in other cases.
 		 */
-		if (!ret || ret != -ENOTSUPP)
+		if (!ret || ret != -ENOTSUPP || ret != -EOPNOTSUPP)
 			return ret;
 	}
 
@@ -559,7 +559,7 @@ spi_mem_dirmap_create(struct spi_mem *mem,
 	if (ret) {
 		desc->nodirmap = true;
 		if (!spi_mem_supports_op(desc->mem, &desc->info.op_tmpl))
-			ret = -ENOTSUPP;
+			ret = -EOPNOTSUPP;
 		else
 			ret = 0;
 	}
diff --git a/drivers/spi/spi-npcm-fiu.c b/drivers/spi/spi-npcm-fiu.c
index 03db9f016a11..f3bb8bbc192f 100644
--- a/drivers/spi/spi-npcm-fiu.c
+++ b/drivers/spi/spi-npcm-fiu.c
@@ -556,7 +556,7 @@ static int npcm_fiu_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 		op->data.nbytes);
 
 	if (fiu->spix_mode || op->addr.nbytes > 4)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	if (fiu->clkrate != chip->clkrate) {
 		ret = clk_set_rate(fiu->clk, chip->clkrate);
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 4c81516b67db..0877dc5058a1 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -613,12 +613,12 @@ static int ti_qspi_exec_mem_op(struct spi_mem *mem,
 	/* Only optimize read path. */
 	if (!op->data.nbytes || op->data.dir != SPI_MEM_DATA_IN ||
 	    !op->addr.nbytes || op->addr.nbytes > 4)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	/* Address exceeds MMIO window size, fall back to regular mode. */
 	from = op->addr.val;
 	if (from + op->data.nbytes > qspi->mmap_size)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	mutex_lock(&qspi->list_lock);
 
diff --git a/drivers/spi/spi-wpcm-fiu.c b/drivers/spi/spi-wpcm-fiu.c
index 852ffe013d32..d76f7b5a9b97 100644
--- a/drivers/spi/spi-wpcm-fiu.c
+++ b/drivers/spi/spi-wpcm-fiu.c
@@ -361,7 +361,7 @@ static int wpcm_fiu_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 
 	wpcm_fiu_stall_host(fiu, false);
 
-	return -ENOTSUPP;
+	return -EOPNOTSUPP;
 }
 
 static int wpcm_fiu_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op)
diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
index 6b0a7dc48a4b..f866d5c8ed32 100644
--- a/include/linux/spi/spi-mem.h
+++ b/include/linux/spi/spi-mem.h
@@ -233,6 +233,8 @@ static inline void *spi_mem_get_drvdata(struct spi_mem *mem)
  *		    limitations)
  * @supports_op: check if an operation is supported by the controller
  * @exec_op: execute a SPI memory operation
+ *           not all driver provides supports_op(), so it can return -EOPNOTSUPP
+ *           if the op is not supported by the driver/controller
  * @get_name: get a custom name for the SPI mem device from the controller.
  *	      This might be needed if the controller driver has been ported
  *	      to use the SPI mem layer and a custom name is used to keep
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
@ 2023-11-29  6:43 ` AceLan Kao
  0 siblings, 0 replies; 30+ messages in thread
From: AceLan Kao @ 2023-11-29  6:43 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel

From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>

This commit updates the SPI subsystem, particularly affecting "SPI MEM"
drivers and core parts, by replacing the -ENOTSUPP error code with
-EOPNOTSUPP.

The key motivations for this change are as follows:
1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
might return ENOTSUPP. This update aims to unify the error reporting
within the SPI subsystem for clarity and consistency.

2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
mainly being reserved for NFS-related errors. To align with kernel coding
standards and recommendations, this change is being made.

3. By using EOPNOTSUPP, we provide more specific context to the error,
indicating that a particular operation is not supported. This helps
differentiate from the more generic ENOTSUPP error, allowing drivers to
better handle and respond to different error scenarios.

Risks and Considerations:
While this change is primarily intended as a code cleanup and error code
unification, there is a minor risk of breaking user-space applications
that rely on specific return codes for unsupported operations. However,
this risk is considered low, as such use-cases are unlikely to be common
or critical. Nevertheless, developers and users should be aware of this
change, especially if they have scripts or tools that specifically handle
SPI error codes.

This commit does not introduce any functional changes to the SPI subsystem
or the affected drivers.

Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

---
v5. distinguish -EOPNOTSUPP from -ENOTSUPP
v6. a. spi_nor_set_4byte_addr_mode() should check -EOPNOTSUPP, all
       callbacks of set_4byte_addr_mode() will eventually return
       -EOPNOTSUPP if the checking failed.
    b. Update comment to describe the reason for the patch and the
       affected parts.
    c. Update the kernel-doc of exec_op() in struct spi_controller_mem_ops
v7. added comment for the return code changes may affect userspace, and
    the risk after this change
---
 drivers/mtd/nand/spi/core.c | 2 +-
 drivers/mtd/spi-nor/core.c  | 2 +-
 drivers/spi/atmel-quadspi.c | 2 +-
 drivers/spi/spi-ath79.c     | 2 +-
 drivers/spi/spi-bcm-qspi.c  | 2 +-
 drivers/spi/spi-mem.c       | 6 +++---
 drivers/spi/spi-npcm-fiu.c  | 2 +-
 drivers/spi/spi-ti-qspi.c   | 4 ++--
 drivers/spi/spi-wpcm-fiu.c  | 2 +-
 include/linux/spi/spi-mem.h | 2 ++
 10 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 849ccfedbc72..e0b6715e5dfe 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -974,7 +974,7 @@ static int spinand_manufacturer_match(struct spinand_device *spinand,
 		spinand->manufacturer = manufacturer;
 		return 0;
 	}
-	return -ENOTSUPP;
+	return -EOPNOTSUPP;
 }
 
 static int spinand_id_detect(struct spinand_device *spinand)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 1c443fe568cf..87cb2047df80 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3146,7 +3146,7 @@ int spi_nor_set_4byte_addr_mode(struct spi_nor *nor, bool enable)
 	int ret;
 
 	ret = params->set_4byte_addr_mode(nor, enable);
-	if (ret && ret != -ENOTSUPP)
+	if (ret && ret != -EOPNOTSUPP)
 		return ret;
 
 	if (enable) {
diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
index 3d1252566134..370c4d1572ed 100644
--- a/drivers/spi/atmel-quadspi.c
+++ b/drivers/spi/atmel-quadspi.c
@@ -272,7 +272,7 @@ static int atmel_qspi_find_mode(const struct spi_mem_op *op)
 		if (atmel_qspi_is_compatible(op, &atmel_qspi_modes[i]))
 			return i;
 
-	return -ENOTSUPP;
+	return -EOPNOTSUPP;
 }
 
 static bool atmel_qspi_supports_op(struct spi_mem *mem,
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c
index c9f1d1e1dcf7..b7ada981464a 100644
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -146,7 +146,7 @@ static int ath79_exec_mem_op(struct spi_mem *mem,
 	/* Only use for fast-read op. */
 	if (op->cmd.opcode != 0x0b || op->data.dir != SPI_MEM_DATA_IN ||
 	    op->addr.nbytes != 3 || op->dummy.nbytes != 1)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	/* disable GPIO mode */
 	ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0);
diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
index ef08fcac2f6d..d96222e6d7d2 100644
--- a/drivers/spi/spi-bcm-qspi.c
+++ b/drivers/spi/spi-bcm-qspi.c
@@ -1199,7 +1199,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem,
 
 	if (!op->data.nbytes || !op->addr.nbytes || op->addr.nbytes > 4 ||
 	    op->data.dir != SPI_MEM_DATA_IN)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	buf = op->data.buf.in;
 	addr = op->addr.val;
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index edd7430d4c05..2dc8ceb85374 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -323,7 +323,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 		return ret;
 
 	if (!spi_mem_internal_supports_op(mem, op))
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	if (ctlr->mem_ops && ctlr->mem_ops->exec_op && !spi_get_csgpiod(mem->spi, 0)) {
 		ret = spi_mem_access_start(mem);
@@ -339,7 +339,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 		 * read path) and expect the core to use the regular SPI
 		 * interface in other cases.
 		 */
-		if (!ret || ret != -ENOTSUPP)
+		if (!ret || ret != -ENOTSUPP || ret != -EOPNOTSUPP)
 			return ret;
 	}
 
@@ -559,7 +559,7 @@ spi_mem_dirmap_create(struct spi_mem *mem,
 	if (ret) {
 		desc->nodirmap = true;
 		if (!spi_mem_supports_op(desc->mem, &desc->info.op_tmpl))
-			ret = -ENOTSUPP;
+			ret = -EOPNOTSUPP;
 		else
 			ret = 0;
 	}
diff --git a/drivers/spi/spi-npcm-fiu.c b/drivers/spi/spi-npcm-fiu.c
index 03db9f016a11..f3bb8bbc192f 100644
--- a/drivers/spi/spi-npcm-fiu.c
+++ b/drivers/spi/spi-npcm-fiu.c
@@ -556,7 +556,7 @@ static int npcm_fiu_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 		op->data.nbytes);
 
 	if (fiu->spix_mode || op->addr.nbytes > 4)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	if (fiu->clkrate != chip->clkrate) {
 		ret = clk_set_rate(fiu->clk, chip->clkrate);
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 4c81516b67db..0877dc5058a1 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -613,12 +613,12 @@ static int ti_qspi_exec_mem_op(struct spi_mem *mem,
 	/* Only optimize read path. */
 	if (!op->data.nbytes || op->data.dir != SPI_MEM_DATA_IN ||
 	    !op->addr.nbytes || op->addr.nbytes > 4)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	/* Address exceeds MMIO window size, fall back to regular mode. */
 	from = op->addr.val;
 	if (from + op->data.nbytes > qspi->mmap_size)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	mutex_lock(&qspi->list_lock);
 
diff --git a/drivers/spi/spi-wpcm-fiu.c b/drivers/spi/spi-wpcm-fiu.c
index 852ffe013d32..d76f7b5a9b97 100644
--- a/drivers/spi/spi-wpcm-fiu.c
+++ b/drivers/spi/spi-wpcm-fiu.c
@@ -361,7 +361,7 @@ static int wpcm_fiu_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 
 	wpcm_fiu_stall_host(fiu, false);
 
-	return -ENOTSUPP;
+	return -EOPNOTSUPP;
 }
 
 static int wpcm_fiu_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op)
diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
index 6b0a7dc48a4b..f866d5c8ed32 100644
--- a/include/linux/spi/spi-mem.h
+++ b/include/linux/spi/spi-mem.h
@@ -233,6 +233,8 @@ static inline void *spi_mem_get_drvdata(struct spi_mem *mem)
  *		    limitations)
  * @supports_op: check if an operation is supported by the controller
  * @exec_op: execute a SPI memory operation
+ *           not all driver provides supports_op(), so it can return -EOPNOTSUPP
+ *           if the op is not supported by the driver/controller
  * @get_name: get a custom name for the SPI mem device from the controller.
  *	      This might be needed if the controller driver has been ported
  *	      to use the SPI mem layer and a custom name is used to keep
-- 
2.34.1


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

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
  2023-11-29  6:43 ` AceLan Kao
@ 2023-11-29  6:43   ` AceLan Kao
  -1 siblings, 0 replies; 30+ messages in thread
From: AceLan Kao @ 2023-11-29  6:43 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel

From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>

When the software reset command isn't supported, we now stop reporting
the warning message to avoid unnecessary warnings and potential confusion.

Reviewed-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

---
v2. only lower the priority for the not supported failure
v3. replace ENOTSUPP with EOPNOTSUPP and check the first command only
v4. move the version information below the '---' line
v5. remove dev_warn if soft reset operation is not supported
---
 drivers/mtd/spi-nor/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 87cb2047df80..96a207751cf2 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3237,7 +3237,8 @@ static void spi_nor_soft_reset(struct spi_nor *nor)
 
 	ret = spi_mem_exec_op(nor->spimem, &op);
 	if (ret) {
-		dev_warn(nor->dev, "Software reset failed: %d\n", ret);
+		if (ret != -EOPNOTSUPP)
+			dev_warn(nor->dev, "Software reset failed: %d\n", ret);
 		return;
 	}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
@ 2023-11-29  6:43   ` AceLan Kao
  0 siblings, 0 replies; 30+ messages in thread
From: AceLan Kao @ 2023-11-29  6:43 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel

From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>

When the software reset command isn't supported, we now stop reporting
the warning message to avoid unnecessary warnings and potential confusion.

Reviewed-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

---
v2. only lower the priority for the not supported failure
v3. replace ENOTSUPP with EOPNOTSUPP and check the first command only
v4. move the version information below the '---' line
v5. remove dev_warn if soft reset operation is not supported
---
 drivers/mtd/spi-nor/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 87cb2047df80..96a207751cf2 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3237,7 +3237,8 @@ static void spi_nor_soft_reset(struct spi_nor *nor)
 
 	ret = spi_mem_exec_op(nor->spimem, &op);
 	if (ret) {
-		dev_warn(nor->dev, "Software reset failed: %d\n", ret);
+		if (ret != -EOPNOTSUPP)
+			dev_warn(nor->dev, "Software reset failed: %d\n", ret);
 		return;
 	}
 
-- 
2.34.1


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

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
  2023-11-29  6:43 ` AceLan Kao
@ 2023-11-29  7:05   ` Mika Westerberg
  -1 siblings, 0 replies; 30+ messages in thread
From: Mika Westerberg @ 2023-11-29  7:05 UTC (permalink / raw)
  To: AceLan Kao
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Dhruva Gole, linux-mtd,
	Mark Brown, Kamal Dasu, Jonathan Neuschäfer, Mario Kicherer,
	Chuanhong Guo, linux-spi, linux-kernel

On Wed, Nov 29, 2023 at 02:43:10PM +0800, AceLan Kao wrote:
> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> 2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
> mainly being reserved for NFS-related errors. To align with kernel coding
> standards and recommendations, this change is being made.
> 
> 3. By using EOPNOTSUPP, we provide more specific context to the error,
> indicating that a particular operation is not supported. This helps
> differentiate from the more generic ENOTSUPP error, allowing drivers to
> better handle and respond to different error scenarios.
> 
> Risks and Considerations:
> While this change is primarily intended as a code cleanup and error code
> unification, there is a minor risk of breaking user-space applications
> that rely on specific return codes for unsupported operations. However,
> this risk is considered low, as such use-cases are unlikely to be common
> or critical. Nevertheless, developers and users should be aware of this
> change, especially if they have scripts or tools that specifically handle
> SPI error codes.
> 
> This commit does not introduce any functional changes to the SPI subsystem
> or the affected drivers.
> 
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
@ 2023-11-29  7:05   ` Mika Westerberg
  0 siblings, 0 replies; 30+ messages in thread
From: Mika Westerberg @ 2023-11-29  7:05 UTC (permalink / raw)
  To: AceLan Kao
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Dhruva Gole, linux-mtd,
	Mark Brown, Kamal Dasu, Jonathan Neuschäfer, Mario Kicherer,
	Chuanhong Guo, linux-spi, linux-kernel

On Wed, Nov 29, 2023 at 02:43:10PM +0800, AceLan Kao wrote:
> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> 2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
> mainly being reserved for NFS-related errors. To align with kernel coding
> standards and recommendations, this change is being made.
> 
> 3. By using EOPNOTSUPP, we provide more specific context to the error,
> indicating that a particular operation is not supported. This helps
> differentiate from the more generic ENOTSUPP error, allowing drivers to
> better handle and respond to different error scenarios.
> 
> Risks and Considerations:
> While this change is primarily intended as a code cleanup and error code
> unification, there is a minor risk of breaking user-space applications
> that rely on specific return codes for unsupported operations. However,
> this risk is considered low, as such use-cases are unlikely to be common
> or critical. Nevertheless, developers and users should be aware of this
> change, especially if they have scripts or tools that specifically handle
> SPI error codes.
> 
> This commit does not introduce any functional changes to the SPI subsystem
> or the affected drivers.
> 
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
  2023-11-29  6:43 ` AceLan Kao
@ 2023-11-29  7:38   ` Tudor Ambarus
  -1 siblings, 0 replies; 30+ messages in thread
From: Tudor Ambarus @ 2023-11-29  7:38 UTC (permalink / raw)
  To: AceLan Kao, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel



On 11/29/23 06:43, AceLan Kao wrote:
> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> 2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
> mainly being reserved for NFS-related errors. To align with kernel coding
> standards and recommendations, this change is being made.
> 
> 3. By using EOPNOTSUPP, we provide more specific context to the error,
> indicating that a particular operation is not supported. This helps
> differentiate from the more generic ENOTSUPP error, allowing drivers to
> better handle and respond to different error scenarios.
> 
> Risks and Considerations:
> While this change is primarily intended as a code cleanup and error code
> unification, there is a minor risk of breaking user-space applications
> that rely on specific return codes for unsupported operations. However,
> this risk is considered low, as such use-cases are unlikely to be common
> or critical. Nevertheless, developers and users should be aware of this
> change, especially if they have scripts or tools that specifically handle
> SPI error codes.
> 
> This commit does not introduce any functional changes to the SPI subsystem
> or the affected drivers.
> 
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
> 

I'm fine with the low risk of breaking the MTD related user-space:
Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
@ 2023-11-29  7:38   ` Tudor Ambarus
  0 siblings, 0 replies; 30+ messages in thread
From: Tudor Ambarus @ 2023-11-29  7:38 UTC (permalink / raw)
  To: AceLan Kao, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel



On 11/29/23 06:43, AceLan Kao wrote:
> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> 2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
> mainly being reserved for NFS-related errors. To align with kernel coding
> standards and recommendations, this change is being made.
> 
> 3. By using EOPNOTSUPP, we provide more specific context to the error,
> indicating that a particular operation is not supported. This helps
> differentiate from the more generic ENOTSUPP error, allowing drivers to
> better handle and respond to different error scenarios.
> 
> Risks and Considerations:
> While this change is primarily intended as a code cleanup and error code
> unification, there is a minor risk of breaking user-space applications
> that rely on specific return codes for unsupported operations. However,
> this risk is considered low, as such use-cases are unlikely to be common
> or critical. Nevertheless, developers and users should be aware of this
> change, especially if they have scripts or tools that specifically handle
> SPI error codes.
> 
> This commit does not introduce any functional changes to the SPI subsystem
> or the affected drivers.
> 
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
> 

I'm fine with the low risk of breaking the MTD related user-space:
Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org>

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
  2023-11-29  6:43   ` AceLan Kao
@ 2023-11-29  7:46     ` Tudor Ambarus
  -1 siblings, 0 replies; 30+ messages in thread
From: Tudor Ambarus @ 2023-11-29  7:46 UTC (permalink / raw)
  To: AceLan Kao, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel



On 11/29/23 06:43, AceLan Kao wrote:
> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 

Hi,

> When the software reset command isn't supported, we now stop reporting
> the warning message to avoid unnecessary warnings and potential confusion.
> 
> Reviewed-by: Dhruva Gole <d-gole@ti.com>
> Reviewed-by: Michael Walle <michael@walle.cc>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Acked-by: Pratyush Yadav <pratyush@kernel.org>
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

You haven't specified who shall take these patches. Is it fine for you
if I take just the SPI NOR bits? If you want Mark to queue both:

Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> 
> ---
> v2. only lower the priority for the not supported failure
> v3. replace ENOTSUPP with EOPNOTSUPP and check the first command only
> v4. move the version information below the '---' line
> v5. remove dev_warn if soft reset operation is not supported
> ---
>  drivers/mtd/spi-nor/core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 87cb2047df80..96a207751cf2 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -3237,7 +3237,8 @@ static void spi_nor_soft_reset(struct spi_nor *nor)
>  
>  	ret = spi_mem_exec_op(nor->spimem, &op);
>  	if (ret) {
> -		dev_warn(nor->dev, "Software reset failed: %d\n", ret);
> +		if (ret != -EOPNOTSUPP)
> +			dev_warn(nor->dev, "Software reset failed: %d\n", ret);
>  		return;
>  	}
>  

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
@ 2023-11-29  7:46     ` Tudor Ambarus
  0 siblings, 0 replies; 30+ messages in thread
From: Tudor Ambarus @ 2023-11-29  7:46 UTC (permalink / raw)
  To: AceLan Kao, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel



On 11/29/23 06:43, AceLan Kao wrote:
> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 

Hi,

> When the software reset command isn't supported, we now stop reporting
> the warning message to avoid unnecessary warnings and potential confusion.
> 
> Reviewed-by: Dhruva Gole <d-gole@ti.com>
> Reviewed-by: Michael Walle <michael@walle.cc>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Acked-by: Pratyush Yadav <pratyush@kernel.org>
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

You haven't specified who shall take these patches. Is it fine for you
if I take just the SPI NOR bits? If you want Mark to queue both:

Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> 
> ---
> v2. only lower the priority for the not supported failure
> v3. replace ENOTSUPP with EOPNOTSUPP and check the first command only
> v4. move the version information below the '---' line
> v5. remove dev_warn if soft reset operation is not supported
> ---
>  drivers/mtd/spi-nor/core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 87cb2047df80..96a207751cf2 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -3237,7 +3237,8 @@ static void spi_nor_soft_reset(struct spi_nor *nor)
>  
>  	ret = spi_mem_exec_op(nor->spimem, &op);
>  	if (ret) {
> -		dev_warn(nor->dev, "Software reset failed: %d\n", ret);
> +		if (ret != -EOPNOTSUPP)
> +			dev_warn(nor->dev, "Software reset failed: %d\n", ret);
>  		return;
>  	}
>  

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
  2023-11-29  6:43 ` AceLan Kao
@ 2023-11-29  8:28   ` Michael Walle
  -1 siblings, 0 replies; 30+ messages in thread
From: Michael Walle @ 2023-11-29  8:28 UTC (permalink / raw)
  To: AceLan Kao
  Cc: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Mika Westerberg, Dhruva Gole, linux-mtd,
	Mark Brown, Kamal Dasu, Jonathan Neuschäfer, Mario Kicherer,
	Chuanhong Guo, linux-spi, linux-kernel

> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to 
> spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> 2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
> mainly being reserved for NFS-related errors. To align with kernel 
> coding
> standards and recommendations, this change is being made.
> 
> 3. By using EOPNOTSUPP, we provide more specific context to the error,
> indicating that a particular operation is not supported. This helps
> differentiate from the more generic ENOTSUPP error, allowing drivers to
> better handle and respond to different error scenarios.
> 
> Risks and Considerations:
> While this change is primarily intended as a code cleanup and error 
> code
> unification, there is a minor risk of breaking user-space applications
> that rely on specific return codes for unsupported operations. However,
> this risk is considered low, as such use-cases are unlikely to be 
> common
> or critical. Nevertheless, developers and users should be aware of this
> change, especially if they have scripts or tools that specifically 
> handle
> SPI error codes.
> 
> This commit does not introduce any functional changes to the SPI 
> subsystem
> or the affected drivers.
> 
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

Acked-by: Michael Walle <michael@walle.cc>

-michael

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
@ 2023-11-29  8:28   ` Michael Walle
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Walle @ 2023-11-29  8:28 UTC (permalink / raw)
  To: AceLan Kao
  Cc: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Mika Westerberg, Dhruva Gole, linux-mtd,
	Mark Brown, Kamal Dasu, Jonathan Neuschäfer, Mario Kicherer,
	Chuanhong Guo, linux-spi, linux-kernel

> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to 
> spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> 2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
> mainly being reserved for NFS-related errors. To align with kernel 
> coding
> standards and recommendations, this change is being made.
> 
> 3. By using EOPNOTSUPP, we provide more specific context to the error,
> indicating that a particular operation is not supported. This helps
> differentiate from the more generic ENOTSUPP error, allowing drivers to
> better handle and respond to different error scenarios.
> 
> Risks and Considerations:
> While this change is primarily intended as a code cleanup and error 
> code
> unification, there is a minor risk of breaking user-space applications
> that rely on specific return codes for unsupported operations. However,
> this risk is considered low, as such use-cases are unlikely to be 
> common
> or critical. Nevertheless, developers and users should be aware of this
> change, especially if they have scripts or tools that specifically 
> handle
> SPI error codes.
> 
> This commit does not introduce any functional changes to the SPI 
> subsystem
> or the affected drivers.
> 
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

Acked-by: Michael Walle <michael@walle.cc>

-michael

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
  2023-11-29  6:43 ` AceLan Kao
@ 2023-11-29  8:39   ` Miquel Raynal
  -1 siblings, 0 replies; 30+ messages in thread
From: Miquel Raynal @ 2023-11-29  8:39 UTC (permalink / raw)
  To: AceLan Kao
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Richard Weinberger,
	Vignesh Raghavendra, Mika Westerberg, Dhruva Gole, linux-mtd,
	Mark Brown, Kamal Dasu, Jonathan Neuschäfer, Mario Kicherer,
	Chuanhong Guo, linux-spi, linux-kernel

Hello,

acelan.kao@canonical.com wrote on Wed, 29 Nov 2023 14:43:10 +0800:

> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> 2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
> mainly being reserved for NFS-related errors. To align with kernel coding
> standards and recommendations, this change is being made.
> 
> 3. By using EOPNOTSUPP, we provide more specific context to the error,
> indicating that a particular operation is not supported. This helps
> differentiate from the more generic ENOTSUPP error, allowing drivers to
> better handle and respond to different error scenarios.
> 
> Risks and Considerations:
> While this change is primarily intended as a code cleanup and error code
> unification, there is a minor risk of breaking user-space applications
> that rely on specific return codes for unsupported operations. However,
> this risk is considered low, as such use-cases are unlikely to be common
> or critical. Nevertheless, developers and users should be aware of this
> change, especially if they have scripts or tools that specifically handle
> SPI error codes.
> 
> This commit does not introduce any functional changes to the SPI subsystem
> or the affected drivers.
> 
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
> 
> ---
> v5. distinguish -EOPNOTSUPP from -ENOTSUPP
> v6. a. spi_nor_set_4byte_addr_mode() should check -EOPNOTSUPP, all
>        callbacks of set_4byte_addr_mode() will eventually return
>        -EOPNOTSUPP if the checking failed.
>     b. Update comment to describe the reason for the patch and the
>        affected parts.
>     c. Update the kernel-doc of exec_op() in struct spi_controller_mem_ops
> v7. added comment for the return code changes may affect userspace, and
>     the risk after this change
> ---

Looks sensible to me, let's make the conversion.

Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
@ 2023-11-29  8:39   ` Miquel Raynal
  0 siblings, 0 replies; 30+ messages in thread
From: Miquel Raynal @ 2023-11-29  8:39 UTC (permalink / raw)
  To: AceLan Kao
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Richard Weinberger,
	Vignesh Raghavendra, Mika Westerberg, Dhruva Gole, linux-mtd,
	Mark Brown, Kamal Dasu, Jonathan Neuschäfer, Mario Kicherer,
	Chuanhong Guo, linux-spi, linux-kernel

Hello,

acelan.kao@canonical.com wrote on Wed, 29 Nov 2023 14:43:10 +0800:

> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> 2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
> mainly being reserved for NFS-related errors. To align with kernel coding
> standards and recommendations, this change is being made.
> 
> 3. By using EOPNOTSUPP, we provide more specific context to the error,
> indicating that a particular operation is not supported. This helps
> differentiate from the more generic ENOTSUPP error, allowing drivers to
> better handle and respond to different error scenarios.
> 
> Risks and Considerations:
> While this change is primarily intended as a code cleanup and error code
> unification, there is a minor risk of breaking user-space applications
> that rely on specific return codes for unsupported operations. However,
> this risk is considered low, as such use-cases are unlikely to be common
> or critical. Nevertheless, developers and users should be aware of this
> change, especially if they have scripts or tools that specifically handle
> SPI error codes.
> 
> This commit does not introduce any functional changes to the SPI subsystem
> or the affected drivers.
> 
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
> 
> ---
> v5. distinguish -EOPNOTSUPP from -ENOTSUPP
> v6. a. spi_nor_set_4byte_addr_mode() should check -EOPNOTSUPP, all
>        callbacks of set_4byte_addr_mode() will eventually return
>        -EOPNOTSUPP if the checking failed.
>     b. Update comment to describe the reason for the patch and the
>        affected parts.
>     c. Update the kernel-doc of exec_op() in struct spi_controller_mem_ops
> v7. added comment for the return code changes may affect userspace, and
>     the risk after this change
> ---

Looks sensible to me, let's make the conversion.

Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
  2023-11-29  6:43   ` AceLan Kao
@ 2023-11-29  8:40     ` Miquel Raynal
  -1 siblings, 0 replies; 30+ messages in thread
From: Miquel Raynal @ 2023-11-29  8:40 UTC (permalink / raw)
  To: AceLan Kao
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Richard Weinberger,
	Vignesh Raghavendra, Mika Westerberg, Dhruva Gole, linux-mtd,
	Mark Brown, Kamal Dasu, Jonathan Neuschäfer, Mario Kicherer,
	Chuanhong Guo, linux-spi, linux-kernel

Hi AceLan,

acelan.kao@canonical.com wrote on Wed, 29 Nov 2023 14:43:11 +0800:

> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> When the software reset command isn't supported, we now stop reporting
> the warning message to avoid unnecessary warnings and potential confusion.
> 
> Reviewed-by: Dhruva Gole <d-gole@ti.com>
> Reviewed-by: Michael Walle <michael@walle.cc>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Acked-by: Pratyush Yadav <pratyush@kernel.org>
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
@ 2023-11-29  8:40     ` Miquel Raynal
  0 siblings, 0 replies; 30+ messages in thread
From: Miquel Raynal @ 2023-11-29  8:40 UTC (permalink / raw)
  To: AceLan Kao
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Richard Weinberger,
	Vignesh Raghavendra, Mika Westerberg, Dhruva Gole, linux-mtd,
	Mark Brown, Kamal Dasu, Jonathan Neuschäfer, Mario Kicherer,
	Chuanhong Guo, linux-spi, linux-kernel

Hi AceLan,

acelan.kao@canonical.com wrote on Wed, 29 Nov 2023 14:43:11 +0800:

> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> When the software reset command isn't supported, we now stop reporting
> the warning message to avoid unnecessary warnings and potential confusion.
> 
> Reviewed-by: Dhruva Gole <d-gole@ti.com>
> Reviewed-by: Michael Walle <michael@walle.cc>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Acked-by: Pratyush Yadav <pratyush@kernel.org>
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
  2023-11-29  7:46     ` Tudor Ambarus
@ 2023-11-29 21:19       ` Mark Brown
  -1 siblings, 0 replies; 30+ messages in thread
From: Mark Brown @ 2023-11-29 21:19 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: AceLan Kao, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Kamal Dasu, Jonathan Neuschäfer,
	Mario Kicherer, Chuanhong Guo, linux-spi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

On Wed, Nov 29, 2023 at 07:46:02AM +0000, Tudor Ambarus wrote:

> You haven't specified who shall take these patches. Is it fine for you
> if I take just the SPI NOR bits? If you want Mark to queue both:

I can certainly take both.  I guess there's no build time dependency so
we could each take the subsystem specific patch, though there'd be some
bisection drift if that happens?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
@ 2023-11-29 21:19       ` Mark Brown
  0 siblings, 0 replies; 30+ messages in thread
From: Mark Brown @ 2023-11-29 21:19 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: AceLan Kao, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Kamal Dasu, Jonathan Neuschäfer,
	Mario Kicherer, Chuanhong Guo, linux-spi, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 382 bytes --]

On Wed, Nov 29, 2023 at 07:46:02AM +0000, Tudor Ambarus wrote:

> You haven't specified who shall take these patches. Is it fine for you
> if I take just the SPI NOR bits? If you want Mark to queue both:

I can certainly take both.  I guess there's no build time dependency so
we could each take the subsystem specific patch, though there'd be some
bisection drift if that happens?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
  2023-11-29 21:19       ` Mark Brown
@ 2023-11-30  2:27         ` AceLan Kao
  -1 siblings, 0 replies; 30+ messages in thread
From: AceLan Kao @ 2023-11-30  2:27 UTC (permalink / raw)
  To: Mark Brown
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Kamal Dasu, Jonathan Neuschäfer,
	Mario Kicherer, Chuanhong Guo, linux-spi, linux-kernel

Mark Brown <broonie@kernel.org> 於 2023年11月30日 週四 上午5:19寫道:
>
> On Wed, Nov 29, 2023 at 07:46:02AM +0000, Tudor Ambarus wrote:
>
> > You haven't specified who shall take these patches. Is it fine for you
> > if I take just the SPI NOR bits? If you want Mark to queue both:
>
> I can certainly take both.  I guess there's no build time dependency so
> we could each take the subsystem specific patch, though there'd be some
> bisection drift if that happens?
Hi Mark,

It'd be better if you could take both of them.
Thanks.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
@ 2023-11-30  2:27         ` AceLan Kao
  0 siblings, 0 replies; 30+ messages in thread
From: AceLan Kao @ 2023-11-30  2:27 UTC (permalink / raw)
  To: Mark Brown
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Kamal Dasu, Jonathan Neuschäfer,
	Mario Kicherer, Chuanhong Guo, linux-spi, linux-kernel

Mark Brown <broonie@kernel.org> 於 2023年11月30日 週四 上午5:19寫道:
>
> On Wed, Nov 29, 2023 at 07:46:02AM +0000, Tudor Ambarus wrote:
>
> > You haven't specified who shall take these patches. Is it fine for you
> > if I take just the SPI NOR bits? If you want Mark to queue both:
>
> I can certainly take both.  I guess there's no build time dependency so
> we could each take the subsystem specific patch, though there'd be some
> bisection drift if that happens?
Hi Mark,

It'd be better if you could take both of them.
Thanks.

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
  2023-11-29 21:19       ` Mark Brown
@ 2023-11-30  9:20         ` Tudor Ambarus
  -1 siblings, 0 replies; 30+ messages in thread
From: Tudor Ambarus @ 2023-11-30  9:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: AceLan Kao, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Kamal Dasu, Jonathan Neuschäfer,
	Mario Kicherer, Chuanhong Guo, linux-spi, linux-kernel



On 11/29/23 21:19, Mark Brown wrote:
> On Wed, Nov 29, 2023 at 07:46:02AM +0000, Tudor Ambarus wrote:
> 
>> You haven't specified who shall take these patches. Is it fine for you
>> if I take just the SPI NOR bits? If you want Mark to queue both:
> 
> I can certainly take both.  I guess there's no build time dependency so
> we could each take the subsystem specific patch, though there'd be some
> bisection drift if that happens?

Right, please take both then. Thanks!

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
@ 2023-11-30  9:20         ` Tudor Ambarus
  0 siblings, 0 replies; 30+ messages in thread
From: Tudor Ambarus @ 2023-11-30  9:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: AceLan Kao, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Kamal Dasu, Jonathan Neuschäfer,
	Mario Kicherer, Chuanhong Guo, linux-spi, linux-kernel



On 11/29/23 21:19, Mark Brown wrote:
> On Wed, Nov 29, 2023 at 07:46:02AM +0000, Tudor Ambarus wrote:
> 
>> You haven't specified who shall take these patches. Is it fine for you
>> if I take just the SPI NOR bits? If you want Mark to queue both:
> 
> I can certainly take both.  I guess there's no build time dependency so
> we could each take the subsystem specific patch, though there'd be some
> bisection drift if that happens?

Right, please take both then. Thanks!

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
  2023-11-29  6:43 ` AceLan Kao
@ 2023-11-30 14:19   ` Mark Brown
  -1 siblings, 0 replies; 30+ messages in thread
From: Mark Brown @ 2023-11-30 14:19 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Kamal Dasu, Jonathan Neuschäfer,
	Mario Kicherer, Chuanhong Guo, linux-spi, linux-kernel,
	AceLan Kao

On Wed, 29 Nov 2023 14:43:10 +0800, AceLan Kao wrote:
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
      commit: cff49d58f57e5667c10a0db85d7461790bb85cf8
[2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
      commit: 7a030abc0185b30a3fd19a7431347c6f5a82c588

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
@ 2023-11-30 14:19   ` Mark Brown
  0 siblings, 0 replies; 30+ messages in thread
From: Mark Brown @ 2023-11-30 14:19 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Kamal Dasu, Jonathan Neuschäfer,
	Mario Kicherer, Chuanhong Guo, linux-spi, linux-kernel,
	AceLan Kao

On Wed, 29 Nov 2023 14:43:10 +0800, AceLan Kao wrote:
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
      commit: cff49d58f57e5667c10a0db85d7461790bb85cf8
[2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
      commit: 7a030abc0185b30a3fd19a7431347c6f5a82c588

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
  2023-11-29  6:43 ` AceLan Kao
@ 2024-03-13 15:40   ` Florian Fainelli
  -1 siblings, 0 replies; 30+ messages in thread
From: Florian Fainelli @ 2024-03-13 15:40 UTC (permalink / raw)
  To: AceLan Kao, Tudor Ambarus, Pratyush Yadav, Michael Walle,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Mika Westerberg, Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1979 bytes --]

On 11/28/2023 10:43 PM, AceLan Kao wrote:
> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> 2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
> mainly being reserved for NFS-related errors. To align with kernel coding
> standards and recommendations, this change is being made.
> 
> 3. By using EOPNOTSUPP, we provide more specific context to the error,
> indicating that a particular operation is not supported. This helps
> differentiate from the more generic ENOTSUPP error, allowing drivers to
> better handle and respond to different error scenarios.
> 
> Risks and Considerations:
> While this change is primarily intended as a code cleanup and error code
> unification, there is a minor risk of breaking user-space applications
> that rely on specific return codes for unsupported operations. However,
> this risk is considered low, as such use-cases are unlikely to be common
> or critical. Nevertheless, developers and users should be aware of this
> change, especially if they have scripts or tools that specifically handle
> SPI error codes.
> 
> This commit does not introduce any functional changes to the SPI subsystem
> or the affected drivers.
> 
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

This patch breaks SPI probing with spi-bcm-qspi.c on v6.8 and beyond:

[    2.196300] brcmstb_qspi f0440920.qspi: using bspi-mspi mode
[    2.210295] spi-nor: probe of spi1.0 failed with error -95

I am still going down drivers/mtd/spi-nor/core.c to figure out where 
this broke.
-- 
Florian

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
@ 2024-03-13 15:40   ` Florian Fainelli
  0 siblings, 0 replies; 30+ messages in thread
From: Florian Fainelli @ 2024-03-13 15:40 UTC (permalink / raw)
  To: AceLan Kao, Tudor Ambarus, Pratyush Yadav, Michael Walle,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Mika Westerberg, Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1979 bytes --]

On 11/28/2023 10:43 PM, AceLan Kao wrote:
> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> 
> This commit updates the SPI subsystem, particularly affecting "SPI MEM"
> drivers and core parts, by replacing the -ENOTSUPP error code with
> -EOPNOTSUPP.
> 
> The key motivations for this change are as follows:
> 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
> might return ENOTSUPP. This update aims to unify the error reporting
> within the SPI subsystem for clarity and consistency.
> 
> 2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
> mainly being reserved for NFS-related errors. To align with kernel coding
> standards and recommendations, this change is being made.
> 
> 3. By using EOPNOTSUPP, we provide more specific context to the error,
> indicating that a particular operation is not supported. This helps
> differentiate from the more generic ENOTSUPP error, allowing drivers to
> better handle and respond to different error scenarios.
> 
> Risks and Considerations:
> While this change is primarily intended as a code cleanup and error code
> unification, there is a minor risk of breaking user-space applications
> that rely on specific return codes for unsupported operations. However,
> this risk is considered low, as such use-cases are unlikely to be common
> or critical. Nevertheless, developers and users should be aware of this
> change, especially if they have scripts or tools that specifically handle
> SPI error codes.
> 
> This commit does not introduce any functional changes to the SPI subsystem
> or the affected drivers.
> 
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>

This patch breaks SPI probing with spi-bcm-qspi.c on v6.8 and beyond:

[    2.196300] brcmstb_qspi f0440920.qspi: using bspi-mspi mode
[    2.210295] spi-nor: probe of spi1.0 failed with error -95

I am still going down drivers/mtd/spi-nor/core.c to figure out where 
this broke.
-- 
Florian

[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
  2023-11-29  6:43 ` AceLan Kao
@ 2024-03-13 15:56   ` Michael Walle
  -1 siblings, 0 replies; 30+ messages in thread
From: Michael Walle @ 2024-03-13 15:56 UTC (permalink / raw)
  To: AceLan Kao, Tudor Ambarus, Pratyush Yadav, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel
  Cc: Florian Fainelli


[-- Attachment #1.1: Type: text/plain, Size: 715 bytes --]

Hi,

I just had a quick look to see where Florians breakage could come
from and just noticed this:

> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index 849ccfedbc72..e0b6715e5dfe 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -974,7 +974,7 @@ static int spinand_manufacturer_match(struct spinand_device *spinand,
>  		spinand->manufacturer = manufacturer;
>  		return 0;
>  	}
> -	return -ENOTSUPP;
> +	return -EOPNOTSUPP;
>  }
>  
>  static int spinand_id_detect(struct spinand_device *spinand)

This seems to be random as no other spi-nand ENOTSUPP was converted
but just this. Is there a reason for this, AceLan?

-michael

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
@ 2024-03-13 15:56   ` Michael Walle
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Walle @ 2024-03-13 15:56 UTC (permalink / raw)
  To: AceLan Kao, Tudor Ambarus, Pratyush Yadav, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
	Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel
  Cc: Florian Fainelli

[-- Attachment #1: Type: text/plain, Size: 715 bytes --]

Hi,

I just had a quick look to see where Florians breakage could come
from and just noticed this:

> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index 849ccfedbc72..e0b6715e5dfe 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -974,7 +974,7 @@ static int spinand_manufacturer_match(struct spinand_device *spinand,
>  		spinand->manufacturer = manufacturer;
>  		return 0;
>  	}
> -	return -ENOTSUPP;
> +	return -EOPNOTSUPP;
>  }
>  
>  static int spinand_id_detect(struct spinand_device *spinand)

This seems to be random as no other spi-nand ENOTSUPP was converted
but just this. Is there a reason for this, AceLan?

-michael

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
  2024-03-13 15:56   ` Michael Walle
@ 2024-03-13 17:13     ` Florian Fainelli
  -1 siblings, 0 replies; 30+ messages in thread
From: Florian Fainelli @ 2024-03-13 17:13 UTC (permalink / raw)
  To: Michael Walle, AceLan Kao, Tudor Ambarus, Pratyush Yadav,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Mika Westerberg, Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 953 bytes --]

On 3/13/24 08:56, Michael Walle wrote:
> Hi,
> 
> I just had a quick look to see where Florians breakage could come
> from and just noticed this:
> 
>> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
>> index 849ccfedbc72..e0b6715e5dfe 100644
>> --- a/drivers/mtd/nand/spi/core.c
>> +++ b/drivers/mtd/nand/spi/core.c
>> @@ -974,7 +974,7 @@ static int spinand_manufacturer_match(struct spinand_device *spinand,
>>   		spinand->manufacturer = manufacturer;
>>   		return 0;
>>   	}
>> -	return -ENOTSUPP;
>> +	return -EOPNOTSUPP;
>>   }
>>   
>>   static int spinand_id_detect(struct spinand_device *spinand)
> 
> This seems to be random as no other spi-nand ENOTSUPP was converted
> but just this. Is there a reason for this, AceLan?

FWIW, we do not have any SPI-NAND flashes on those boards only SPI-NOR, 
just posted a fix for this:

https://lore.kernel.org/r/20240313171050.3505620-1-florian.fainelli@broadcom.com
-- 
Florian


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
@ 2024-03-13 17:13     ` Florian Fainelli
  0 siblings, 0 replies; 30+ messages in thread
From: Florian Fainelli @ 2024-03-13 17:13 UTC (permalink / raw)
  To: Michael Walle, AceLan Kao, Tudor Ambarus, Pratyush Yadav,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Mika Westerberg, Dhruva Gole, linux-mtd, Mark Brown, Kamal Dasu,
	Jonathan Neuschäfer, Mario Kicherer, Chuanhong Guo,
	linux-spi, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 953 bytes --]

On 3/13/24 08:56, Michael Walle wrote:
> Hi,
> 
> I just had a quick look to see where Florians breakage could come
> from and just noticed this:
> 
>> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
>> index 849ccfedbc72..e0b6715e5dfe 100644
>> --- a/drivers/mtd/nand/spi/core.c
>> +++ b/drivers/mtd/nand/spi/core.c
>> @@ -974,7 +974,7 @@ static int spinand_manufacturer_match(struct spinand_device *spinand,
>>   		spinand->manufacturer = manufacturer;
>>   		return 0;
>>   	}
>> -	return -ENOTSUPP;
>> +	return -EOPNOTSUPP;
>>   }
>>   
>>   static int spinand_id_detect(struct spinand_device *spinand)
> 
> This seems to be random as no other spi-nand ENOTSUPP was converted
> but just this. Is there a reason for this, AceLan?

FWIW, we do not have any SPI-NAND flashes on those boards only SPI-NOR, 
just posted a fix for this:

https://lore.kernel.org/r/20240313171050.3505620-1-florian.fainelli@broadcom.com
-- 
Florian


[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2024-03-13 17:13 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-29  6:43 [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP AceLan Kao
2023-11-29  6:43 ` AceLan Kao
2023-11-29  6:43 ` [PATCH v7 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported AceLan Kao
2023-11-29  6:43   ` AceLan Kao
2023-11-29  7:46   ` Tudor Ambarus
2023-11-29  7:46     ` Tudor Ambarus
2023-11-29 21:19     ` Mark Brown
2023-11-29 21:19       ` Mark Brown
2023-11-30  2:27       ` AceLan Kao
2023-11-30  2:27         ` AceLan Kao
2023-11-30  9:20       ` Tudor Ambarus
2023-11-30  9:20         ` Tudor Ambarus
2023-11-29  8:40   ` Miquel Raynal
2023-11-29  8:40     ` Miquel Raynal
2023-11-29  7:05 ` [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP Mika Westerberg
2023-11-29  7:05   ` Mika Westerberg
2023-11-29  7:38 ` Tudor Ambarus
2023-11-29  7:38   ` Tudor Ambarus
2023-11-29  8:28 ` Michael Walle
2023-11-29  8:28   ` Michael Walle
2023-11-29  8:39 ` Miquel Raynal
2023-11-29  8:39   ` Miquel Raynal
2023-11-30 14:19 ` Mark Brown
2023-11-30 14:19   ` Mark Brown
2024-03-13 15:40 ` Florian Fainelli
2024-03-13 15:40   ` Florian Fainelli
2024-03-13 15:56 ` Michael Walle
2024-03-13 15:56   ` Michael Walle
2024-03-13 17:13   ` Florian Fainelli
2024-03-13 17:13     ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.