public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] mtd: spi-nor: Rename spi_nor_spimem_check_op()
@ 2026-03-17 10:21 Miquel Raynal
  2026-03-17 10:46 ` Pratyush Yadav
  0 siblings, 1 reply; 4+ messages in thread
From: Miquel Raynal @ 2026-03-17 10:21 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Pratyush Yadav,
	Michael Walle, linux-mtd
  Cc: Thomas Petazzoni, Miquel Raynal

This helper really is just a little helper for internal purposes, and is
I/O operation oriented, despite its name. It has already been misused
in commit 5008c3ec3f89 ("mtd: spi-nor: core: Check read CR support"), so
rename it to clarify its purpose: it is only useful for reads and page
programs.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
Changes in v2:
* Propose a new helper name, not including "page" in it.
---
 drivers/mtd/spi-nor/core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 13201908a69f..4ba5943cdd2f 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2345,15 +2345,15 @@ int spi_nor_hwcaps_pp2cmd(u32 hwcaps)
 }
 
 /**
- * spi_nor_spimem_check_op - check if the operation is supported
- *                           by controller
+ * spi_nor_spimem_check_io_op - check if a read or a page program operation is
+ *                              supported by controller
  *@nor:        pointer to a 'struct spi_nor'
  *@op:         pointer to op template to be checked
  *
  * Returns 0 if operation is supported, -EOPNOTSUPP otherwise.
  */
-static int spi_nor_spimem_check_op(struct spi_nor *nor,
-				   struct spi_mem_op *op)
+static int spi_nor_spimem_check_io_op(struct spi_nor *nor,
+				      struct spi_mem_op *op)
 {
 	/*
 	 * First test with 4 address bytes. The opcode itself might
@@ -2396,7 +2396,7 @@ static int spi_nor_spimem_check_readop(struct spi_nor *nor,
 	if (spi_nor_protocol_is_dtr(nor->read_proto))
 		op.dummy.nbytes *= 2;
 
-	return spi_nor_spimem_check_op(nor, &op);
+	return spi_nor_spimem_check_io_op(nor, &op);
 }
 
 /**
@@ -2414,7 +2414,7 @@ static int spi_nor_spimem_check_pp(struct spi_nor *nor,
 
 	spi_nor_spimem_setup_op(nor, &op, pp->proto);
 
-	return spi_nor_spimem_check_op(nor, &op);
+	return spi_nor_spimem_check_io_op(nor, &op);
 }
 
 /**
-- 
2.51.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: Rename spi_nor_spimem_check_op()
  2026-03-17 10:21 [PATCH v2] mtd: spi-nor: Rename spi_nor_spimem_check_op() Miquel Raynal
@ 2026-03-17 10:46 ` Pratyush Yadav
  2026-03-17 13:21   ` Miquel Raynal
  0 siblings, 1 reply; 4+ messages in thread
From: Pratyush Yadav @ 2026-03-17 10:46 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Richard Weinberger, Vignesh Raghavendra, Pratyush Yadav,
	Michael Walle, linux-mtd, Thomas Petazzoni

On Tue, Mar 17 2026, Miquel Raynal wrote:

> This helper really is just a little helper for internal purposes, and is
> I/O operation oriented, despite its name. It has already been misused
> in commit 5008c3ec3f89 ("mtd: spi-nor: core: Check read CR support"), so
> rename it to clarify its purpose: it is only useful for reads and page
> programs.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Reviewed-by: Pratyush Yadav <pratyush@kernel.org>

This one is tricky. It won't compile without "mtd: spi-nor: Fix RDCR
controller capability core check". So to take it through spi-nor/next, I
would need to rebase the branch on the -rc in which the RDCR patch [0]
lands.

And while I don't think it is necessary, the history will be a bit
cleaner if mtd/next is also based on that -rc. No strong preferences
about that though.

Does this sound good to you or is there a better way of handling this?

[0] https://lore.kernel.org/linux-mtd/20260317101842.319656-1-miquel.raynal@bootlin.com/T/#u

[...]

-- 
Regards,
Pratyush Yadav

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: Rename spi_nor_spimem_check_op()
  2026-03-17 10:46 ` Pratyush Yadav
@ 2026-03-17 13:21   ` Miquel Raynal
  2026-03-17 16:13     ` Pratyush Yadav
  0 siblings, 1 reply; 4+ messages in thread
From: Miquel Raynal @ 2026-03-17 13:21 UTC (permalink / raw)
  To: Pratyush Yadav
  Cc: Richard Weinberger, Vignesh Raghavendra, Michael Walle, linux-mtd,
	Thomas Petazzoni

On 17/03/2026 at 10:46:49 GMT, Pratyush Yadav <pratyush@kernel.org> wrote:

> On Tue, Mar 17 2026, Miquel Raynal wrote:
>
>> This helper really is just a little helper for internal purposes, and is
>> I/O operation oriented, despite its name. It has already been misused
>> in commit 5008c3ec3f89 ("mtd: spi-nor: core: Check read CR support"), so
>> rename it to clarify its purpose: it is only useful for reads and page
>> programs.
>>
>> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
>
> Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
>
> This one is tricky. It won't compile without "mtd: spi-nor: Fix RDCR
> controller capability core check". So to take it through spi-nor/next, I
> would need to rebase the branch on the -rc in which the RDCR patch [0]
> lands.

I forgot it was only applicable after the other patch. In general, you
are welcome to directly merge the relevant -rc in spi-nor/next, no need
for mtd/next to be based on it too. But for this specific case, if you
agree I will take it through the fixes branch directly. They are related
anyway (after renaming it _read_pp_op() as suggested by Tudor).

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: Rename spi_nor_spimem_check_op()
  2026-03-17 13:21   ` Miquel Raynal
@ 2026-03-17 16:13     ` Pratyush Yadav
  0 siblings, 0 replies; 4+ messages in thread
From: Pratyush Yadav @ 2026-03-17 16:13 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Pratyush Yadav, Richard Weinberger, Vignesh Raghavendra,
	Michael Walle, linux-mtd, Thomas Petazzoni

On Tue, Mar 17 2026, Miquel Raynal wrote:

> On 17/03/2026 at 10:46:49 GMT, Pratyush Yadav <pratyush@kernel.org> wrote:
>
>> On Tue, Mar 17 2026, Miquel Raynal wrote:
>>
>>> This helper really is just a little helper for internal purposes, and is
>>> I/O operation oriented, despite its name. It has already been misused
>>> in commit 5008c3ec3f89 ("mtd: spi-nor: core: Check read CR support"), so
>>> rename it to clarify its purpose: it is only useful for reads and page
>>> programs.
>>>
>>> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
>>
>> Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
>>
>> This one is tricky. It won't compile without "mtd: spi-nor: Fix RDCR
>> controller capability core check". So to take it through spi-nor/next, I
>> would need to rebase the branch on the -rc in which the RDCR patch [0]
>> lands.
>
> I forgot it was only applicable after the other patch. In general, you
> are welcome to directly merge the relevant -rc in spi-nor/next, no need
> for mtd/next to be based on it too. But for this specific case, if you
> agree I will take it through the fixes branch directly. They are related
> anyway (after renaming it _read_pp_op() as suggested by Tudor).

Sure, fine by me. Makes life easier for the both of us.

-- 
Regards,
Pratyush Yadav

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-17 16:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 10:21 [PATCH v2] mtd: spi-nor: Rename spi_nor_spimem_check_op() Miquel Raynal
2026-03-17 10:46 ` Pratyush Yadav
2026-03-17 13:21   ` Miquel Raynal
2026-03-17 16:13     ` Pratyush Yadav

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox