Re: [PATCH v2] mtd: spi-nor: handle unsupported FSR opcodes properly
From: Mika Westerberg
Date: Fri Jun 17 2022 - 01:04:57 EST
Hi,
On Thu, Jun 16, 2022 at 08:26:33PM +0000, Oleksandr Ocheretnyi -X (oocheret - GLOBALLOGIC INC at Cisco) wrote:
> Hi Mika,
>
> > However I remember you caught situation where
> micron_st_nor_read_fsr()
> > returns -EOPNOTSUPP
> > (intel_spi_exec_mem_op callback returns -EOPNOTSUPP), according to
> your
> > patch
> >
> [3]https://lore.kernel.org/linux-mtd/20220506105158.43613-1-mika.wester
> > berg@xxxxxxxxxxxxxxx/ I've noted in description body. So I think I
> have
> > to cover both errorcodes, haven't I?
> I was thinking that you change the both functions in Intel SPI to
> return
>
> -ENOTSUPP, not just one.
>
> you know 'drivers/mtd/spi-nor' sources use -EOPNOTSUPP errorcode only,
> however
>
> 'drivers/spi' modules (where intel driver is located as well as
> spi-mem.c) use both errorcodes many times
>
> (-EOPNOTSUPP and -ENOTSUPP).
Oh, indeed. I remembered that SPI-NOR core was using ENOTSUP but it was
SPI-MEM instead.
> So maybe it is better to use -EOPNOTSUPP for intel driver file (what
> uses -EOPNOTSUPP everywhere) and
>
> update the spi-mem.c with -EOPNOTSUPP as return value, how do you
> think?
Yes, I think this is the correct approach. You need to be careful though
to make sure the callers of SPI-MEM functions do not get unexpected
values.