All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: mchp23k256: Use SPI match data for chip caps
@ 2026-06-24  5:54 ` Pengpeng Hou
  0 siblings, 0 replies; 4+ messages in thread
From: Pengpeng Hou @ 2026-06-24  5:54 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Pengpeng Hou
  Cc: linux-mtd, linux-kernel

The driver stores chip capacity information in both the OF match table
and the SPI id table.  Probe currently uses of_device_get_match_data(),
so a non-OF SPI modalias match falls back to mchp23k256_caps even when
the SPI id table selected a different part.

Use spi_get_device_match_data() so SPI id-table driver_data is consumed
when OF match data is absent.  This keeps the existing default fallback
while avoiding the wrong MTD geometry for id-table-only matches.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/mtd/devices/mchp23k256.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/mchp23k256.c b/drivers/mtd/devices/mchp23k256.c
index cef5f9677d39..66e058df4c32 100644
--- a/drivers/mtd/devices/mchp23k256.c
+++ b/drivers/mtd/devices/mchp23k256.c
@@ -188,7 +188,7 @@ static int mchp23k256_probe(struct spi_device *spi)
 
 	data = dev_get_platdata(&spi->dev);
 
-	flash->caps = of_device_get_match_data(&spi->dev);
+	flash->caps = spi_get_device_match_data(spi);
 	if (!flash->caps)
 		flash->caps = &mchp23k256_caps;
 
-- 
2.50.1 (Apple Git-155)


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

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

* [PATCH] mtd: mchp23k256: Use SPI match data for chip caps
@ 2026-06-24  5:54 ` Pengpeng Hou
  0 siblings, 0 replies; 4+ messages in thread
From: Pengpeng Hou @ 2026-06-24  5:54 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Pengpeng Hou
  Cc: linux-mtd, linux-kernel

The driver stores chip capacity information in both the OF match table
and the SPI id table.  Probe currently uses of_device_get_match_data(),
so a non-OF SPI modalias match falls back to mchp23k256_caps even when
the SPI id table selected a different part.

Use spi_get_device_match_data() so SPI id-table driver_data is consumed
when OF match data is absent.  This keeps the existing default fallback
while avoiding the wrong MTD geometry for id-table-only matches.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/mtd/devices/mchp23k256.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/mchp23k256.c b/drivers/mtd/devices/mchp23k256.c
index cef5f9677d39..66e058df4c32 100644
--- a/drivers/mtd/devices/mchp23k256.c
+++ b/drivers/mtd/devices/mchp23k256.c
@@ -188,7 +188,7 @@ static int mchp23k256_probe(struct spi_device *spi)
 
 	data = dev_get_platdata(&spi->dev);
 
-	flash->caps = of_device_get_match_data(&spi->dev);
+	flash->caps = spi_get_device_match_data(spi);
 	if (!flash->caps)
 		flash->caps = &mchp23k256_caps;
 
-- 
2.50.1 (Apple Git-155)


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

* Re: [PATCH] mtd: mchp23k256: Use SPI match data for chip caps
  2026-06-24  5:54 ` Pengpeng Hou
@ 2026-06-24  7:22   ` Miquel Raynal
  -1 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2026-06-24  7:22 UTC (permalink / raw)
  To: Pengpeng Hou
  Cc: Richard Weinberger, Vignesh Raghavendra, linux-mtd, linux-kernel

On 24/06/2026 at 13:54:40 +08, Pengpeng Hou <pengpeng@iscas.ac.cn> wrote:

> The driver stores chip capacity information in both the OF match table
> and the SPI id table.  Probe currently uses of_device_get_match_data(),
> so a non-OF SPI modalias match falls back to mchp23k256_caps even when
> the SPI id table selected a different part.
>
> Use spi_get_device_match_data() so SPI id-table driver_data is consumed
> when OF match data is absent.  This keeps the existing default fallback
> while avoiding the wrong MTD geometry for id-table-only matches.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---

I am not sure the default makes a lot of sense as there are only two
possible hits and both have private data attached. Nevertheless, the fix
looks correct.

Thanks,
Miquèl

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

* Re: [PATCH] mtd: mchp23k256: Use SPI match data for chip caps
@ 2026-06-24  7:22   ` Miquel Raynal
  0 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2026-06-24  7:22 UTC (permalink / raw)
  To: Pengpeng Hou
  Cc: Richard Weinberger, Vignesh Raghavendra, linux-mtd, linux-kernel

On 24/06/2026 at 13:54:40 +08, Pengpeng Hou <pengpeng@iscas.ac.cn> wrote:

> The driver stores chip capacity information in both the OF match table
> and the SPI id table.  Probe currently uses of_device_get_match_data(),
> so a non-OF SPI modalias match falls back to mchp23k256_caps even when
> the SPI id table selected a different part.
>
> Use spi_get_device_match_data() so SPI id-table driver_data is consumed
> when OF match data is absent.  This keeps the existing default fallback
> while avoiding the wrong MTD geometry for id-table-only matches.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---

I am not sure the default makes a lot of sense as there are only two
possible hits and both have private data attached. Nevertheless, the fix
looks correct.

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

end of thread, other threads:[~2026-06-24  7:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-24  5:54 [PATCH] mtd: mchp23k256: Use SPI match data for chip caps Pengpeng Hou
2026-06-24  5:54 ` Pengpeng Hou
2026-06-24  7:22 ` Miquel Raynal
2026-06-24  7:22   ` Miquel Raynal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.