From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73E1F2F83 for ; Tue, 20 Apr 2021 11:23:29 +0000 (UTC) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13KBMmuM012376; Tue, 20 Apr 2021 11:22:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=R7JGUmF3J71wLA6dPwUce8FwqmxU6JTnhs1XaoTWtpc=; b=mzrAyP3z3vTbOYF05fKTtm1FSfsRhaXIMtNI32junvaq2xixqdu4DFtiOEnKHMCjmDAu pzOmg6bFqIFulJfFAK3gAc4G1ubri2zL7y+ukl2ZTNZd4enmkHEeJ6kOxa09vXbI9Cau pxckDe5aQNXRp1SihBx1WvxHHU5bOAl0qwzbdRlKb6bAcGZRRvbBEvMsbe3h/AM/l6mO 6K0B0emzos5cXJDAWeD+zogdWeN4yukpTfk465biG7Agf/JhaT7Tq2FLJjNIss62qUS9 j74qQsLbz2k9Dn5eRznUZ+6NPhFOVGc2XKyCruqh+CG4TG6qi4y3ofFXm87t+4F6DYgG CQ== Received: from oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 381bjn86tg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:48 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 13KBKXsp006877; Tue, 20 Apr 2021 11:22:47 GMT Received: from pps.reinject (localhost [127.0.0.1]) by aserp3020.oracle.com with ESMTP id 3809k06m19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:47 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 13KBKAbB005467; Tue, 20 Apr 2021 11:22:46 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 3809k06m07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:46 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 13KBMEHV030572; Tue, 20 Apr 2021 11:22:18 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Apr 2021 04:22:13 -0700 Date: Tue, 20 Apr 2021 14:21:52 +0300 From: Dan Carpenter To: Geert Uytterhoeven Cc: "Alice Guo (OSS)" , gregkh@linuxfoundation.org, rafael@kernel.org, horia.geanta@nxp.com, aymen.sghaier@nxp.com, herbert@gondor.apana.org.au, davem@davemloft.net, tony@atomide.com, geert+renesas@glider.be, mturquette@baylibre.com, sboyd@kernel.org, vkoul@kernel.org, peter.ujfalusi@gmail.com, a.hajda@samsung.com, narmstrong@baylibre.com, robert.foss@linaro.org, airlied@linux.ie, daniel@ffwll.ch, khilman@baylibre.com, tomba@kernel.org, jyri.sarha@iki.fi, joro@8bytes.org, will@kernel.org, mchehab@kernel.org, ulf.hansson@linaro.org, adrian.hunter@intel.com, kishon@ti.com, kuba@kernel.org, linus.walleij@linaro.org, Roy.Pledge@nxp.com, leoyang.li@nxp.com, ssantosh@kernel.org, matthias.bgg@gmail.com, edubezval@gmail.com, j-keerthy@ti.com, balbi@kernel.org, linux@prisktech.co.nz, stern@rowland.harvard.edu, wim@linux-watchdog.org, linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-omap@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, dmaengine@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, netdev@vger.kernel.org, linux-phy@lists.infradead.org, linux-gpio@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-staging@lists.linux.dev, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-watchdog@vger.kernel.org, Arnd Bergmann Subject: Re: [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER Message-ID: <20210420112151.GE1981@kadam> References: <20210419042722.27554-1-alice.guo@oss.nxp.com> <20210419042722.27554-2-alice.guo@oss.nxp.com> X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-Proofpoint-ORIG-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM 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) wrote: > > From: Alice Guo > > > > 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 > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED2EBC433B4 for ; Tue, 20 Apr 2021 22:19:10 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 095DA613EC for ; Tue, 20 Apr 2021 22:19:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 095DA613EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FPylJ3KZHz30BH for ; Wed, 21 Apr 2021 08:19:08 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=mzrAyP3z; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=oracle.com (client-ip=205.220.177.32; helo=mx0b-00069f02.pphosted.com; envelope-from=dan.carpenter@oracle.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=mzrAyP3z; dkim-atps=neutral X-Greylist: delayed 210 seconds by postgrey-1.36 at boromir; Tue, 20 Apr 2021 21:27:06 AEST Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FPhGy4DTGz2xdP for ; Tue, 20 Apr 2021 21:27:06 +1000 (AEST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13KBMmuM012376; Tue, 20 Apr 2021 11:22:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=R7JGUmF3J71wLA6dPwUce8FwqmxU6JTnhs1XaoTWtpc=; b=mzrAyP3z3vTbOYF05fKTtm1FSfsRhaXIMtNI32junvaq2xixqdu4DFtiOEnKHMCjmDAu pzOmg6bFqIFulJfFAK3gAc4G1ubri2zL7y+ukl2ZTNZd4enmkHEeJ6kOxa09vXbI9Cau pxckDe5aQNXRp1SihBx1WvxHHU5bOAl0qwzbdRlKb6bAcGZRRvbBEvMsbe3h/AM/l6mO 6K0B0emzos5cXJDAWeD+zogdWeN4yukpTfk465biG7Agf/JhaT7Tq2FLJjNIss62qUS9 j74qQsLbz2k9Dn5eRznUZ+6NPhFOVGc2XKyCruqh+CG4TG6qi4y3ofFXm87t+4F6DYgG CQ== Received: from oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 381bjn86tg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:48 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 13KBKXsp006877; Tue, 20 Apr 2021 11:22:47 GMT Received: from pps.reinject (localhost [127.0.0.1]) by aserp3020.oracle.com with ESMTP id 3809k06m19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:47 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 13KBKAbB005467; Tue, 20 Apr 2021 11:22:46 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 3809k06m07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:46 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 13KBMEHV030572; Tue, 20 Apr 2021 11:22:18 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Apr 2021 04:22:13 -0700 Date: Tue, 20 Apr 2021 14:21:52 +0300 From: Dan Carpenter To: Geert Uytterhoeven Subject: Re: [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER Message-ID: <20210420112151.GE1981@kadam> References: <20210419042722.27554-1-alice.guo@oss.nxp.com> <20210419042722.27554-2-alice.guo@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-Proofpoint-ORIG-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-Mailman-Approved-At: Wed, 21 Apr 2021 08:18:41 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ulf.hansson@linaro.org, aymen.sghaier@nxp.com, geert+renesas@glider.be, rafael@kernel.org, airlied@linux.ie, mturquette@baylibre.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, a.hajda@samsung.com, netdev@vger.kernel.org, linux-phy@lists.infradead.org, peter.ujfalusi@gmail.com, linux-clk@vger.kernel.org, linux-renesas-soc@vger.kernel.org, wim@linux-watchdog.org, herbert@gondor.apana.org.au, horia.geanta@nxp.com, khilman@baylibre.com, joro@8bytes.org, narmstrong@baylibre.com, linux-staging@lists.linux.dev, iommu@lists.linux-foundation.org, kishon@ti.com, tony@atomide.com, linux-omap@vger.kernel.org, stern@rowland.harvard.edu, kuba@kernel.org, linus.walleij@linaro.org, linux@roeck-us.net, linux-media@vger.kernel.org, linux-watchdog@vger.kernel.org, will@kernel.org, linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, edubezval@gmail.com, linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org, ssantosh@kernel.org, matthias.bgg@gmail.com, linux-amlogic@lists.infradead.org, mchehab@kernel.org, linux-arm-kernel@lists.infradead.org, "Alice Guo \(OSS\)" , balbi@kernel.org, tomba@kernel.org, sboyd@kernel.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-mmc@vger.kernel.org, adrian.hunter@intel.com, robert.foss@linaro.org, leoyang.li@nxp.com, linux@prisktech.co.nz, vkoul@kernel.org, Arnd Bergmann , linux-crypto@vger.kernel.org, daniel@ffwll.ch, j-keerthy@ti.com, dmaengine@vger.kernel.org, Roy.Pledge@nxp.com, jyri.sarha@iki.fi, davem@davemloft.net Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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) wrote: > > From: Alice Guo > > > > 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 > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84970C433B4 for ; Tue, 20 Apr 2021 11:57:12 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F1BE3613C0 for ; Tue, 20 Apr 2021 11:57:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1BE3613C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9840A607E3; Tue, 20 Apr 2021 11:57:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sOmsgtNnqjxb; Tue, 20 Apr 2021 11:57:10 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTP id 66BED608BF; Tue, 20 Apr 2021 11:57:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3E9D7C000E; Tue, 20 Apr 2021 11:57:10 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id C5EA5C000B for ; Tue, 20 Apr 2021 11:57:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B3C6D83A56 for ; Tue, 20 Apr 2021 11:57:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=oracle.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M42ehYBUMHeY for ; Tue, 20 Apr 2021 11:57:04 +0000 (UTC) X-Greylist: delayed 00:33:39 by SQLgrey-1.8.0 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by smtp1.osuosl.org (Postfix) with ESMTPS id C4ECA83A42 for ; Tue, 20 Apr 2021 11:57:04 +0000 (UTC) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13KBMmuM012376; Tue, 20 Apr 2021 11:22:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=R7JGUmF3J71wLA6dPwUce8FwqmxU6JTnhs1XaoTWtpc=; b=mzrAyP3z3vTbOYF05fKTtm1FSfsRhaXIMtNI32junvaq2xixqdu4DFtiOEnKHMCjmDAu pzOmg6bFqIFulJfFAK3gAc4G1ubri2zL7y+ukl2ZTNZd4enmkHEeJ6kOxa09vXbI9Cau pxckDe5aQNXRp1SihBx1WvxHHU5bOAl0qwzbdRlKb6bAcGZRRvbBEvMsbe3h/AM/l6mO 6K0B0emzos5cXJDAWeD+zogdWeN4yukpTfk465biG7Agf/JhaT7Tq2FLJjNIss62qUS9 j74qQsLbz2k9Dn5eRznUZ+6NPhFOVGc2XKyCruqh+CG4TG6qi4y3ofFXm87t+4F6DYgG CQ== Received: from oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 381bjn86tg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:48 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 13KBKXsp006877; Tue, 20 Apr 2021 11:22:47 GMT Received: from pps.reinject (localhost [127.0.0.1]) by aserp3020.oracle.com with ESMTP id 3809k06m19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:47 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 13KBKAbB005467; Tue, 20 Apr 2021 11:22:46 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 3809k06m07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:46 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 13KBMEHV030572; Tue, 20 Apr 2021 11:22:18 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Apr 2021 04:22:13 -0700 Date: Tue, 20 Apr 2021 14:21:52 +0300 From: Dan Carpenter To: Geert Uytterhoeven Subject: Re: [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER Message-ID: <20210420112151.GE1981@kadam> References: <20210419042722.27554-1-alice.guo@oss.nxp.com> <20210419042722.27554-2-alice.guo@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-Proofpoint-ORIG-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM Cc: ulf.hansson@linaro.org, aymen.sghaier@nxp.com, geert+renesas@glider.be, rafael@kernel.org, airlied@linux.ie, mturquette@baylibre.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, a.hajda@samsung.com, netdev@vger.kernel.org, linux-phy@lists.infradead.org, peter.ujfalusi@gmail.com, linux-clk@vger.kernel.org, linux-renesas-soc@vger.kernel.org, wim@linux-watchdog.org, herbert@gondor.apana.org.au, horia.geanta@nxp.com, khilman@baylibre.com, narmstrong@baylibre.com, linux-staging@lists.linux.dev, iommu@lists.linux-foundation.org, kishon@ti.com, tony@atomide.com, linux-omap@vger.kernel.org, stern@rowland.harvard.edu, kuba@kernel.org, linus.walleij@linaro.org, linux@roeck-us.net, linux-media@vger.kernel.org, linux-watchdog@vger.kernel.org, will@kernel.org, linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, edubezval@gmail.com, linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org, ssantosh@kernel.org, matthias.bgg@gmail.com, linux-amlogic@lists.infradead.org, mchehab@kernel.org, linux-arm-kernel@lists.infradead.org, "Alice Guo \(OSS\)" , balbi@kernel.org, tomba@kernel.org, sboyd@kernel.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-mmc@vger.kernel.org, adrian.hunter@intel.com, robert.foss@linaro.org, leoyang.li@nxp.com, linux@prisktech.co.nz, vkoul@kernel.org, Arnd Bergmann , linux-crypto@vger.kernel.org, daniel@ffwll.ch, j-keerthy@ti.com, dmaengine@vger.kernel.org, Roy.Pledge@nxp.com, jyri.sarha@iki.fi, davem@davemloft.net X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" 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) wrote: > > From: Alice Guo > > > > 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 > > 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 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BE3CC433B4 for ; Tue, 20 Apr 2021 11:23:50 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD4F5613B2 for ; Tue, 20 Apr 2021 11:23:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD4F5613B2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NGVLHzA0y1Ss/VMlkahi8DTyRk/BWfeJKuaSixMac1c=; b=IjGZ0T/jijkhnFbxt+BBUMvkO iRWiADbkfrLAl147OnScCpMxa0gCtuFsUBND/htpH/DfyZAjfdKxpVxYee32C99V0UYe8yiHZ2Of6 TuKip5Fm5QMZcHh7ghtlQ0jbwne1SPc1W3WqqShtGPRaO87olHuMfBthmp2hMS3zwgocjWTAUUQXz nVwVGmRWNRz1y7OgB+ABKfzyVbaOjD+OPsd0yMGp3GKVfCE1wt0WAVCQafRRLJVOmDAela1EQ5j7L 1ync/bkgzUp5pXYWPMsfqv1eBT8PUYJBjSpbBKLKVgyCdHZzkGGvcQsmiQp2ojVtklYVW5aEJaPsm 0SoBsd7wg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYoTd-00By4C-Rh; Tue, 20 Apr 2021 11:23:33 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYoTV-00By0z-GT; Tue, 20 Apr 2021 11:23:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=R7JGUmF3J71wLA6dPwUce8FwqmxU6JTnhs1XaoTWtpc=; b=MeSHY3ZTrMB1uwH2ggmP8A9ZZr HD5F0Gx6gqm3XXI9FnDeitx8FGX6tev7/9n+oduYisrQHePueUBoUy1QbHYCw3jsCzfK3aWFauCRP QmpfaM8W4e4GQo49ZuWyhEdaNcLu1rcMfVbfGD52P5w693bJ8o6Dzmqr7s/k9d+jesC0NOlhARQXb exV1bLFZJE8xth5ywc1+hDwSBldot7u1GSjuC0CWI1SGyHsVwiEuOZJtqJXyJKhjJC95g+9GUBF8O AKiN5C1hPdljcPtiKmNby/5Zl2p6Ay5WQY87W21qe3YM+162WnNHxM8QLbmZ9U4edu3ILncuVORnt 1lWB95QA==; Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYoTQ-00C461-4I; Tue, 20 Apr 2021 11:23:24 +0000 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13KBMmuM012376; Tue, 20 Apr 2021 11:22:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=R7JGUmF3J71wLA6dPwUce8FwqmxU6JTnhs1XaoTWtpc=; b=mzrAyP3z3vTbOYF05fKTtm1FSfsRhaXIMtNI32junvaq2xixqdu4DFtiOEnKHMCjmDAu pzOmg6bFqIFulJfFAK3gAc4G1ubri2zL7y+ukl2ZTNZd4enmkHEeJ6kOxa09vXbI9Cau pxckDe5aQNXRp1SihBx1WvxHHU5bOAl0qwzbdRlKb6bAcGZRRvbBEvMsbe3h/AM/l6mO 6K0B0emzos5cXJDAWeD+zogdWeN4yukpTfk465biG7Agf/JhaT7Tq2FLJjNIss62qUS9 j74qQsLbz2k9Dn5eRznUZ+6NPhFOVGc2XKyCruqh+CG4TG6qi4y3ofFXm87t+4F6DYgG CQ== Received: from oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 381bjn86tg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:48 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 13KBKXsp006877; Tue, 20 Apr 2021 11:22:47 GMT Received: from pps.reinject (localhost [127.0.0.1]) by aserp3020.oracle.com with ESMTP id 3809k06m19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:47 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 13KBKAbB005467; Tue, 20 Apr 2021 11:22:46 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 3809k06m07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:46 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 13KBMEHV030572; Tue, 20 Apr 2021 11:22:18 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Apr 2021 04:22:13 -0700 Date: Tue, 20 Apr 2021 14:21:52 +0300 From: Dan Carpenter To: Geert Uytterhoeven Cc: "Alice Guo (OSS)" , gregkh@linuxfoundation.org, rafael@kernel.org, horia.geanta@nxp.com, aymen.sghaier@nxp.com, herbert@gondor.apana.org.au, davem@davemloft.net, tony@atomide.com, geert+renesas@glider.be, mturquette@baylibre.com, sboyd@kernel.org, vkoul@kernel.org, peter.ujfalusi@gmail.com, a.hajda@samsung.com, narmstrong@baylibre.com, robert.foss@linaro.org, airlied@linux.ie, daniel@ffwll.ch, khilman@baylibre.com, tomba@kernel.org, jyri.sarha@iki.fi, joro@8bytes.org, will@kernel.org, mchehab@kernel.org, ulf.hansson@linaro.org, adrian.hunter@intel.com, kishon@ti.com, kuba@kernel.org, linus.walleij@linaro.org, Roy.Pledge@nxp.com, leoyang.li@nxp.com, ssantosh@kernel.org, matthias.bgg@gmail.com, edubezval@gmail.com, j-keerthy@ti.com, balbi@kernel.org, linux@prisktech.co.nz, stern@rowland.harvard.edu, wim@linux-watchdog.org, linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-omap@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, dmaengine@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, netdev@vger.kernel.org, linux-phy@lists.infradead.org, linux-gpio@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-staging@lists.linux.dev, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-watchdog@vger.kernel.org, Arnd Bergmann Subject: Re: [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER Message-ID: <20210420112151.GE1981@kadam> References: <20210419042722.27554-1-alice.guo@oss.nxp.com> <20210419042722.27554-2-alice.guo@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-Proofpoint-ORIG-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210420_042320_304965_F932ACDC X-CRM114-Status: GOOD ( 24.45 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org 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) wrote: > > From: Alice Guo > > > > 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 > > 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 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64FF1C433B4 for ; Tue, 20 Apr 2021 11:57:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0E2DE613AF for ; Tue, 20 Apr 2021 11:57:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E2DE613AF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 32FB889CA0; Tue, 20 Apr 2021 11:57:05 +0000 (UTC) X-Greylist: delayed 2028 seconds by postgrey-1.36 at gabe; Tue, 20 Apr 2021 11:57:03 UTC Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by gabe.freedesktop.org (Postfix) with ESMTPS id B3FB789CA0 for ; Tue, 20 Apr 2021 11:57:03 +0000 (UTC) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13KBMmuM012376; Tue, 20 Apr 2021 11:22:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=R7JGUmF3J71wLA6dPwUce8FwqmxU6JTnhs1XaoTWtpc=; b=mzrAyP3z3vTbOYF05fKTtm1FSfsRhaXIMtNI32junvaq2xixqdu4DFtiOEnKHMCjmDAu pzOmg6bFqIFulJfFAK3gAc4G1ubri2zL7y+ukl2ZTNZd4enmkHEeJ6kOxa09vXbI9Cau pxckDe5aQNXRp1SihBx1WvxHHU5bOAl0qwzbdRlKb6bAcGZRRvbBEvMsbe3h/AM/l6mO 6K0B0emzos5cXJDAWeD+zogdWeN4yukpTfk465biG7Agf/JhaT7Tq2FLJjNIss62qUS9 j74qQsLbz2k9Dn5eRznUZ+6NPhFOVGc2XKyCruqh+CG4TG6qi4y3ofFXm87t+4F6DYgG CQ== Received: from oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 381bjn86tg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:48 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 13KBKXsp006877; Tue, 20 Apr 2021 11:22:47 GMT Received: from pps.reinject (localhost [127.0.0.1]) by aserp3020.oracle.com with ESMTP id 3809k06m19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:47 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 13KBKAbB005467; Tue, 20 Apr 2021 11:22:46 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 3809k06m07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:46 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 13KBMEHV030572; Tue, 20 Apr 2021 11:22:18 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Apr 2021 04:22:13 -0700 Date: Tue, 20 Apr 2021 14:21:52 +0300 From: Dan Carpenter To: Geert Uytterhoeven Subject: Re: [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER Message-ID: <20210420112151.GE1981@kadam> References: <20210419042722.27554-1-alice.guo@oss.nxp.com> <20210419042722.27554-2-alice.guo@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-Proofpoint-ORIG-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ulf.hansson@linaro.org, aymen.sghaier@nxp.com, geert+renesas@glider.be, rafael@kernel.org, airlied@linux.ie, mturquette@baylibre.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, a.hajda@samsung.com, netdev@vger.kernel.org, linux-phy@lists.infradead.org, peter.ujfalusi@gmail.com, linux-clk@vger.kernel.org, linux-renesas-soc@vger.kernel.org, wim@linux-watchdog.org, herbert@gondor.apana.org.au, horia.geanta@nxp.com, khilman@baylibre.com, joro@8bytes.org, narmstrong@baylibre.com, linux-staging@lists.linux.dev, iommu@lists.linux-foundation.org, kishon@ti.com, tony@atomide.com, linux-omap@vger.kernel.org, stern@rowland.harvard.edu, kuba@kernel.org, linux@roeck-us.net, linux-media@vger.kernel.org, linux-watchdog@vger.kernel.org, will@kernel.org, linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, edubezval@gmail.com, linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org, ssantosh@kernel.org, matthias.bgg@gmail.com, linux-amlogic@lists.infradead.org, mchehab@kernel.org, linux-arm-kernel@lists.infradead.org, "Alice Guo \(OSS\)" , balbi@kernel.org, tomba@kernel.org, sboyd@kernel.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-mmc@vger.kernel.org, adrian.hunter@intel.com, robert.foss@linaro.org, leoyang.li@nxp.com, linux@prisktech.co.nz, vkoul@kernel.org, Arnd Bergmann , linux-crypto@vger.kernel.org, j-keerthy@ti.com, dmaengine@vger.kernel.org, Roy.Pledge@nxp.com, jyri.sarha@iki.fi, davem@davemloft.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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) wrote: > > From: Alice Guo > > > > 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 > > 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 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EE84C433B4 for ; Tue, 20 Apr 2021 11:23:42 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C4FF461363 for ; Tue, 20 Apr 2021 11:23:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4FF461363 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4l7P/OC2wFmiC7M2jAIfkqcaMnYskfSx5jIt5yxCQ/c=; b=hvx7Nk1Mu65O2ZuCVI4idaC2i YwMaFp/vvroKcbALnMF0oWZSUpb9pu4lBRaAC0KbVgpnZdovTiqqcLsy3nHvkgufvnH1ufrya0oWz rvxf0rBlQOqT+5PqAA92vW5xoRkY3XjkVAS3JaEaYA/BJ/Wi0sHsaPMkFNWefwVN/iH+nfum0gTFR Z4RY3t3YQBoqZwOtRh109SVIQ58K7IUeMAekiqoXcgkvhNe+OBc2UGCa9EMHoU23J71AEQJFGYNBe Fma6PvNKKJ6P5qFIEMsw66auGnnpyjigJUUhCdHCFZAF0zY1CmxgJOZ6LpiBRBMfwdhYdoHjThHHf UOKj5jWBA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYoTa-00By2o-JM; Tue, 20 Apr 2021 11:23:30 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYoTV-00By0z-GT; Tue, 20 Apr 2021 11:23:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=R7JGUmF3J71wLA6dPwUce8FwqmxU6JTnhs1XaoTWtpc=; b=MeSHY3ZTrMB1uwH2ggmP8A9ZZr HD5F0Gx6gqm3XXI9FnDeitx8FGX6tev7/9n+oduYisrQHePueUBoUy1QbHYCw3jsCzfK3aWFauCRP QmpfaM8W4e4GQo49ZuWyhEdaNcLu1rcMfVbfGD52P5w693bJ8o6Dzmqr7s/k9d+jesC0NOlhARQXb exV1bLFZJE8xth5ywc1+hDwSBldot7u1GSjuC0CWI1SGyHsVwiEuOZJtqJXyJKhjJC95g+9GUBF8O AKiN5C1hPdljcPtiKmNby/5Zl2p6Ay5WQY87W21qe3YM+162WnNHxM8QLbmZ9U4edu3ILncuVORnt 1lWB95QA==; Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYoTQ-00C461-4I; Tue, 20 Apr 2021 11:23:24 +0000 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13KBMmuM012376; Tue, 20 Apr 2021 11:22:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=R7JGUmF3J71wLA6dPwUce8FwqmxU6JTnhs1XaoTWtpc=; b=mzrAyP3z3vTbOYF05fKTtm1FSfsRhaXIMtNI32junvaq2xixqdu4DFtiOEnKHMCjmDAu pzOmg6bFqIFulJfFAK3gAc4G1ubri2zL7y+ukl2ZTNZd4enmkHEeJ6kOxa09vXbI9Cau pxckDe5aQNXRp1SihBx1WvxHHU5bOAl0qwzbdRlKb6bAcGZRRvbBEvMsbe3h/AM/l6mO 6K0B0emzos5cXJDAWeD+zogdWeN4yukpTfk465biG7Agf/JhaT7Tq2FLJjNIss62qUS9 j74qQsLbz2k9Dn5eRznUZ+6NPhFOVGc2XKyCruqh+CG4TG6qi4y3ofFXm87t+4F6DYgG CQ== Received: from oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 381bjn86tg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:48 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 13KBKXsp006877; Tue, 20 Apr 2021 11:22:47 GMT Received: from pps.reinject (localhost [127.0.0.1]) by aserp3020.oracle.com with ESMTP id 3809k06m19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:47 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 13KBKAbB005467; Tue, 20 Apr 2021 11:22:46 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 3809k06m07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:46 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 13KBMEHV030572; Tue, 20 Apr 2021 11:22:18 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Apr 2021 04:22:13 -0700 Date: Tue, 20 Apr 2021 14:21:52 +0300 From: Dan Carpenter To: Geert Uytterhoeven Cc: "Alice Guo (OSS)" , gregkh@linuxfoundation.org, rafael@kernel.org, horia.geanta@nxp.com, aymen.sghaier@nxp.com, herbert@gondor.apana.org.au, davem@davemloft.net, tony@atomide.com, geert+renesas@glider.be, mturquette@baylibre.com, sboyd@kernel.org, vkoul@kernel.org, peter.ujfalusi@gmail.com, a.hajda@samsung.com, narmstrong@baylibre.com, robert.foss@linaro.org, airlied@linux.ie, daniel@ffwll.ch, khilman@baylibre.com, tomba@kernel.org, jyri.sarha@iki.fi, joro@8bytes.org, will@kernel.org, mchehab@kernel.org, ulf.hansson@linaro.org, adrian.hunter@intel.com, kishon@ti.com, kuba@kernel.org, linus.walleij@linaro.org, Roy.Pledge@nxp.com, leoyang.li@nxp.com, ssantosh@kernel.org, matthias.bgg@gmail.com, edubezval@gmail.com, j-keerthy@ti.com, balbi@kernel.org, linux@prisktech.co.nz, stern@rowland.harvard.edu, wim@linux-watchdog.org, linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-omap@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, dmaengine@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, netdev@vger.kernel.org, linux-phy@lists.infradead.org, linux-gpio@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-staging@lists.linux.dev, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-watchdog@vger.kernel.org, Arnd Bergmann Subject: Re: [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER Message-ID: <20210420112151.GE1981@kadam> References: <20210419042722.27554-1-alice.guo@oss.nxp.com> <20210419042722.27554-2-alice.guo@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-Proofpoint-ORIG-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210420_042320_304965_F932ACDC X-CRM114-Status: GOOD ( 24.45 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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) wrote: > > From: Alice Guo > > > > 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 > > 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 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 079D4C433ED for ; Tue, 20 Apr 2021 11:23:38 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4E80C613AF for ; Tue, 20 Apr 2021 11:23:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E80C613AF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=s6jte/0nEaqKyTXHj1LYScb+CPFa14+crrzdwr/GxKM=; b=qm7t65yU+DnYvEUapmSpTX4Kk QGgyvubSg8e3qPTExAmyQvHLPqRV8r4TQF5vTPhBKXjxzq+S26YXGZ8qDb+/g3eW3uDPARVPw9mdy 4CkEWMY3bdyUNvsY1JHgb6mJhCko3HbmdSt0iIab0enAeN907QRz17n7sGEKi8Ztn0g9iU9Tgq/i3 wEMdUJ/eZt9EIOKFva0NgkqxUJGJ00R0jkC+pYq8l6/ZK3g5cmZr+qHcAetVTgEK3tI96HE+0XAVh ag91XJBOwmC4bSghQCEOIuo2sRCNBjbggVXkEcD2gxdNCaFT4uRRPn9qj+DLbNYikJ+ponhwMP9E0 u+sqNz6hA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYoTf-00By4y-Co; Tue, 20 Apr 2021 11:23:35 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYoTV-00By0z-GT; Tue, 20 Apr 2021 11:23:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=R7JGUmF3J71wLA6dPwUce8FwqmxU6JTnhs1XaoTWtpc=; b=MeSHY3ZTrMB1uwH2ggmP8A9ZZr HD5F0Gx6gqm3XXI9FnDeitx8FGX6tev7/9n+oduYisrQHePueUBoUy1QbHYCw3jsCzfK3aWFauCRP QmpfaM8W4e4GQo49ZuWyhEdaNcLu1rcMfVbfGD52P5w693bJ8o6Dzmqr7s/k9d+jesC0NOlhARQXb exV1bLFZJE8xth5ywc1+hDwSBldot7u1GSjuC0CWI1SGyHsVwiEuOZJtqJXyJKhjJC95g+9GUBF8O AKiN5C1hPdljcPtiKmNby/5Zl2p6Ay5WQY87W21qe3YM+162WnNHxM8QLbmZ9U4edu3ILncuVORnt 1lWB95QA==; Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYoTQ-00C461-4I; Tue, 20 Apr 2021 11:23:24 +0000 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13KBMmuM012376; Tue, 20 Apr 2021 11:22:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=R7JGUmF3J71wLA6dPwUce8FwqmxU6JTnhs1XaoTWtpc=; b=mzrAyP3z3vTbOYF05fKTtm1FSfsRhaXIMtNI32junvaq2xixqdu4DFtiOEnKHMCjmDAu pzOmg6bFqIFulJfFAK3gAc4G1ubri2zL7y+ukl2ZTNZd4enmkHEeJ6kOxa09vXbI9Cau pxckDe5aQNXRp1SihBx1WvxHHU5bOAl0qwzbdRlKb6bAcGZRRvbBEvMsbe3h/AM/l6mO 6K0B0emzos5cXJDAWeD+zogdWeN4yukpTfk465biG7Agf/JhaT7Tq2FLJjNIss62qUS9 j74qQsLbz2k9Dn5eRznUZ+6NPhFOVGc2XKyCruqh+CG4TG6qi4y3ofFXm87t+4F6DYgG CQ== Received: from oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 381bjn86tg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:48 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 13KBKXsp006877; Tue, 20 Apr 2021 11:22:47 GMT Received: from pps.reinject (localhost [127.0.0.1]) by aserp3020.oracle.com with ESMTP id 3809k06m19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:47 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 13KBKAbB005467; Tue, 20 Apr 2021 11:22:46 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 3809k06m07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 11:22:46 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 13KBMEHV030572; Tue, 20 Apr 2021 11:22:18 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Apr 2021 04:22:13 -0700 Date: Tue, 20 Apr 2021 14:21:52 +0300 From: Dan Carpenter To: Geert Uytterhoeven Cc: "Alice Guo (OSS)" , gregkh@linuxfoundation.org, rafael@kernel.org, horia.geanta@nxp.com, aymen.sghaier@nxp.com, herbert@gondor.apana.org.au, davem@davemloft.net, tony@atomide.com, geert+renesas@glider.be, mturquette@baylibre.com, sboyd@kernel.org, vkoul@kernel.org, peter.ujfalusi@gmail.com, a.hajda@samsung.com, narmstrong@baylibre.com, robert.foss@linaro.org, airlied@linux.ie, daniel@ffwll.ch, khilman@baylibre.com, tomba@kernel.org, jyri.sarha@iki.fi, joro@8bytes.org, will@kernel.org, mchehab@kernel.org, ulf.hansson@linaro.org, adrian.hunter@intel.com, kishon@ti.com, kuba@kernel.org, linus.walleij@linaro.org, Roy.Pledge@nxp.com, leoyang.li@nxp.com, ssantosh@kernel.org, matthias.bgg@gmail.com, edubezval@gmail.com, j-keerthy@ti.com, balbi@kernel.org, linux@prisktech.co.nz, stern@rowland.harvard.edu, wim@linux-watchdog.org, linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-omap@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, dmaengine@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, netdev@vger.kernel.org, linux-phy@lists.infradead.org, linux-gpio@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-staging@lists.linux.dev, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-watchdog@vger.kernel.org, Arnd Bergmann Subject: Re: [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER Message-ID: <20210420112151.GE1981@kadam> References: <20210419042722.27554-1-alice.guo@oss.nxp.com> <20210419042722.27554-2-alice.guo@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-Proofpoint-ORIG-GUID: e0r_GcH24oUhB4PQiI_vI2-dauff_ZRM X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210420_042320_304965_F932ACDC X-CRM114-Status: GOOD ( 24.45 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org 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) wrote: > > From: Alice Guo > > > > 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 > > 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 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy