mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manikandan Muralidharan <manikandan.m@microchip.com>
To: <pratyush@kernel.org>, <mwalle@kernel.org>,
	<takahiro.kuwano@infineon.com>, <miquel.raynal@bootlin.com>,
	<richard@nod.at>, <vigneshr@ti.com>, <srini@kernel.org>,
	<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Cc: <manikandan.m@microchip.com>
Subject: [PATCH v2 2/2] nvmem: core: stop deferring for a cell after the deferred probe timeout
Date: Mon, 30 Nov 2026 13:15:07 +0530	[thread overview]
Message-ID: <ee2fda09bf32d61229fa670e393c40869320ba37.1796023057.git.manikandan.m@microchip.com> (raw)
In-Reply-To: <cover.1796023057.git.manikandan.m@microchip.com>

nvmem_cell_get() returns -EPROBE_DEFER for as long as the nvmem device
providing a DT cell is not registered. When that device never shows up,
for instance because the flash holding the cell is not populated on the
board, the consumer is deferred forever instead of falling back to
another source.

Once the deferred probe timeout has expired, as reported by
driver_deferred_probe_check_state(), return -ENOENT instead, so that the
consumer treats the cell as missing. A provider that is merely late is
still waited for until then.

Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
---
 drivers/nvmem/core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index a755cc4318dc..a1208663b50e 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -1508,6 +1508,15 @@ struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *id)
 
 	if (dev->of_node) { /* try dt first */
 		cell = of_nvmem_cell_get(dev->of_node, id);
+		/*
+		 * Don't wait forever for a provider that never shows up, e.g.
+		 * when the device holding it is not populated. Once the
+		 * deferred probe timeout has expired, report the cell as
+		 * missing so that the consumer can fall back.
+		 */
+		if (PTR_ERR(cell) == -EPROBE_DEFER &&
+		    driver_deferred_probe_check_state(dev) != -EPROBE_DEFER)
+			return ERR_PTR(-ENOENT);
 		if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER)
 			return cell;
 	}
-- 
2.43.0


      parent reply	other threads:[~2026-11-30  7:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  7:45 [PATCH v2 0/2] mtd/nvmem: don't defer forever on absent NVMEM suppliers Manikandan Muralidharan
2026-11-30  7:45 ` [PATCH v2 1/2] mtd: spi-nor: drop fw_devlink suppliers below a flash that failed to probe Manikandan Muralidharan
2026-11-30  7:45 ` Manikandan Muralidharan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee2fda09bf32d61229fa670e393c40869320ba37.1796023057.git.manikandan.m@microchip.com \
    --to=manikandan.m@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mwalle@kernel.org \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=srini@kernel.org \
    --cc=takahiro.kuwano@infineon.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®