summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2024-05-22 16:52:53 +0200
committerMark Brown <broonie@kernel.org>2024-05-27 01:33:05 +0100
commit5e657a8e660c0fcafa83527d3a7f4f447f4a9364 (patch)
treea97e4d857435e2fdc4b6cf5be33103ff43dedaa1
parent19a9aa9302276d49a4c4890f656359808d3a0151 (diff)
downloadlwn-5e657a8e660c0fcafa83527d3a7f4f447f4a9364.tar.gz
lwn-5e657a8e660c0fcafa83527d3a7f4f447f4a9364.zip
spi: mxic: differentiate between unsupported and invalid requests
If the request is out of range, returning -EINVAL seems sensible. However if there is no direct mapping available (which is a possible case), no direct mapping will ever be allowed, hence -EOPNOTSUP is probably more relevant in this case. >From a caller (and reviewer) point of view, distinguising between the two may be helpful because somehow one can be "fixed" while the other will always be refused no matter how hard we try. As part of a wider work to bring spi-nand continuous reads, it was useful to easily catch the upper limit direct mapping boundaries for each controller, with the idea of enlarging this area from a page to an eraseblock, without risking too many regressions. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://msgid.link/r/20240522145255.995778-3-miquel.raynal@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-mxic.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-mxic.c b/drivers/spi/spi-mxic.c
index 60c9f3048ac9..6156d691630a 100644
--- a/drivers/spi/spi-mxic.c
+++ b/drivers/spi/spi-mxic.c
@@ -496,7 +496,7 @@ static int mxic_spi_mem_dirmap_create(struct spi_mem_dirmap_desc *desc)
struct mxic_spi *mxic = spi_controller_get_devdata(desc->mem->spi->controller);
if (!mxic->linear.map)
- return -EINVAL;
+ return -EOPNOTSUPP;
if (desc->info.offset + desc->info.length > U32_MAX)
return -EINVAL;