From patchwork Mon Jun 18 18:36:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10472531 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 48C7060532 for ; Mon, 18 Jun 2018 18:37:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A76C28706 for ; Mon, 18 Jun 2018 18:37:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E792205AF; Mon, 18 Jun 2018 18:37:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6590205AF for ; Mon, 18 Jun 2018 18:37:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935704AbeFRShF (ORCPT ); Mon, 18 Jun 2018 14:37:05 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:41339 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935578AbeFRShE (ORCPT ); Mon, 18 Jun 2018 14:37:04 -0400 Received: by mail-pl0-f67.google.com with SMTP id w8-v6so7982717ply.8 for ; Mon, 18 Jun 2018 11:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=OMFMi5fcJ7dj1rJGD2+w2YYPlVEf5YMSNf4ukEvDuS4=; b=KMUjwRZUbliUTHx+l+B4k0FfgTGgydXX7kdBfR0NtcQSbrR2bOPTq2depYYzak4eLP csaccm77BtaYgnPzVL9hmwajG5RNyCk9oOBy6j/xwHPKe8W4ABnD1fPtZFQA13PBwiiR GJQ3TTDibOR4HptkqL7nj8OsDFx1cQKYdCX2E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=OMFMi5fcJ7dj1rJGD2+w2YYPlVEf5YMSNf4ukEvDuS4=; b=IfNXL6pexBYaknCOnHPs1KhHItLxHeJyfriqo280ZhoxHClJLeGFx76m3XEGmfxuNf 6IpmGZs4ENzzc3hQzQmeGmh1ugZ4SUDsz4wza14EWv190KCm2Vht9zrJA3TO6lbZsa+A l8f87TN62+1PdOB/pUpBU3+0xJrZFOIJbbx+HhVIEK1Q4BzPhp1WOq9R6zmsXBn9JYWJ SFwiMU6Jn6ehuaOc5oiLUaDFuU7v7WoqrTC0woFAk8ofprpmM4R2a1Ae4CC2zuqjYPtp vUWG0fvfD18J4S+b0G3Gam0QbsRX2YEqySr3XiID6n/KzuriTXcDYxYhwJQsMeFfVnRG hS/A== X-Gm-Message-State: APt69E3hRKykilrDtJCBg5Lzrg4EkJxOyPjDDmrZaikbgGQBKt7tTqJ+ OKy+LFJdNIydVFhNxoSuNv0n9g== X-Google-Smtp-Source: ADUXVKL+bwkP/HD8I1A9IEJBgdsCIhSmdSMG001CD1DSQcPIuNWzigfXB2dfIU3G8XLRYaNV6i74XQ== X-Received: by 2002:a17:902:59ce:: with SMTP id d14-v6mr15320379plj.253.1529347024352; Mon, 18 Jun 2018 11:37:04 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:0:1000:1501:38e4:86fe:ec0c:4007]) by smtp.gmail.com with ESMTPSA id a23-v6sm18568986pgd.85.2018.06.18.11.37.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 11:37:03 -0700 (PDT) From: Douglas Anderson To: andy.gross@linaro.org Cc: tdas@codeaurora.org, collinsd@codeaurora.org, sboyd@kernel.org, ilina@codeaurora.org, broonie@kernel.org, rplsssn@codeaurora.org, Douglas Anderson , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, David Brown , linux-kernel@vger.kernel.org Subject: [PATCH v2] drivers: qcom: rpmh-rsc: Check cmd_db_ready() to help children Date: Mon, 18 Jun 2018 11:36:52 -0700 Message-Id: <20180618183652.62249-1-dianders@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Children of RPMh will need access to cmd_db. Rather than having each child have code to check if cmd_db is ready let's add the check to RPMh. With this we'll be able to remove this boilerplate code from clk-rpmh.c and qcom-rpmh-regulator.c. Neither of these files has landed upstream yet but patches are pretty far along. === This code is based upon v11 of Lina and Raju's RPMh series. Suggested-by: Stephen Boyd Signed-off-by: Douglas Anderson Acked-by: Lina Iyer --- Changes in v2: - 1 space after a period as per Lina drivers/soc/qcom/rpmh-rsc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index 144a058407c0..c0f9cec92b13 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -621,6 +622,18 @@ static int rpmh_rsc_probe(struct platform_device *pdev) struct rsc_drv *drv; int ret, irq; + /* + * Even though RPMh doesn't directly use cmd-db, all of its children + * do. To avoid adding this check to our children we'll do it now. + */ + ret = cmd_db_ready(); + if (ret) { + if (ret != -EPROBE_DEFER) + dev_err(&pdev->dev, "Command DB not available (%d)\n", + ret); + return ret; + } + drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); if (!drv) return -ENOMEM;