* [PATCH] mtd: spi-nor: core: Add an error message when failing to exit the 4-byte address mode
@ 2022-07-28 3:01 Tudor Ambarus
2022-07-28 12:06 ` Pratyush Yadav
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Tudor Ambarus @ 2022-07-28 3:01 UTC (permalink / raw)
To: pratyush, michael
Cc: miquel.raynal, richard, vigneshr, linux-mtd, linux-kernel,
Tudor Ambarus, Pratyush Yadav
Add an error message when failing to exit the 4-byte address mode. Do not
stop the execution and go through the spi_nor_soft_reset() method if used,
in the hope that the flash will default to 3-byte address mode after the
reset.
Suggested-by: Pratyush Yadav <p.yadav@ti.com>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
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 f2c64006f8d7..1cdbdad97136 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2841,7 +2841,8 @@ void spi_nor_restore(struct spi_nor *nor)
/* restore the addressing mode */
if (nor->addr_nbytes == 4 && !(nor->flags & SNOR_F_4B_OPCODES) &&
nor->flags & SNOR_F_BROKEN_RESET)
- nor->params->set_4byte_addr_mode(nor, false);
+ if (nor->params->set_4byte_addr_mode(nor, false))
+ dev_err(nor->dev, "Failed to exit 4-byte address mode\n");
if (nor->flags & SNOR_F_SOFT_RESET)
spi_nor_soft_reset(nor);
--
2.25.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spi-nor: core: Add an error message when failing to exit the 4-byte address mode
2022-07-28 3:01 [PATCH] mtd: spi-nor: core: Add an error message when failing to exit the 4-byte address mode Tudor Ambarus
@ 2022-07-28 12:06 ` Pratyush Yadav
2022-07-28 12:15 ` Michael Walle
2022-10-25 2:33 ` Tudor Ambarus
2 siblings, 0 replies; 5+ messages in thread
From: Pratyush Yadav @ 2022-07-28 12:06 UTC (permalink / raw)
To: Tudor Ambarus
Cc: pratyush, michael, miquel.raynal, richard, vigneshr, linux-mtd,
linux-kernel
On 28/07/22 06:01AM, Tudor Ambarus wrote:
> Add an error message when failing to exit the 4-byte address mode. Do not
> stop the execution and go through the spi_nor_soft_reset() method if used,
> in the hope that the flash will default to 3-byte address mode after the
> reset.
>
> Suggested-by: Pratyush Yadav <p.yadav@ti.com>
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
> ---
> 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 f2c64006f8d7..1cdbdad97136 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -2841,7 +2841,8 @@ void spi_nor_restore(struct spi_nor *nor)
> /* restore the addressing mode */
> if (nor->addr_nbytes == 4 && !(nor->flags & SNOR_F_4B_OPCODES) &&
> nor->flags & SNOR_F_BROKEN_RESET)
> - nor->params->set_4byte_addr_mode(nor, false);
> + if (nor->params->set_4byte_addr_mode(nor, false))
> + dev_err(nor->dev, "Failed to exit 4-byte address mode\n");
>
> if (nor->flags & SNOR_F_SOFT_RESET)
> spi_nor_soft_reset(nor);
> --
> 2.25.1
>
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spi-nor: core: Add an error message when failing to exit the 4-byte address mode
2022-07-28 3:01 [PATCH] mtd: spi-nor: core: Add an error message when failing to exit the 4-byte address mode Tudor Ambarus
2022-07-28 12:06 ` Pratyush Yadav
@ 2022-07-28 12:15 ` Michael Walle
2022-07-28 12:26 ` Tudor.Ambarus
2022-10-25 2:33 ` Tudor Ambarus
2 siblings, 1 reply; 5+ messages in thread
From: Michael Walle @ 2022-07-28 12:15 UTC (permalink / raw)
To: Tudor Ambarus
Cc: pratyush, miquel.raynal, richard, vigneshr, linux-mtd,
linux-kernel, Pratyush Yadav
Hi,
Am 2022-07-28 05:01, schrieb Tudor Ambarus:
> Add an error message when failing to exit the 4-byte address mode. Do
> not
> stop the execution and go through the spi_nor_soft_reset() method if
> used,
> in the hope that the flash will default to 3-byte address mode after
> the
> reset.
>
> Suggested-by: Pratyush Yadav <p.yadav@ti.com>
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
> 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 f2c64006f8d7..1cdbdad97136 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -2841,7 +2841,8 @@ void spi_nor_restore(struct spi_nor *nor)
> /* restore the addressing mode */
> if (nor->addr_nbytes == 4 && !(nor->flags & SNOR_F_4B_OPCODES) &&
> nor->flags & SNOR_F_BROKEN_RESET)
> - nor->params->set_4byte_addr_mode(nor, false);
> + if (nor->params->set_4byte_addr_mode(nor, false))
> + dev_err(nor->dev, "Failed to exit 4-byte address mode\n");
Could we stick to the ususal pattern:
ret = func()
if (ret)
err("blubb (%d)", ret);
I know it is more lines but imho it makes the code much more readable.
And that way you could also print the error code. You could also use
dev_err("bla (%pe)\n", ERR_PTR(ret));
-michael
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spi-nor: core: Add an error message when failing to exit the 4-byte address mode
2022-07-28 12:15 ` Michael Walle
@ 2022-07-28 12:26 ` Tudor.Ambarus
0 siblings, 0 replies; 5+ messages in thread
From: Tudor.Ambarus @ 2022-07-28 12:26 UTC (permalink / raw)
To: michael
Cc: pratyush, miquel.raynal, richard, vigneshr, linux-mtd,
linux-kernel, p.yadav
On 7/28/22 15:15, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Hi,
>
> Am 2022-07-28 05:01, schrieb Tudor Ambarus:
>> Add an error message when failing to exit the 4-byte address mode. Do
>> not
>> stop the execution and go through the spi_nor_soft_reset() method if
>> used,
>> in the hope that the flash will default to 3-byte address mode after
>> the
>> reset.
>>
>> Suggested-by: Pratyush Yadav <p.yadav@ti.com>
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>> ---
>> 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 f2c64006f8d7..1cdbdad97136 100644
>> --- a/drivers/mtd/spi-nor/core.c
>> +++ b/drivers/mtd/spi-nor/core.c
>> @@ -2841,7 +2841,8 @@ void spi_nor_restore(struct spi_nor *nor)
>> /* restore the addressing mode */
>> if (nor->addr_nbytes == 4 && !(nor->flags & SNOR_F_4B_OPCODES) &&
>> nor->flags & SNOR_F_BROKEN_RESET)
>> - nor->params->set_4byte_addr_mode(nor, false);
>> + if (nor->params->set_4byte_addr_mode(nor, false))
>> + dev_err(nor->dev, "Failed to exit 4-byte address mode\n");
>
> Could we stick to the ususal pattern:
>
> ret = func()
> if (ret)
> err("blubb (%d)", ret);
>
> I know it is more lines but imho it makes the code much more readable.
> And that way you could also print the error code. You could also use
> dev_err("bla (%pe)\n", ERR_PTR(ret));
>
sure, will do. Thanks.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spi-nor: core: Add an error message when failing to exit the 4-byte address mode
2022-07-28 3:01 [PATCH] mtd: spi-nor: core: Add an error message when failing to exit the 4-byte address mode Tudor Ambarus
2022-07-28 12:06 ` Pratyush Yadav
2022-07-28 12:15 ` Michael Walle
@ 2022-10-25 2:33 ` Tudor Ambarus
2 siblings, 0 replies; 5+ messages in thread
From: Tudor Ambarus @ 2022-10-25 2:33 UTC (permalink / raw)
To: michael, tudor.ambarus, pratyush
Cc: Pratyush Yadav, linux-mtd, linux-kernel, miquel.raynal, richard,
vigneshr
On Thu, 28 Jul 2022 06:01:59 +0300, Tudor Ambarus wrote:
> Add an error message when failing to exit the 4-byte address mode. Do not
> stop the execution and go through the spi_nor_soft_reset() method if used,
> in the hope that the flash will default to 3-byte address mode after the
> reset.
>
>
Applied to spi-nor/next, thanks!
[1/1] mtd: spi-nor: core: Add an error message when failing to exit the 4-byte address mode
https://git.kernel.org/mtd/c/bb0e9c600ce2
Best regards,
--
Tudor Ambarus <tudor.ambarus@microchip.com>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-25 2:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-28 3:01 [PATCH] mtd: spi-nor: core: Add an error message when failing to exit the 4-byte address mode Tudor Ambarus
2022-07-28 12:06 ` Pratyush Yadav
2022-07-28 12:15 ` Michael Walle
2022-07-28 12:26 ` Tudor.Ambarus
2022-10-25 2:33 ` Tudor Ambarus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).