All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmem: Do not expect fixed layouts to grab a layout driver
@ 2023-11-24 19:38 Miquel Raynal
  2023-11-24 21:11 ` Rafał Miłecki
  2023-11-27  8:13 ` Luca Ceresoli
  0 siblings, 2 replies; 3+ messages in thread
From: Miquel Raynal @ 2023-11-24 19:38 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Srinivas Kandagatla
  Cc: linux-kernel, Michael Walle, Rafał Miłecki,
	Thomas Petazzoni, Miquel Raynal, stable, Luca Ceresoli

Two series lived in parallel for some time, which led to this situation:
- The nvmem-layout container is used for dynamic layouts
- We now expect fixed layouts to also use the nvmem-layout container but
this does not require any additional driver, the support is built-in the
nvmem core.

Ensure we don't refuse to probe for wrong reasons.

Fixes: 27f699e578b1 ("nvmem: core: add support for fixed cells *layout*")
Cc: stable@vger.kernel.org
Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---

Please note this is a temporary fix as this piece of code is going to
disappear when the NVMEM layouts 'as devices' series gets in.

 drivers/nvmem/core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index bf42b7e826db..608b352a7d91 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -796,6 +796,12 @@ static struct nvmem_layout *nvmem_layout_get(struct nvmem_device *nvmem)
 	if (!layout_np)
 		return NULL;
 
+	/* Fixed layouts don't have a matching driver */
+	if (of_device_is_compatible(layout_np, "fixed-layout")) {
+		of_node_put(layout_np);
+		return NULL;
+	}
+
 	/*
 	 * In case the nvmem device was built-in while the layout was built as a
 	 * module, we shall manually request the layout driver loading otherwise
-- 
2.34.1


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

* Re: [PATCH] nvmem: Do not expect fixed layouts to grab a layout driver
  2023-11-24 19:38 [PATCH] nvmem: Do not expect fixed layouts to grab a layout driver Miquel Raynal
@ 2023-11-24 21:11 ` Rafał Miłecki
  2023-11-27  8:13 ` Luca Ceresoli
  1 sibling, 0 replies; 3+ messages in thread
From: Rafał Miłecki @ 2023-11-24 21:11 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Greg Kroah-Hartman, Srinivas Kandagatla, linux-kernel,
	Michael Walle, Thomas Petazzoni, stable, Luca Ceresoli

On 2023-11-24 20:38, Miquel Raynal wrote:
> Two series lived in parallel for some time, which led to this 
> situation:
> - The nvmem-layout container is used for dynamic layouts
> - We now expect fixed layouts to also use the nvmem-layout container 
> but
> this does not require any additional driver, the support is built-in 
> the
> nvmem core.
> 
> Ensure we don't refuse to probe for wrong reasons.

I pushed a pretty much identical patch to OpenWrt (I just forgot
of_node_put()): commit 61f674df4f0c ("kernel: nvmem: fix "fixed-layout"
& support "mac-base""):
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=61f674df4f0ce2b1c53b0b7f6b0c1d03d99838c0

It's in use since July and seems to do the trick just fine.

Thanks for submitting this fix.


> Fixes: 27f699e578b1 ("nvmem: core: add support for fixed cells 
> *layout*")
> Cc: stable@vger.kernel.org
> Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Tested-by: Rafał Miłecki <rafal@milecki.pl>

-- 
Rafał Miłecki

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

* Re: [PATCH] nvmem: Do not expect fixed layouts to grab a layout driver
  2023-11-24 19:38 [PATCH] nvmem: Do not expect fixed layouts to grab a layout driver Miquel Raynal
  2023-11-24 21:11 ` Rafał Miłecki
@ 2023-11-27  8:13 ` Luca Ceresoli
  1 sibling, 0 replies; 3+ messages in thread
From: Luca Ceresoli @ 2023-11-27  8:13 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Greg Kroah-Hartman, Srinivas Kandagatla, linux-kernel,
	Michael Walle, Rafał Miłecki, Thomas Petazzoni, stable

Hi Miquèl,

On Fri, 24 Nov 2023 20:38:14 +0100
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Two series lived in parallel for some time, which led to this situation:
> - The nvmem-layout container is used for dynamic layouts
> - We now expect fixed layouts to also use the nvmem-layout container but
> this does not require any additional driver, the support is built-in the
> nvmem core.
> 
> Ensure we don't refuse to probe for wrong reasons.
> 
> Fixes: 27f699e578b1 ("nvmem: core: add support for fixed cells *layout*")
> Cc: stable@vger.kernel.org
> Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

[fixes probing I2C EEPROMs using fixed-layout]
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2023-11-27  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-24 19:38 [PATCH] nvmem: Do not expect fixed layouts to grab a layout driver Miquel Raynal
2023-11-24 21:11 ` Rafał Miłecki
2023-11-27  8:13 ` Luca Ceresoli

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.