Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2177930pxb; Sun, 18 Apr 2021 22:03:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhrvnBKZ55LmfSdMMug8Q7PmbNt9GiAhQbpPDuxBAtEDMz4hdB8vO+dsorNhTcXeKUJMvy X-Received: by 2002:aa7:d54c:: with SMTP id u12mr24351312edr.234.1618808620896; Sun, 18 Apr 2021 22:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618808620; cv=none; d=google.com; s=arc-20160816; b=EWTt7zfRlTFIhi/cPa8sYKvl2EugAhc1mMtgc74g4kuFCBqXIGK4eja8TESEzDZ6pc 75gyTUTtQKiR95y3rYKdVNbYK1pV9T+ykiLDQ+gp3gXl1qFyCE8fcrzie2L9MLUHutgL ttUlrLWZyU85zv9EfG8C1+u8tjAytTYcPYqMsMfCtgU+YpFxXXVFdBSJI32UQhQr1uoD Gzxp8NtgSNe00jw9VNOErLqXA0wRxo/B9MWfu8HH38vFu81S5G49k+cl03VKy4U6pPjR Ox1IUzcpgNpD/V7jhpzM7Kt6V87zXwJk/shXx6fLgoEYHwKZJENQ08E75/gjLSQDS1fv TxHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=bLr973ENjFZQNNz5/z+BmoCFuTDVovYaAYguOO0YOc4=; b=lnD9vfETD889PaqhKO9oRSlc9ATUIzk2kDhURvSV0mV3c/awmPui9J4AXdofWTJ8AJ teQA5sC8T2pjrkQuvEt6fvg6JdOg7zqQqUt4+zs/tWhQcIAOcRwl1CN038judqx+KGwj ef44DMwxxExupIVYXFYdynW0vE+i5JsLjXYSu+4D8AGBkDmNWkVu7+wSJ5RjTjM2B6cS Zb6P7lSre1C8qG7gyGtdR7GZg4yJFAXJDbJN7hIKc8R5NOdry8rgH2+2b3bBGn31m/di Y0WGFrIhpMqBYpkydSJKJDA2l5DimtxldJeu7Ig/VMJob57eU0yaiZU9bK+fSTMACZxT 9Ilg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ko15si11542063ejc.564.2021.04.18.22.03.17; Sun, 18 Apr 2021 22:03:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230111AbhDSFDe (ORCPT + 99 others); Mon, 19 Apr 2021 01:03:34 -0400 Received: from gw.atmark-techno.com ([13.115.124.170]:56494 "EHLO gw.atmark-techno.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230148AbhDSFDc (ORCPT ); Mon, 19 Apr 2021 01:03:32 -0400 Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by gw.atmark-techno.com (Postfix) with ESMTPS id 9ADD3804A9 for ; Mon, 19 Apr 2021 14:03:00 +0900 (JST) Received: by mail-pl1-f197.google.com with SMTP id d29-20020a17090259ddb02900eadb61377aso12451460plj.22 for ; Sun, 18 Apr 2021 22:03:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bLr973ENjFZQNNz5/z+BmoCFuTDVovYaAYguOO0YOc4=; b=FYUoBBxRVX+n2CaEgAFIuOwxJSRWvpmoqUSSNv/FBiG/zCOU1qd3VaKtLa+tke66C8 AdwVrZ9SiytfdiwnagWh0cLQn66yBfR6yvnMh4/goIGH7jPPtY/2GMnzYFKWHHHzsyo3 TB3GsFv3xkq654R046EY3eV5cG7+j5QzE63IBSQTO6vzTr07DhGkYWwm+4NyiQoqoJ6L 4iYmpDsQUPT7x1xYoQwHoWT53ilkluV6LwuYNTxxo5P07qmEDeCr9Jx2C7HtU749KV0k HdXt0rdztNYdUJtrhl1K6/AvScMMiDzl5SlOn5wkOjpyfy1ZMvuT6pDezZf65rMD7l2U nS7w== X-Gm-Message-State: AOAM531OkrcnfCW3HZ/tVCy2sC2RigP4nloeZjzlOt4OwjRDlGbSimlN iFbMZSxpSHgv9VUAyYMbkHCP9uIKY4Prsmx1OapmmcJz4090wCAOujklWqXHGUkqGfkUA0X9YE9 M/3r9vln9O4E/fY3urMy6zUgWDsSh X-Received: by 2002:a17:902:d645:b029:e8:ec90:d097 with SMTP id y5-20020a170902d645b02900e8ec90d097mr21074791plh.47.1618808579508; Sun, 18 Apr 2021 22:02:59 -0700 (PDT) X-Received: by 2002:a17:902:d645:b029:e8:ec90:d097 with SMTP id y5-20020a170902d645b02900e8ec90d097mr21074765plh.47.1618808579243; Sun, 18 Apr 2021 22:02:59 -0700 (PDT) Received: from pc-0115 (103.131.189.35.bc.googleusercontent.com. [35.189.131.103]) by smtp.gmail.com with ESMTPSA id ga21sm2553351pjb.5.2021.04.18.22.02.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Apr 2021 22:02:58 -0700 (PDT) Received: from martinet by pc-0115 with local (Exim 4.94) (envelope-from ) id 1lYM3l-0016Ra-6N; Mon, 19 Apr 2021 14:02:57 +0900 Date: Mon, 19 Apr 2021 14:02:47 +0900 From: Dominique MARTINET To: "Alice Guo (OSS)" Cc: 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 Subject: Re: [RFC v1 PATCH 3/3] driver: update all the code that use soc_device_match Message-ID: References: <20210419042722.27554-1-alice.guo@oss.nxp.com> <20210419042722.27554-4-alice.guo@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210419042722.27554-4-alice.guo@oss.nxp.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Alice Guo (OSS) wrote on Mon, Apr 19, 2021 at 12:27:22PM +0800: > From: Alice Guo > > Update all the code that use soc_device_match A single patch might be difficult to accept for all components, a each maintainer will probably want to have a say on their subsystem? I would suggest to split these for a non-RFC version; a this will really need to be case-by-case handling. > because add support for soc_device_match returning -EPROBE_DEFER. (English does not parse here for me) I've only commented a couple of places in the code itself, but this doesn't seem to add much support for errors, just sweep the problem under the rug. > Signed-off-by: Alice Guo > --- > > diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c > index 5fae60f8c135..00c59aa217c1 100644 > --- a/drivers/bus/ti-sysc.c > +++ b/drivers/bus/ti-sysc.c > @@ -2909,7 +2909,7 @@ static int sysc_init_soc(struct sysc *ddata) > } > > match = soc_device_match(sysc_soc_feat_match); > - if (!match) > + if (!match || IS_ERR(match)) > return 0; This function handles errors, I would recommend returning the error as is if soc_device_match returned one so the probe can be retried later. > > if (match->data) > diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c > index c32d2c678046..90a18336a4c3 100644 > --- a/drivers/clk/renesas/r8a7795-cpg-mssr.c > +++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c > @@ -439,6 +439,7 @@ static const unsigned int r8a7795es2_mod_nullify[] __initconst = { > > static int __init r8a7795_cpg_mssr_init(struct device *dev) > { > + const struct soc_device_attribute *match; > const struct rcar_gen3_cpg_pll_config *cpg_pll_config; > u32 cpg_mode; > int error; > @@ -453,7 +454,8 @@ static int __init r8a7795_cpg_mssr_init(struct device *dev) > return -EINVAL; > } > > - if (soc_device_match(r8a7795es1)) { > + match = soc_device_match(r8a7795es1); > + if (!IS_ERR(match) && match) { Same, return the error. Assuming an error means no match will just lead to hard to debug problems because the driver potentially assumed the wrong device when it's just not ready yet. > cpg_core_nullify_range(r8a7795_core_clks, > ARRAY_SIZE(r8a7795_core_clks), > R8A7795_CLK_S0D2, R8A7795_CLK_S0D12); > [...] > diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c > index eaaec0a55cc6..13a06b613379 100644 > --- a/drivers/iommu/ipmmu-vmsa.c > +++ b/drivers/iommu/ipmmu-vmsa.c > @@ -757,17 +757,20 @@ static const char * const devices_allowlist[] = { > > static bool ipmmu_device_is_allowed(struct device *dev) > { > + const struct soc_device_attribute *match1, *match2; > unsigned int i; > > /* > * R-Car Gen3 and RZ/G2 use the allow list to opt-in devices. > * For Other SoCs, this returns true anyway. > */ > - if (!soc_device_match(soc_needs_opt_in)) > + match1 = soc_device_match(soc_needs_opt_in); > + if (!IS_ERR(match1) && !match1) I'm not sure what you intended to do, but !match1 already means there is no error so the original code is identical. In this case ipmmu_device_is_allowed does not allow errors so this is one of the "difficult" drivers that require slightly more thinking. It is only called in ipmmu_of_xlate which does return errors properly, so in this case the most straightforward approach would be to make ipmmu_device_is_allowed return an int and forward errors as well. ... This is going to need quite some more work to be acceptable, in my opinion, but I think it should be possible. Thanks, -- Dominique