From patchwork Thu Aug 19 22:19:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 499780 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp950140jab; Thu, 19 Aug 2021 15:19:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5OtbZawelHZ5q9rdDjYOpt+fxGE4mBTNCZeGAWcnh/kvBpwjR4X7sA6XotJ+5S/YtRkFU X-Received: by 2002:a17:907:f93:: with SMTP id kb19mr13423576ejc.43.1629411583091; Thu, 19 Aug 2021 15:19:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629411583; cv=none; d=google.com; s=arc-20160816; b=PVI7Db0z4liSF6jctBq6rALXkJTpyRI8QcDP1z027IOBSATpY7zarcDT+0AAGAWPq/ U9txuKIpt/fK5Xw+SP8X3n7NXpbaZzMw8XAYCB8nB/8SdSkgStCtxOJbvYYiz/jGUcdq /ZH3Lvoyz5akJORbQloW9kmUHq/PohvXAycL0AeaN7XYuYN7o4vfFCMZsy+cu1ouDpsK UnNKbwAkRH6DxYZNP+O2QZXs7E5juCATrtQIfCH0kK3Ey9lqEZ7hp4zVKwh3pBXooKvf QiqlVkZki7p+nFmQu8pekWbezULhUOEHs8UF4G2bgfzFdKO5FHk7As282OWsPMaodObB e9/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ea8eXEbDTB/SYuwLfJzfxPyqpl/zzxI98JJtyMRIl0g=; b=tWUjS/cwBXzmLDG5zgmqlnzvzA+L9DMZc2BWoZe32bUmVpZFFv1iANYhAb+pI0JbB9 EP5rBLM/qwE0peEDKrsWRKIJCDXhgWOrRCMkuzaHhsOcTfpGeVq7jyM8L0zevZRpfh/W udLBDVAOi8DASP1hP5KUwSp+/bzUeHZViMLVW7auyN/CMN3/0Dm6PQvwnrJb7SLoC1G3 6GKRcYV5DPM8kaIN9sajPweJLzFK6OXw9FcfhwwsMzgNDPQgKy/SlqmcMAJgSNwJS23F biPfUyyM+9nAEKMlaAG9UXDpbw2MHDtP/eML3JtA2h6uIRXOetAmIyJ+evBPOlPn8p72 9pKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NX0uCRmE; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 l14si4567062eds.2.2021.08.19.15.19.42; Thu, 19 Aug 2021 15:19:43 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=NX0uCRmE; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S237058AbhHSWUS (ORCPT + 8 others); Thu, 19 Aug 2021 18:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236809AbhHSWUJ (ORCPT ); Thu, 19 Aug 2021 18:20:09 -0400 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1571C06175F for ; Thu, 19 Aug 2021 15:19:32 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id j15so7525914ila.1 for ; Thu, 19 Aug 2021 15:19:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ea8eXEbDTB/SYuwLfJzfxPyqpl/zzxI98JJtyMRIl0g=; b=NX0uCRmEc5Mf/VMVLJ+z+Yi0o1okcxJUsxP2tdna0aw8TEipSFiRlPYHDDxKAFCf5b fky+zSOwG4xyWSs2eGqhpED7JwoyagSETLHc0jAu+hrh6cNZmhKmqzAQqJIr+d78D6Km KnQKA4ENrY/EwsLdkag3hSKUxObD/kVYcnjPN0DmL1LUQgDc5Waj/ab+y7ti4u35g3ET wPPgtUJ0uCQXPLNmrarV6cre91JbWsKOyD7Fix3Qr13MfHO4vsFTytrBNvH+sAY1+pGs 2AZCxxqQqL7TAtBq5WJg1iZ0zNfv2nS7ZytodKZIw4C4C7bFsKRbiPCn7tIgcFPhMcZ6 JSXQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ea8eXEbDTB/SYuwLfJzfxPyqpl/zzxI98JJtyMRIl0g=; b=cJVAzwjwvAC6Hr9Ww9lsHD8JqTSSzT9SHGa5/LVahUx1c87p8SAEmZRAPx1YsWZieo YNU4cB+Cm/37sVupk6prz+hl70sh+eIc6lIVkm47moPRq1cYNACrCTADRIDT60C0A8c2 +EvZzRigS01iscJYR76iE77oA7K1Vkh9x4VjpYqeKUnmHFob6xstgFM8gU/aCL8GsFsb pfALbaYXQKvvn80SL4pR/RdgUzMnNKcrVQONYc8qNJgE/RhEuS+28/+tUmd33y3qSXop Z/c3yKusLV0dTzw0jbIlmQ5HXd9uDF2DeavDLa0Wt52hYEwKmJclzHwUBjmeDAkeIzK/ sa3w== X-Gm-Message-State: AOAM5322XDrc58KDuxtzTca7nuOEa8HdQVCJ8QrIjlN1bx9eo3LIrSZV olEfjOTceKJPU9G0PZ98kV8BvQ== X-Received: by 2002:a92:5407:: with SMTP id i7mr11931509ilb.264.1629411572397; Thu, 19 Aug 2021 15:19:32 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id o15sm2245188ilo.73.2021.08.19.15.19.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 15:19:32 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/5] net: ipa: don't use ipa_clock_get() in "ipa_uc.c" Date: Thu, 19 Aug 2021 17:19:25 -0500 Message-Id: <20210819221927.3286267-4-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210819221927.3286267-1-elder@linaro.org> References: <20210819221927.3286267-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Replace the ipa_clock_get() call in ipa_uc_clock() when taking the "proxy" clock reference for the microcontroller with a call to pm_runtime_get_sync(). Replace calls of ipa_clock_put() for the microcontroller with pm_runtime_put() calls instead. There is a chance we get an error when taking the microcontroller power reference. This is an unlikely scenario, where system suspend is initiated just before we learn the modem is booting. For now we'll just accept that this could occur, and report it if it does. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_uc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index 9c8818c390731..a0bdd25b65b4f 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -7,9 +7,9 @@ #include #include #include +#include #include "ipa.h" -#include "ipa_clock.h" #include "ipa_uc.h" /** @@ -154,7 +154,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) case IPA_UC_RESPONSE_INIT_COMPLETED: if (ipa->uc_clocked) { ipa->uc_loaded = true; - (void)ipa_clock_put(ipa); + (void)pm_runtime_put(dev); ipa->uc_clocked = false; } else { dev_warn(dev, "unexpected init_completed response\n"); @@ -182,25 +182,29 @@ void ipa_uc_deconfig(struct ipa *ipa) ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0); if (ipa->uc_clocked) - (void)ipa_clock_put(ipa); + (void)pm_runtime_put(&ipa->pdev->dev); } /* Take a proxy clock reference for the microcontroller */ void ipa_uc_clock(struct ipa *ipa) { static bool already; + struct device *dev; int ret; if (already) return; already = true; /* Only do this on first boot */ - /* This clock reference dropped in ipa_uc_response_hdlr() above */ - ret = ipa_clock_get(ipa); - if (WARN(ret < 0, "error %d getting proxy clock\n", ret)) - (void)ipa_clock_put(ipa); - - ipa->uc_clocked = ret >= 0; + /* This power reference dropped in ipa_uc_response_hdlr() above */ + dev = &ipa->pdev->dev; + ret = pm_runtime_get_sync(dev); + if (ret < 0) { + pm_runtime_put_noidle(dev); + dev_err(dev, "error %d getting proxy power\n", ret); + } else { + ipa->uc_clocked = true; + } } /* Send a command to the microcontroller */