Thread (20 messages) 20 messages, 9 authors, 2021-04-20

Re: [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER

From: Dan Carpenter <hidden>
Date: 2021-04-20 11:24:06
Also in: dmaengine, dri-devel, linux-amlogic, linux-clk, linux-gpio, linux-iommu, linux-media, linux-mediatek, linux-mmc, linux-omap, linux-phy, linux-pm, linux-renesas-soc, linux-staging, linux-usb, linux-watchdog, linuxppc-dev, lkml, netdev

On Mon, Apr 19, 2021 at 10:20:13AM +0200, Geert Uytterhoeven wrote:
Hi Alice,

CC Arnd (soc_device_match() author)

On Mon, Apr 19, 2021 at 6:28 AM Alice Guo (OSS) [off-list ref] wrote:
quoted
From: Alice Guo <redacted>

In i.MX8M boards, the registration of SoC device is later than caam
driver which needs it. Caam driver needs soc_device_match to provide
-EPROBE_DEFER when no SoC device is registered and no
early_soc_dev_attr.
I'm wondering if this is really a good idea: soc_device_match() is a
last-resort low-level check, and IMHO should be made available early on,
so there is no need for -EPROBE_DEFER.
quoted
Signed-off-by: Alice Guo <redacted>
Thanks for your patch!
quoted
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -110,6 +110,7 @@ static void soc_release(struct device *dev)
 }

 static struct soc_device_attribute *early_soc_dev_attr;
+static bool soc_dev_attr_init_done = false;
Do you need this variable?
quoted
 struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr)
 {
@@ -157,6 +158,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
                return ERR_PTR(ret);
        }

+       soc_dev_attr_init_done = true;
        return soc_dev;

 out3:
@@ -246,6 +248,9 @@ const struct soc_device_attribute *soc_device_match(
        if (!matches)
                return NULL;

+       if (!soc_dev_attr_init_done && !early_soc_dev_attr)
if (!soc_bus_type.p && !early_soc_dev_attr)
There is one place checking this already.  We could wrap it in a helper
function:

static bool device_init_done(void)
{
	return soc_bus_type.p ? true : false;
}

regards,
dan carpenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help