Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4225447pxb; Thu, 14 Oct 2021 00:40:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzw88qDALGXNIIIr5oPluk1qCUeJjcfwnrxMBEESP88/FdVe0/lYwhsuhxyKmTyBKlJORSe X-Received: by 2002:aa7:8b49:0:b0:44d:65a9:fb9d with SMTP id i9-20020aa78b49000000b0044d65a9fb9dmr3953410pfd.24.1634197245036; Thu, 14 Oct 2021 00:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634197245; cv=none; d=google.com; s=arc-20160816; b=tnsypwcJdSDbxXUMpymAU7G5Z5zC7ExBysxLtexDJ8r+ulRBPGUAUInRUWS3SFXNII vCUTJtR8yqOw74dxlGUQnKBASV5KsQlwcx/SKCYMr+NNwtXRN3Nfe8psQXQqPgVcBWuY mHmGJKqNNfkLJdFtK4M0t/A2Ywj2C6RwFOKPZZT1eDjkECb0s+xISqw0BKo8cEM7GCSH 0QcRzY1aFivLK35hRFxARyHKuf5Vb21nuoPJXWESN+6T6Bey534RfIIWPUsSZmMgkbu/ JEQKL8F/dvpzx43uzlBIN5by7jwmty4Acg6M/SliosCWAizJB+CeeulCEEL5Hii67++I 88Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1E/kwe6KsaY7ajv8p7giaTw/a0T8vcfhIkutRN0RLxQ=; b=oiBm2YOixS1Txc7gufnu2hFBvYqIlaw8ey7wQ7YPVxTbJuaPv7JNtr7blz9wg95I+f uS5CysCHGtPQGb89TwJA6E3DHva+S6rN3itc8X3ZnL8L5BFPN+iuN1npG3OJIGA8qx6G 6/6uBajv7bXfb4GaiFcRdP7YhQqiakhEMRMcOEpN7b2e7L/A+8unKqwSy+1+g0XR4Y7I 0xsGL2BWEf5dI2bKk31NCfOp2g+hpC/il6Tv+u6/COghhJ/3wKr2KCwywbYqIATAupmK XMLBahxSPz9easJFAmpZ/BL2Uu53NP6dVAZztyTNKsjjABHx/RJ9l2yMMGGu7suT6Q10 HF7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TVbBZX+y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u16si2498165pga.567.2021.10.14.00.40.17; Thu, 14 Oct 2021 00:40:45 -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; dkim=pass header.i=@linaro.org header.s=google header.b=TVbBZX+y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229967AbhJNHmS (ORCPT + 99 others); Thu, 14 Oct 2021 03:42:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229970AbhJNHmS (ORCPT ); Thu, 14 Oct 2021 03:42:18 -0400 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2C4BC061753 for ; Thu, 14 Oct 2021 00:40:13 -0700 (PDT) Received: by mail-ot1-x333.google.com with SMTP id p6-20020a9d7446000000b0054e6bb223f3so7102418otk.3 for ; Thu, 14 Oct 2021 00:40:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1E/kwe6KsaY7ajv8p7giaTw/a0T8vcfhIkutRN0RLxQ=; b=TVbBZX+yY6sVd38Qak+8ox+GerwvgJpdv/kYT/Mg3X1a3+QL2ojam0QroD1PTLSFgs gmWj8UfYcVkpZtHrJMV29kE3vaOczobGdtPWVcXHBoySlejzRkdJA2Fe+mIGJJ6PcKVB O4V7bss42my+9YdzKLtiK9ysslfFJmA6M0Y38yWfwAeDyMFzMBhnQ3YEO6A2Ybeq0ZQe RVP/ZqsEVgkDMHTW95hyp0URdfUYYfS5/TOq4XNx3NsCb2M2dbLT8gCcY5UTiCFWZ1+a /05W4xqn5NDvpWYKUUficMtjGQ1TEAIDX7DkzitWggZdk+lX/Y5B/5XMagKcrgayOboq MszA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1E/kwe6KsaY7ajv8p7giaTw/a0T8vcfhIkutRN0RLxQ=; b=Pha5Ky8Hpwjf68vTouo7oVcm+fDnIRYnLNzDQ/GF09ZrHFis/4olVJqNdDygtB4Buk Tt6to/uol8y8wBM4ZZUMW51AO36bwDN2sLXsxrNoWFrO1k230XD7mMoidDL3w80JAqCI UM5u8Icl19ztz+P6zYBbsWMqukOXtbS6Ukg/vgEroQUWhfnQsDAN5kNsZ7KyMCz7CC+/ +f1MZ2byHa9X38WRa2MEWzEOrxNBo5HSKVLGBRvqr2Y/WdflB+tYDtROc6CzfnB5DB1X xil0DwNAZqi+t/svU1A47GA9WbrFGnsdHeSYvL5OYl/7gUQ3oBu4bI0KnD1Mpvcf2Rqe oYyQ== X-Gm-Message-State: AOAM531v/EobvuHvOnIZkuV1Qv94tMHt7Cux+FgK+Y6Brj28YVpW2EPu lhfz/0fcDS0ZqyvbGlasy/UAbslxV8Aq7O5F56e/3A== X-Received: by 2002:a05:6830:1c26:: with SMTP id f6mr1129554ote.28.1634197212897; Thu, 14 Oct 2021 00:40:12 -0700 (PDT) MIME-Version: 1.0 References: <20211013105541.68045-1-bhupesh.sharma@linaro.org> <20211013105541.68045-19-bhupesh.sharma@linaro.org> <74893e20-3dd8-9b57-69bb-025264f51186@linaro.org> In-Reply-To: <74893e20-3dd8-9b57-69bb-025264f51186@linaro.org> From: Bhupesh Sharma Date: Thu, 14 Oct 2021 13:10:01 +0530 Message-ID: Subject: Re: [PATCH v4 18/20] crypto: qce: Defer probing if BAM dma channel is not yet initialized To: Vladimir Zapolskiy Cc: MSM , linux-crypto@vger.kernel.org, bhupesh.linux@gmail.com, Linux Kernel Mailing List , devicetree , Rob Herring , Andy Gross , Herbert Xu , "David S . Miller" , Thara Gopinath , Bjorn Andersson Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Vladimir, On Thu, 14 Oct 2021 at 02:19, Vladimir Zapolskiy wrote: > > Hi Bhupesh, > > On 10/13/21 1:55 PM, Bhupesh Sharma wrote: > > Since the Qualcomm qce crypto driver needs the BAM dma driver to be > > setup first (to allow crypto operations), it makes sense to defer > > the qce crypto driver probing in case the BAM dma driver is not yet > > probed. > > > > Move the code leg requesting dma channels earlier in the > > probe() flow. This fixes the qce probe failure issues when both qce > > and BMA dma are compiled as static part of the kernel. > > > > Cc: Thara Gopinath > > Cc: Bjorn Andersson > > Signed-off-by: Bhupesh Sharma > > --- > > drivers/crypto/qce/core.c | 20 ++++++++++++-------- > > 1 file changed, 12 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c > > index cb8c77709e1e..c6f686126fc9 100644 > > --- a/drivers/crypto/qce/core.c > > +++ b/drivers/crypto/qce/core.c > > @@ -209,9 +209,19 @@ static int qce_crypto_probe(struct platform_device *pdev) > > if (ret < 0) > > return ret; > > > > + /* qce driver requires BAM dma driver to be setup first. > > I believe a multi-line block of comments should be started with '/*' line, > for reference please take a look at Documentation/process/coding-style.rst There are exceptions to this rule as well. For e.g. see most of the networking drivers and the multi-line comment styles there :) . There is a very interesting LWN article on the same : https://lwn.net/Articles/694755/ Note that 'crypto/' and 'drivers/crypto' use these non-standard multi-line comments quite often as well. That said, I have no strong opinion on using either style. Although, I found one of the points raised by the networking maintainer during one of my patch reviews earlier quite useful - 'keeping the top line in a multi-line comment blank, wastes precious screen space while reading and reviewing the patch'. Regards, Bhupesh > > + * In case the dma channel are not set yet, this check > > + * helps use to return -EPROBE_DEFER earlier. > > + */ > > + ret = qce_dma_request(qce->dev, &qce->dma); > > + if (ret) > > + return ret; > > + > > qce->mem_path = of_icc_get(qce->dev, "memory"); > > - if (IS_ERR(qce->mem_path)) > > + if (IS_ERR(qce->mem_path)) { > > + qce_dma_release(&qce->dma); > > return PTR_ERR(qce->mem_path); > > + } > > > > qce->core = devm_clk_get_optional(qce->dev, "core"); > > if (IS_ERR(qce->core)) { > > @@ -247,10 +257,6 @@ static int qce_crypto_probe(struct platform_device *pdev) > > if (ret) > > goto err_clks_iface; > > > > - ret = qce_dma_request(qce->dev, &qce->dma); > > - if (ret) > > - goto err_clks; > > - > > ret = qce_check_version(qce); > > if (ret) > > goto err_clks; > > @@ -265,12 +271,10 @@ static int qce_crypto_probe(struct platform_device *pdev) > > > > ret = qce_register_algs(qce); > > if (ret) > > - goto err_dma; > > + goto err_clks; > > > > return 0; > > > > -err_dma: > > - qce_dma_release(&qce->dma); > > err_clks: > > clk_disable_unprepare(qce->bus); > > err_clks_iface: > > > > -- > Best wishes, > Vladimir