* [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking
@ 2023-11-08 9:43 AceLan Kao
2023-11-08 9:43 ` [PATCH v5 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported AceLan Kao
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: AceLan Kao @ 2023-11-08 9:43 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
Dhruva Gole, linux-mtd, linux-kernel
From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
No functional changes are introduced by this patch; it's a code cleanup
to use the correct error code.
Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
---
v5. distinguish -EOPNOTSUPP from -ENOTSUPP
---
drivers/mtd/nand/spi/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 +-
8 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 393ff37f0d23..d1df5cd401cf 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -973,7 +973,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/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)
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v5 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
2023-11-08 9:43 [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking AceLan Kao
@ 2023-11-08 9:43 ` AceLan Kao
2023-11-09 10:57 ` Michael Walle
2023-11-10 5:39 ` Mika Westerberg
2023-11-09 10:56 ` [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking Michael Walle
2023-11-10 5:37 ` Mika Westerberg
2 siblings, 2 replies; 10+ messages in thread
From: AceLan Kao @ 2023-11-08 9:43 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
Dhruva Gole, linux-mtd, 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>
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 1b0c6770c14e..75bac1418045 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3252,7 +3252,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] 10+ messages in thread* Re: [PATCH v5 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
2023-11-08 9:43 ` [PATCH v5 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported AceLan Kao
@ 2023-11-09 10:57 ` Michael Walle
2023-11-13 12:44 ` Pratyush Yadav
2023-11-10 5:39 ` Mika Westerberg
1 sibling, 1 reply; 10+ messages in thread
From: Michael Walle @ 2023-11-09 10:57 UTC (permalink / raw)
To: AceLan Kao
Cc: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Mika Westerberg, Dhruva Gole, linux-mtd,
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>
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Reviewed-by: Michael Walle <michael@walle.cc>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
2023-11-09 10:57 ` Michael Walle
@ 2023-11-13 12:44 ` Pratyush Yadav
0 siblings, 0 replies; 10+ messages in thread
From: Pratyush Yadav @ 2023-11-13 12:44 UTC (permalink / raw)
To: Michael Walle
Cc: AceLan Kao, Tudor Ambarus, Pratyush Yadav, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Mika Westerberg,
Dhruva Gole, linux-mtd, linux-kernel
Hi Michael,
On Thu, Nov 09 2023, Michael Walle wrote:
>> 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>
>> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
>
> Reviewed-by: Michael Walle <michael@walle.cc>
I did read your reply on the previous thread but did not find time to
write a response. I do largely see sense in your argument though I have
not fully thought it through yet. But I think it would be great if we
can ask the controller "do we need to do a soft reset?"
Anyway, I do not think this patch does anything too bad so it is
probably not worth debating so much on. So for now,
Acked-by: Pratyush Yadav <pratyush@kernel.org>
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported
2023-11-08 9:43 ` [PATCH v5 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported AceLan Kao
2023-11-09 10:57 ` Michael Walle
@ 2023-11-10 5:39 ` Mika Westerberg
1 sibling, 0 replies; 10+ messages in thread
From: Mika Westerberg @ 2023-11-10 5:39 UTC (permalink / raw)
To: AceLan Kao
Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Dhruva Gole, linux-mtd,
linux-kernel
On Wed, Nov 08, 2023 at 05:43:03PM +0800, AceLan Kao wrote:
> 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>
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Looks good to me, only small comment is that perhaps you want to update
the kernel-doc of spi_mem_exec_op() to mention that if the
driver/controller does not support reset it can return -EOPNOTSUPP.
In any case,
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking
2023-11-08 9:43 [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking AceLan Kao
2023-11-08 9:43 ` [PATCH v5 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported AceLan Kao
@ 2023-11-09 10:56 ` Michael Walle
2023-11-10 10:22 ` AceLan Kao
2023-11-10 5:37 ` Mika Westerberg
2 siblings, 1 reply; 10+ messages in thread
From: Michael Walle @ 2023-11-09 10:56 UTC (permalink / raw)
To: AceLan Kao
Cc: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Mika Westerberg, Dhruva Gole, linux-mtd,
linux-kernel
Hi,
Am 2023-11-08 10:43, schrieb AceLan Kao:
> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
>
> No functional changes are introduced by this patch; it's a code cleanup
> to use the correct error code.
This error code might be returned to userspace (I guess?).
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
>
> ---
> v5. distinguish -EOPNOTSUPP from -ENOTSUPP
> ---
> drivers/mtd/nand/spi/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 +-
This is missing a user in spi-nor/core.c (in
spi_nor_set_4byte_addr_mode()).
-michael
> 8 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index 393ff37f0d23..d1df5cd401cf 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -973,7 +973,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/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)
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking
2023-11-09 10:56 ` [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking Michael Walle
@ 2023-11-10 10:22 ` AceLan Kao
0 siblings, 0 replies; 10+ messages in thread
From: AceLan Kao @ 2023-11-10 10:22 UTC (permalink / raw)
To: Michael Walle
Cc: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Mika Westerberg, Dhruva Gole, linux-mtd,
linux-kernel
Hi Michael,
Michael Walle <michael@walle.cc> 於 2023年11月9日 週四 下午6:56寫道:
>
> Hi,
>
> Am 2023-11-08 10:43, schrieb AceLan Kao:
> > From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> >
> > No functional changes are introduced by this patch; it's a code cleanup
> > to use the correct error code.
>
> This error code might be returned to userspace (I guess?).
It's not likely the value will be returned to userspace.
I didn't find a path that the value will go to usepsace.
>
> > Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
> >
> > ---
> > v5. distinguish -EOPNOTSUPP from -ENOTSUPP
> > ---
> > drivers/mtd/nand/spi/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 +-
>
> This is missing a user in spi-nor/core.c (in
> spi_nor_set_4byte_addr_mode()).
Right, we should change the check to -EOPNOTSUPP
>
> -michael
>
> > 8 files changed, 11 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> > index 393ff37f0d23..d1df5cd401cf 100644
> > --- a/drivers/mtd/nand/spi/core.c
> > +++ b/drivers/mtd/nand/spi/core.c
> > @@ -973,7 +973,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/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)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking
2023-11-08 9:43 [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking AceLan Kao
2023-11-08 9:43 ` [PATCH v5 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported AceLan Kao
2023-11-09 10:56 ` [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking Michael Walle
@ 2023-11-10 5:37 ` Mika Westerberg
2023-11-10 10:25 ` AceLan Kao
2 siblings, 1 reply; 10+ messages in thread
From: Mika Westerberg @ 2023-11-10 5:37 UTC (permalink / raw)
To: AceLan Kao
Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Dhruva Gole, linux-mtd,
linux-kernel
Hi,
On Wed, Nov 08, 2023 at 05:43:02PM +0800, AceLan Kao wrote:
> From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
>
> No functional changes are introduced by this patch; it's a code cleanup
> to use the correct error code.
Probably good to mention here that this affect only the "SPI MEM"
drivers and the core parts. Also you could explain here that the reaosn
for this is to make sure we use unified "operation not supported" return
code accross these.
Does some kernel-doc need updating as well to make sure the future
drivers will return the correct one if they do not support given
optional operations?
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
>
> ---
> v5. distinguish -EOPNOTSUPP from -ENOTSUPP
> ---
> drivers/mtd/nand/spi/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 +-
I think you should include the SPI subsystem maintainer as well, at
least for visibility.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking
2023-11-10 5:37 ` Mika Westerberg
@ 2023-11-10 10:25 ` AceLan Kao
2023-11-10 10:37 ` Mika Westerberg
0 siblings, 1 reply; 10+ messages in thread
From: AceLan Kao @ 2023-11-10 10:25 UTC (permalink / raw)
To: Mika Westerberg
Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Dhruva Gole, linux-mtd,
linux-kernel
Hi Mika,
Mika Westerberg <mika.westerberg@linux.intel.com> 於 2023年11月10日 週五 下午1:37寫道:
>
> Hi,
>
> On Wed, Nov 08, 2023 at 05:43:02PM +0800, AceLan Kao wrote:
> > From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> >
> > No functional changes are introduced by this patch; it's a code cleanup
> > to use the correct error code.
>
> Probably good to mention here that this affect only the "SPI MEM"
> drivers and the core parts. Also you could explain here that the reaosn
> for this is to make sure we use unified "operation not supported" return
> code accross these.
Got it.
>
> Does some kernel-doc need updating as well to make sure the future
> drivers will return the correct one if they do not support given
> optional operations?
I have no idea where to add this, do you mean add a section in
Documentation/spi/spi-summary.rst?
>
> > Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
> >
> > ---
> > v5. distinguish -EOPNOTSUPP from -ENOTSUPP
> > ---
> > drivers/mtd/nand/spi/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 +-
>
> I think you should include the SPI subsystem maintainer as well, at
> least for visibility.
Right, I should CC them.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking
2023-11-10 10:25 ` AceLan Kao
@ 2023-11-10 10:37 ` Mika Westerberg
0 siblings, 0 replies; 10+ messages in thread
From: Mika Westerberg @ 2023-11-10 10:37 UTC (permalink / raw)
To: AceLan Kao
Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Dhruva Gole, linux-mtd,
linux-kernel
On Fri, Nov 10, 2023 at 06:25:41PM +0800, AceLan Kao wrote:
> Hi Mika,
>
> Mika Westerberg <mika.westerberg@linux.intel.com> 於 2023年11月10日 週五 下午1:37寫道:
> >
> > Hi,
> >
> > On Wed, Nov 08, 2023 at 05:43:02PM +0800, AceLan Kao wrote:
> > > From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
> > >
> > > No functional changes are introduced by this patch; it's a code cleanup
> > > to use the correct error code.
> >
> > Probably good to mention here that this affect only the "SPI MEM"
> > drivers and the core parts. Also you could explain here that the reaosn
> > for this is to make sure we use unified "operation not supported" return
> > code accross these.
> Got it.
> >
> > Does some kernel-doc need updating as well to make sure the future
> > drivers will return the correct one if they do not support given
> > optional operations?
> I have no idea where to add this, do you mean add a section in
> Documentation/spi/spi-summary.rst?
I mean in include/linux/spi/spi-mem.h kernel-doc of struct
spi_controller_mem_ops perhaps? Or kernel-doc of spi_mem_exec_op()?
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-11-13 12:44 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-08 9:43 [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking AceLan Kao
2023-11-08 9:43 ` [PATCH v5 2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported AceLan Kao
2023-11-09 10:57 ` Michael Walle
2023-11-13 12:44 ` Pratyush Yadav
2023-11-10 5:39 ` Mika Westerberg
2023-11-09 10:56 ` [PATCH v5 1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking Michael Walle
2023-11-10 10:22 ` AceLan Kao
2023-11-10 5:37 ` Mika Westerberg
2023-11-10 10:25 ` AceLan Kao
2023-11-10 10:37 ` Mika Westerberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox