NAND: sunxi: Return ENOTSUPP on onfi functions
cover NAND: sunxi: Return ENOTSUPP on onfi functions
Hello everyone,
This is a first version of this series that fix code for NAND chip that does not have ONFI get/set features support.
Patch 01:
The current code returns an invalid error if it is not supported. It should return ENOTSUPP instead.
Patch 02:
In sunxi_nand driver, we should return of sunxi_nand_chip_init_timings function only when the ONFI is supported and we got a real error while setting the timing. If the onfi_get/set_features is not supported, we should continue the NAND intialization.
Let me kow what you think.
Thank you in advance,
Best regards,
Mylène Josserand (2):
mtd: nand: nand_base: Convert EINVAL into ENOTSUPP
mtd: nand: sunxi: Return on set_feature only when not ENOTSUPP
drivers/mtd/nand/nand_base.c | 4 ++-- drivers/mtd/nand/sunxi_nand.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/2 mtd: nand: nand_base: Convert EINVAL into ENOTSUPP
Convert the EINVAL error into ENOTSUPP when the GET/SET_FEATURES is not supported.
--- drivers/mtd/nand/nand_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/nand_base.c +2 -2
@@ -3041,7 +3041,7 @@ static int nand_onfi_set_features(struct mtd_info *mtd, struct nand_chip *chip,if (!chip->onfi_version || !(le16_to_cpu (chip->onfi_params.opt_cmd) &ONFI_OPT_CMD_SET_GET_FEATURES )) -return -EINVAL ; +return -ENOTSUPP ;#endif chip->cmdfunc (mtd,NAND_CMD_SET_FEATURES , addr,-1 );
@@ -3070,7 +3070,7 @@ static int nand_onfi_get_features(struct mtd_info *mtd, struct nand_chip *chip,if (!chip->onfi_version || !(le16_to_cpu (chip->onfi_params.opt_cmd) &ONFI_OPT_CMD_SET_GET_FEATURES )) -return -EINVAL ; +return -ENOTSUPP ;#endif chip->cmdfunc (mtd,NAND_CMD_GET_FEATURES , addr,-1 );
Signature · 1 line
2.11.0
PATCH 1/2 mtd: nand: nand_base: Convert EINVAL into ENOTSUPP
Quoted 5 lines · Mylène Josserand
Convert the EINVAL error into ENOTSUPP when the GET/SET_FEATURES is not supported.
Signed-off-by Mylène Josserand <[email protected]>---
PATCH 1/2 mtd: nand: nand_base: Convert EINVAL into ENOTSUPP
In reply to Mylène JosserandQuoted 5 lines · Mylène Josserand
Convert the EINVAL error into ENOTSUPP when the GET/SET_FEATURES is not supported.
Signed-off-by Mylène Josserand <[email protected]>---
Applied both.
PATCH 2/2 mtd: nand: sunxi: Return on set_feature only when not ENOTSUPP
In reply to Mylène JosserandReturn the error code of the set_features function only if the error code is not ENOTSUPP. Otherwise, if this function is not supported, it will return and fail to initialize the NAND.
--- drivers/mtd/nand/sunxi_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/sunxi_nand.c +1 -1
@@ -1369,7 +1369,7 @@ static int sunxi_nand_chip_init_timings(struct sunxi_nand_chip *chip)ONFI_FEATURE_ADDR_TIMING_MODE , feature); chip->nand.select_chip (mtd,-1 ); -if (ret) +if (ret && ret != -ENOTSUPP )return ret; } }
Signature · 1 line
2.11.0
PATCH 2/2 mtd: nand: sunxi: Return on set_feature only when not ENOTSUPP
Quoted 7 lines · Mylène Josserand
Return the error code of the
set_featuresfunction only if the error code is not ENOTSUPP. Otherwise, if this function is not supported, it will return and fail to initialize the NAND.Signed-off-by Mylène Josserand <[email protected]>---