[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210420112151.GE1981@kadam>
Date: Tue, 20 Apr 2021 14:21:52 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: "Alice Guo (OSS)" <alice.guo@....nxp.com>,
gregkh@...uxfoundation.org, rafael@...nel.org,
horia.geanta@....com, aymen.sghaier@....com,
herbert@...dor.apana.org.au, davem@...emloft.net, tony@...mide.com,
geert+renesas@...der.be, mturquette@...libre.com, sboyd@...nel.org,
vkoul@...nel.org, peter.ujfalusi@...il.com, a.hajda@...sung.com,
narmstrong@...libre.com, robert.foss@...aro.org, airlied@...ux.ie,
daniel@...ll.ch, khilman@...libre.com, tomba@...nel.org,
jyri.sarha@....fi, joro@...tes.org, will@...nel.org,
mchehab@...nel.org, ulf.hansson@...aro.org,
adrian.hunter@...el.com, kishon@...com, kuba@...nel.org,
linus.walleij@...aro.org, Roy.Pledge@....com, leoyang.li@....com,
ssantosh@...nel.org, matthias.bgg@...il.com, edubezval@...il.com,
j-keerthy@...com, balbi@...nel.org, linux@...sktech.co.nz,
stern@...land.harvard.edu, wim@...ux-watchdog.org,
linux@...ck-us.net, linux-kernel@...r.kernel.org,
linux-crypto@...r.kernel.org, linux-omap@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, linux-clk@...r.kernel.org,
dmaengine@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-amlogic@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
iommu@...ts.linux-foundation.org, linux-media@...r.kernel.org,
linux-mmc@...r.kernel.org, netdev@...r.kernel.org,
linux-phy@...ts.infradead.org, linux-gpio@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-staging@...ts.linux.dev,
linux-mediatek@...ts.infradead.org, linux-pm@...r.kernel.org,
linux-usb@...r.kernel.org, linux-watchdog@...r.kernel.org,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [RFC v1 PATCH 1/3] drivers: soc: add support for
soc_device_match returning -EPROBE_DEFER
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) <alice.guo@....nxp.com> wrote:
> > From: Alice Guo <alice.guo@....com>
> >
> > 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.
>
> >
> > Signed-off-by: Alice Guo <alice.guo@....com>
>
> Thanks for your patch!
>
> > --- 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?
>
> >
> > 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
Powered by blists - more mailing lists