diff mbox series

[v5,2/2] mtd: spi-nor: Stop reporting warning message when soft reset is not suported

Message ID 20231108094303.46303-2-acelan.kao@canonical.com
State Superseded
Headers show
Series [v5,1/2] spi: Replace -ENOTSUPP with -EOPNOTSUPP in op checking | expand

Commit Message

Chia-Lin Kao (AceLan) Nov. 8, 2023, 9:43 a.m. UTC
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(-)

Comments

Michael Walle Nov. 9, 2023, 10:57 a.m. UTC | #1
> 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>
Mika Westerberg Nov. 10, 2023, 5:39 a.m. UTC | #2
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>
Pratyush Yadav Nov. 13, 2023, 12:44 p.m. UTC | #3
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>
diff mbox series

Patch

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;
 	}