From patchwork Thu Aug 19 22:19:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 499778 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp950091jab; Thu, 19 Aug 2021 15:19:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDgYFpEO22fueXrQMHLpBcJbWBP7p9gYLYdeHWgK/Uq/7OxhpMaMEfhrUTRqft+qA73hMT X-Received: by 2002:a50:fe07:: with SMTP id f7mr18894188edt.11.1629411578202; Thu, 19 Aug 2021 15:19:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629411578; cv=none; d=google.com; s=arc-20160816; b=tV67GUHoafQ/2gERVtEFp/L0iRDFHOQhppVqaX8YeSyeUt/vvO46v9IblpwpWDAcZ9 I2grAFwk+NTNRrJrayI08d0O8WhiwZ+bUFFIFCcHg8cDDv5/JspsRsAKWaMV53OfbINA bkfAOgFNuXO44868kNq8s4x4XfOyhIYMfnOl6g+jtaMaO6bTj+8nlxRtCxmmI/OIWliz psZkn59Wc3JcHwGfy5zLCLIEOV2JSOudoN71r8eil2pyEIjqTOJemRStYriEyLIy4pqr p1nYMBIGOY+K8MsY7pu4GAX46hWs31QaM8YmQCmiMf/eNXDyR7Li7uKiu6FBTwtCNV9P s3mQ== 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=V++C25JgTAQBV+qvjbbsx7LF9B3PcrPKDl21IMwbBpc=; b=vu5UMKKrC0aD0746JZtyvlIS5E6cBQrj1h0H1er9bGbUdWfmtig0EJb1WqqMoptzNy ObqxRBK6orhmLKc93YqM/yNZ/9o8wTPDYrBizbPb8lXGxmY9wLcmqf9Z0WFgK+vUNrsG Tgmxt75Ni04jm4vZhyGqgIkZAptkW3gk5/+Q1jUePXdG2dchscBm+YkCFIRHaL1aDaE5 psrW2BBKuI3EDH9LO5l5ZqArthYncZAaiWwGY/amMbm0Dj1izERn/1pIDNvqu6VoNd5M FCvqETnqxy9e0l/ZtdUXpILBTKggh2cNsiAK86QHBvwE6dYPyQFXFtWmiHweAqqZhvny 7EHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s5OT934A; 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 m15si4544867edq.280.2021.08.19.15.19.38; Thu, 19 Aug 2021 15:19:38 -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=s5OT934A; 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 S236844AbhHSWUN (ORCPT + 8 others); Thu, 19 Aug 2021 18:20:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236175AbhHSWUH (ORCPT ); Thu, 19 Aug 2021 18:20:07 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 411E6C061575 for ; Thu, 19 Aug 2021 15:19:31 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id z2so7560331iln.0 for ; Thu, 19 Aug 2021 15:19:31 -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=V++C25JgTAQBV+qvjbbsx7LF9B3PcrPKDl21IMwbBpc=; b=s5OT934ARZG2T706DJwUzoXYG1MuzAK8St19X9YAi8+KxO4XZcpoL+COEtj/GQs5Wb KyurwKfLS7m15lTEy9/Tfoqr55D6va0IN/nKjcbVAv203qb/Jj4ycBbxOlKfwxu6ShOq u67svKGCITaG0MaIUKIPteM5ietmI08WniGCCV9VDRkYilV+CU83bjQ9o/6Dqo1t48Kv V4qXN85gcOumEFvIWGPmqbq40XuWekGkTusVrcySWJ6M32/dsMHWfFn+0tWySGoM+3DY 8jj/iXM6/K/yDmNmt3sdZ1K9e/Y22dMqNoi11ItomFl0suhJp+NEadsGO/7y2v4+FA7D n2Vw== 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=V++C25JgTAQBV+qvjbbsx7LF9B3PcrPKDl21IMwbBpc=; b=OCNFzRhtcN20riva78Ss3t3sbGQk93VgA7d1o7ffP98BszVpiIyQAFVN9FEyNPg71U V5gkuiesxTOVcrGWJJg5K4ubK/RKMTwYl7o/8J12ZsZ5+L+lsh1KLlkxRnaZxx6RC3Vy nPhU9fVI8AIuGLephiIGNGWEBKibQVwmqKA9JZfa7FGentI2vmzRb/X/YdLUjcBERDHD X9+a/UacIt9gXUXMf4SnQjIswFagC8qkpImBJMeYysZiD862VE7bAIhHqHz1FXMQZEIE p4pe5UUwoTmAzW/2KTw1Za7NZc8wJB0isXOI0Tw1wnDZYXGqrRZgLGCCOiRfdxiQuNvY NAVQ== X-Gm-Message-State: AOAM531W4Opo3KwVX4bngxnT/Dsp67zr8NIkgx4QyldpbrzOEejS1sYA 48qA/RFDC2dukCncG7m9b+vOow== X-Received: by 2002:a92:cccf:: with SMTP id u15mr12046419ilq.144.1629411570672; Thu, 19 Aug 2021 15:19:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 15:19:30 -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 1/5] net: ipa: don't use ipa_clock_get() in "ipa_main.c" Date: Thu, 19 Aug 2021 17:19:23 -0500 Message-Id: <20210819221927.3286267-2-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 We need the hardware to be powered starting at the config stage of initialization when the IPA driver probes. And we need it powered when the driver is removed, at least until the deconfig stage has completed. Replace callers of ipa_clock_get() in ipa_probe() and ipa_exit(), calling pm_runtime_get_sync() instead. Replace the corresponding callers of ipa_clock_put(), calling pm_runtime_put() instead. The only error we expect when getting power would occur when the system is suspended. The ->probe and ->remove driver callbacks won't be called when suspended, so issue a WARN() call if an error is seen getting power. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 69fa4b3120fd3..3969aef6c4370 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -737,13 +738,13 @@ static int ipa_probe(struct platform_device *pdev) goto err_table_exit; /* The clock needs to be active for config and setup */ - ret = ipa_clock_get(ipa); + ret = pm_runtime_get_sync(dev); if (WARN_ON(ret < 0)) - goto err_clock_put; + goto err_power_put; ret = ipa_config(ipa, data); if (ret) - goto err_clock_put; + goto err_power_put; dev_info(dev, "IPA driver initialized"); @@ -765,14 +766,14 @@ static int ipa_probe(struct platform_device *pdev) if (ret) goto err_deconfig; done: - (void)ipa_clock_put(ipa); + (void)pm_runtime_put(dev); return 0; err_deconfig: ipa_deconfig(ipa); -err_clock_put: - (void)ipa_clock_put(ipa); +err_power_put: + (void)pm_runtime_put(dev); ipa_modem_exit(ipa); err_table_exit: ipa_table_exit(ipa); @@ -798,9 +799,9 @@ static int ipa_remove(struct platform_device *pdev) struct ipa_clock *clock = ipa->clock; int ret; - ret = ipa_clock_get(ipa); + ret = pm_runtime_get_sync(&pdev->dev); if (WARN_ON(ret < 0)) - goto out_clock_put; + goto out_power_put; if (ipa->setup_complete) { ret = ipa_modem_stop(ipa); @@ -816,8 +817,8 @@ static int ipa_remove(struct platform_device *pdev) } ipa_deconfig(ipa); -out_clock_put: - (void)ipa_clock_put(ipa); +out_power_put: + (void)pm_runtime_put(&pdev->dev); ipa_modem_exit(ipa); ipa_table_exit(ipa); From patchwork Thu Aug 19 22:19:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 499779 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp950120jab; Thu, 19 Aug 2021 15:19:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyz19FEgIDEOfAa0ZgxdYYo9kqWLFhDM8Rd1YNlJzZ52zTRNpTGK3fdt0hkGdwJ56wuCWgg X-Received: by 2002:a17:906:25db:: with SMTP id n27mr17654330ejb.108.1629411581806; Thu, 19 Aug 2021 15:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629411581; cv=none; d=google.com; s=arc-20160816; b=dc3KinlZ9Ng0GgIT8N7pdTEKZhJYH8qFzGYMDMtmx2qNiBIUjbD175I3mgqWtxRDvA ENSdPi2RUtBdpnJCGi/guWRHAeA2S+0MSxZWjinc1p6pMr+y2OVbfwJ2hOsm4cozZVYr Nit7CZFuOQ5ui4/C7F3Y5FjY0XKXAYPRz0cjwsBYQQ8xZXAyUqVHJFefb5+L0atZ33r+ v7Se575ieqSqQUhgT38AlNgGjQzI2D4shHw8ADgrdqaf61/3EimUxETThGy6BePqxBRD GVNEAL8IClHqFolnLsMw7qdyYbRzbGm3SARpB/GODQnT29XUSB0moq5aQZFdek29k7x6 Q0Ww== 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=RpntrM1ojw2u707sqzIhjLaMl82LdztxT4txCgjSHJ8=; b=BjrjmPwx6UjCXNvb+KEs/2qlsqC0XbzGweS51DuAeuEluRrIPtRyMP490EgPP1NEzq dPO8Hky58NQeFXWieU5iTeb9reT2ttlEVPW4r7MtKtnGrN//WwK8XBLOO/VP7LYprb9F hQRClIu5PWIBhoA+rzAbg1mMFbp1pl340nC8psgZmliyRMIo7mpsC9CowNKmKHbtkn0s WoAHbrfy8p6SHTwSASlcfrnVqK8Msvlqa1gX7pNpIivARd7dNpLZRZ0yTOkqmdNUu55u xWIQ9IO9ziyzaJeokImRKkWxRPAAzGZ7f6Z/YYWkKZmWG9HzjRumYiTdt09vezpqgzO2 ReRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vp+d2kr1; 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.41; Thu, 19 Aug 2021 15:19:41 -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=Vp+d2kr1; 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 S236920AbhHSWUQ (ORCPT + 8 others); Thu, 19 Aug 2021 18:20:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236765AbhHSWUI (ORCPT ); Thu, 19 Aug 2021 18:20:08 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2570BC061756 for ; Thu, 19 Aug 2021 15:19:32 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id b200so9675899iof.13 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=RpntrM1ojw2u707sqzIhjLaMl82LdztxT4txCgjSHJ8=; b=Vp+d2kr1vHaaDyRPGeK1E7OMCamEZUKB9u0jcPpuxm5zdjLvv/fo5Zfbsvj/6gq62X DpaY7O2p2NRx3MkC+WdgXUnnT5OqCmy/VHZVWCvnCwjsga5IIg3giZukBsX/kh0ySd/Q 6Y4heoDSiClADHXuAxJkp+vnBW4pVFC63VdS5ATO4NthNQ4eHsdMRYF79dN7C1lctE+n P5enikwYkgifcuPU23VogD9nTWb155j6kjbrQiWEZOAYc0dmHWhZbWu4d7oTj7THNn0y fqMr5BIjsHux2Iz0cw4zDGle3rF7V3I383BjDBZw2YCA4nsWlSlCLA/sDKqcCqdNwJoL raEg== 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=RpntrM1ojw2u707sqzIhjLaMl82LdztxT4txCgjSHJ8=; b=q170TtYlgs1GXTuLXy6AdUE9MzpKbUua7npJhC+GQA5ofr8eYp3bAOj7Kwc4zh0J07 8sp3rJokyncxLkOMJYhJBWAsGO8AUav6CCpWrlfBVWbWfCOm/UMjYylt/XfpICAnTi3F pdCKvBO8/dPBkFPX/wnEhbNNweEdZTEkSof7kNu8dg5KG2RRGTdxo4BPBl8xYs4Nh33w pQWA28090w7FAMhliqSoRLHrWcKoXxeBUNVevT3e65Ods4hy+wNTC4zbjID8rIJbFXqV wHE+B3KGAEOyvQa/9H0PtRrf9gpBmlcPTiWASKBMzRAQoRPz3B4FjG4k3DPG2AdHlZen dCWQ== X-Gm-Message-State: AOAM5337lm6r5AfAxnVnqu/KyBL/nFMwMoMIgzb2FCAus7nxf5tYkNoz YQDwQI5/o+q4Wi4vcs7i/QyR4Q== X-Received: by 2002:a5d:85cf:: with SMTP id e15mr13333195ios.208.1629411571614; Thu, 19 Aug 2021 15:19:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 15:19:31 -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 2/5] net: ipa: don't use ipa_clock_get() in "ipa_smp2p.c" Date: Thu, 19 Aug 2021 17:19:24 -0500 Message-Id: <20210819221927.3286267-3-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 If the "modem-init" Device Tree property is present for a platform, the modem performs early IPA hardware initialization, and signals this is complete with an "ipa-setup-ready" SMP2P interrupt. This triggers a call to ipa_setup(), which requires the hardware to be powered. Replace the call to ipa_clock_get() in this case with a call to pm_runtime_get_sync(). And replace the corresponding calls to ipa_clock_put() with calls to pm_runtime_put() instead. There is a chance we get an error when taking this power reference. This is an unlikely scenario, where system suspend is initiated just before the modem signals it has finished initializing the IPA hardware. 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_smp2p.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_smp2p.c b/drivers/net/ipa/ipa_smp2p.c index 04b977cf91593..f6e2061cd391c 100644 --- a/drivers/net/ipa/ipa_smp2p.c +++ b/drivers/net/ipa/ipa_smp2p.c @@ -16,7 +16,6 @@ #include "ipa_smp2p.h" #include "ipa.h" #include "ipa_uc.h" -#include "ipa_clock.h" /** * DOC: IPA SMP2P communication with the modem @@ -153,6 +152,7 @@ static void ipa_smp2p_panic_notifier_unregister(struct ipa_smp2p *smp2p) static irqreturn_t ipa_smp2p_modem_setup_ready_isr(int irq, void *dev_id) { struct ipa_smp2p *smp2p = dev_id; + struct device *dev; int ret; mutex_lock(&smp2p->mutex); @@ -161,17 +161,20 @@ static irqreturn_t ipa_smp2p_modem_setup_ready_isr(int irq, void *dev_id) goto out_mutex_unlock; smp2p->disabled = true; /* If any others arrive, ignore them */ - /* The clock needs to be active for setup */ - ret = ipa_clock_get(smp2p->ipa); - if (WARN_ON(ret < 0)) - goto out_clock_put; + /* Power needs to be active for setup */ + dev = &smp2p->ipa->pdev->dev; + ret = pm_runtime_get_sync(dev); + if (ret < 0) { + dev_err(dev, "error %d getting power for setup\n", ret); + goto out_power_put; + } /* An error here won't cause driver shutdown, so warn if one occurs */ ret = ipa_setup(smp2p->ipa); WARN(ret != 0, "error %d from ipa_setup()\n", ret); -out_clock_put: - (void)ipa_clock_put(smp2p->ipa); +out_power_put: + (void)pm_runtime_put(dev); out_mutex_unlock: mutex_unlock(&smp2p->mutex); @@ -211,7 +214,7 @@ static void ipa_smp2p_clock_release(struct ipa *ipa) if (!ipa->smp2p->clock_on) return; - (void)ipa_clock_put(ipa); + (void)pm_runtime_put(&ipa->pdev->dev); ipa->smp2p->clock_on = false; } 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 */ From patchwork Thu Aug 19 22:19:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 499781 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp950176jab; Thu, 19 Aug 2021 15:19:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxl/R5l2bcORRjC+gpyaIjPr1voAEOSVRQtqTGZ5GvZxpi6hGall10u4thuqftnLpaS7Hq2 X-Received: by 2002:a05:6402:3193:: with SMTP id di19mr18893697edb.183.1629411586348; Thu, 19 Aug 2021 15:19:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629411586; cv=none; d=google.com; s=arc-20160816; b=uvixSEfCQP8ei3d5/QW7Kk0UuNau/LbQRNIxLhSfUj93Y7b7ZqqVFWZbOM54L02ALi G33JOyi1qJ9ZWKrfWXxBhlXSwCXUv50RuMxCw3v7aOqglHrxPXijCGDY9nNmhUhCvgmy vJrptrsrJp2kVbZBbjPLxTMwaabrFbWICcF05MjqU2SbrPxdelTx5erXk9OhTzrNkxfo uubY4iwbi0zHBQSRDXw5x1ejkNf1PCiLuCrwdkc++3lcMk8Snx9SAvqSC6JL1xErzqYG Hzna8YJd+wvKTjXs19Otq1uwCxFcvDCu8nfHF6JZzc1xnBWwW3s506hd7UKi/tocf0xF EFPA== 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=bnBaACXlOYhgGho8VFfK4AyQp6ASY7kxEYVRMApr6Zk=; b=rzvoEtf/InkIT0nMIhQA4/5Bu9HArY39x6/cwlpt6CcDk7kanNDSYlPdaRARsYv+HU 1Uh1kf2nrHtqR04e2SkPRlqx0oFwdO5QqnmIR2mM8d1CNRVIUX2dAHGz+ssDVgtOAFsK AUBEwXrZz4YC07PE8mLjjSwIRmjw3PFdzOjQngNYuHquxaChHTJtIhmLizmh/fffrMtm I+I6iEXsWCe3isHf1YS+iXMDvq0TlodJMR4FTzbXZlkZtpKFZMsiLonp7xHaookfKQiJ OxaIdBBRxbUeExAmf6UDZ2V1rr/9jhxtD793srGeci5PeIyAtjKSaUbSVrBqcv1mrRrm 99HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xOhBKq3u; 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.46; Thu, 19 Aug 2021 15:19:46 -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=xOhBKq3u; 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 S237049AbhHSWUU (ORCPT + 8 others); Thu, 19 Aug 2021 18:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236732AbhHSWUK (ORCPT ); Thu, 19 Aug 2021 18:20:10 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0739C061575 for ; Thu, 19 Aug 2021 15:19:33 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id j18so9661026ioj.8 for ; Thu, 19 Aug 2021 15:19:33 -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=bnBaACXlOYhgGho8VFfK4AyQp6ASY7kxEYVRMApr6Zk=; b=xOhBKq3uSJcSZsnys7NGlYXqOHoFDCFIStrVP/IqwhQ9jglVkwgpJkjqGbRmw/f+2O F1GS4WK3MNX4rL/l0uC+4TuErZvxX1/0EuMSZ23d8NBCbAPssVDcxTmHpHu7lEHLTnCQ 7sBWH5EMsTeKcx5YntxoEYWsxH3GpWDUJ7dsZZAkpCKYCLgl3ic2rUKDJNib70EnUFBi uFOb8ynOHM+QBuP3W4JHvnpvKzQRpdW1w+fIG0aPcHXcEvF04S/Wk3mrMDZZ3AFFzXJA B2fYWejBSAb9chxTxJAcasjim75llVDIKK5JV3iiM9NW+BCFOEjSCqlg73YRrfZbuI8U zseA== 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=bnBaACXlOYhgGho8VFfK4AyQp6ASY7kxEYVRMApr6Zk=; b=o7g9czuxBPga08nQdOsa6ot6DyevasL7V7nyaDxCbmwvjqWYbUnZx7NzC3z+vI4+oI gLq/9FzqtfBwl05XVsaTonEGbcUUQQzIZiYitV/OnhVBe3iikCCXbsMToJnXaThcgCFE OrPPsYqxeOfcWhSdn8zWKsOmVJPmf68XNUYoWREQzAMXpqFkjMr+/4guQheavhV5q9hp isAIRdvKWkSBW7Ja5mo7NiMgwA/yFMl53lIv8gFLgti9Dye3Oy7Q/qqaHsiCBotQR+ep rPUznxo6QggFflWa4WO3vG67IE9he9amqf5PozkVNYmkaOZTV5L/DAUm/5iYVGFb1mwM ZWtA== X-Gm-Message-State: AOAM5305y/3YSgcf9AqYsDFuUBwee6SaEb3MDGwHny6TETUyzONoPWvV AESmVhsX97/L/L9NtTf++lzUqQpIoTU4TLCq X-Received: by 2002:a02:c507:: with SMTP id s7mr14887069jam.36.1629411573208; Thu, 19 Aug 2021 15:19:33 -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.32 (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 4/5] net: ipa: don't use ipa_clock_get() in "ipa_modem.c" Date: Thu, 19 Aug 2021 17:19:26 -0500 Message-Id: <20210819221927.3286267-5-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 When we open or close the modem network device we need to ensure the hardware is powered. Replace the callers of ipa_clock_get() found in ipa_open() and ipa_stop() with calls to pm_runtime_get_sync(). If an error is returned, simply return that error to the caller (without any error or warning message). This could conceivably occur if the function was called while the system was suspended, but that really shouldn't happen. Replace corresponding calls to ipa_clock_put() with pm_runtime_put() also. If the modem crashes we also need to ensure the hardware is powered to recover. If getting power returns an error there's not much we can do, but at least report the error. (Ideally the remoteproc SSR code would ensure the AP was not suspended when it sends the notification, but that is not (yet) the case.) Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_modem.c | 40 +++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 17 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index c8724af935b85..7e05b22d6e18b 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -49,15 +49,17 @@ static int ipa_open(struct net_device *netdev) { struct ipa_priv *priv = netdev_priv(netdev); struct ipa *ipa = priv->ipa; + struct device *dev; int ret; - ret = ipa_clock_get(ipa); - if (WARN_ON(ret < 0)) - goto err_clock_put; + dev = &ipa->pdev->dev; + ret = pm_runtime_get_sync(dev); + if (ret < 0) + goto err_power_put; ret = ipa_endpoint_enable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); if (ret) - goto err_clock_put; + goto err_power_put; ret = ipa_endpoint_enable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]); if (ret) @@ -65,14 +67,14 @@ static int ipa_open(struct net_device *netdev) netif_start_queue(netdev); - (void)ipa_clock_put(ipa); + (void)pm_runtime_put(dev); return 0; err_disable_tx: ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); -err_clock_put: - (void)ipa_clock_put(ipa); +err_power_put: + (void)pm_runtime_put(dev); return ret; } @@ -82,18 +84,20 @@ static int ipa_stop(struct net_device *netdev) { struct ipa_priv *priv = netdev_priv(netdev); struct ipa *ipa = priv->ipa; + struct device *dev; int ret; - ret = ipa_clock_get(ipa); - if (WARN_ON(ret < 0)) - goto out_clock_put; + dev = &ipa->pdev->dev; + ret = pm_runtime_get_sync(dev); + if (ret < 0) + goto out_power_put; netif_stop_queue(netdev); ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]); ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); -out_clock_put: - (void)ipa_clock_put(ipa); +out_power_put: + (void)pm_runtime_put(dev); return 0; } @@ -359,9 +363,11 @@ static void ipa_modem_crashed(struct ipa *ipa) struct device *dev = &ipa->pdev->dev; int ret; - ret = ipa_clock_get(ipa); - if (WARN_ON(ret < 0)) - goto out_clock_put; + ret = pm_runtime_get_sync(dev); + if (ret < 0) { + dev_err(dev, "error %d getting power to handle crash\n", ret); + goto out_power_put; + } ipa_endpoint_modem_pause_all(ipa, true); @@ -388,8 +394,8 @@ static void ipa_modem_crashed(struct ipa *ipa) if (ret) dev_err(dev, "error %d zeroing modem memory regions\n", ret); -out_clock_put: - (void)ipa_clock_put(ipa); +out_power_put: + (void)pm_runtime_put(dev); } static int ipa_modem_notify(struct notifier_block *nb, unsigned long action, From patchwork Thu Aug 19 22:19:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 499782 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp950199jab; Thu, 19 Aug 2021 15:19:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpWb/3nqSc/+gRIjox+j+lSSVxWqBZ7lO5bpL9Wq3BiQPd3xSJcdUreIrqlNZ0hoHV8ceJ X-Received: by 2002:a17:906:3fd7:: with SMTP id k23mr17984949ejj.176.1629411588928; Thu, 19 Aug 2021 15:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629411588; cv=none; d=google.com; s=arc-20160816; b=zTJ1iJR7Ax4zKHeznOSmiY+cPNJO/G4ySJLn6+z4jETIafId20+bFZifz2z4Lpb5KJ Qbpm9xZBqwZGMjkKbnZmtZvAQTLrCB1h3Cvt1sstTc5ibCKNWAxsUhTPjTv83/4U07UV UIiqFM6XldVJrzj0AGsYuxrgbEntWRGrAZP4VJ7n7QJE/d2LD6yuhktDenOPf/looh5n dNOt3ZYFPGgvWyJ0wydAK/Ch6CZKdzR+HUrw8bb8O3c3X8yPbjm/6qfOuX2V0XGvKjFG dbV5rUhLAV2Q6uRQTiaT4yWJ2cW3Cw0KhrwxgkRIFEec4IV5TOIi6Y8Q7v8LmhVqgalC cyUQ== 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=bOryrdzD3qCC5WFsDKYio83PoI6w7fQiXhMMT5rIdTM=; b=qU6lPsy5W7dBLm9liNQGu35Op8QDmPf4niY8glgtd4y62Q+HalE6ZrxDFmYCJevXKk MUEfGBMOQIfzyZWDkIAeyTmZVrVRDukWi6weyzWv15t3znFHDahyxkNyCESsuC0Is5vN yO/yrxCH4I6b7Ouf2Ay8loeDaZ78SJwF2f/qY7yx1CgevEhAXELV4DFFNH+zrM34dU9d g631LTgYcApo2arTTvx/gqTGKz/7o42P78OloLNW/Ja6hxrPaN7PPYb9ttrn9YV5q61E SpY0/mZPu21z37p5VCj35lGNkCHnxHmUUsDOA1msL4kr5l4tg5mcZaAMZbHpT9ugxVaH svNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O0YMdz8y; 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.48; Thu, 19 Aug 2021 15:19:48 -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=O0YMdz8y; 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 S237174AbhHSWUX (ORCPT + 8 others); Thu, 19 Aug 2021 18:20:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236904AbhHSWUL (ORCPT ); Thu, 19 Aug 2021 18:20:11 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 964EFC061757 for ; Thu, 19 Aug 2021 15:19:34 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id x5so7535043ill.3 for ; Thu, 19 Aug 2021 15:19:34 -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=bOryrdzD3qCC5WFsDKYio83PoI6w7fQiXhMMT5rIdTM=; b=O0YMdz8y55fYcCHLECiTAc5PuhOOg1smSjJ4C/IMgLibk8+DTlgv/qnjwqIMJwEt2U tqk6W5GEigGoJT4CkFhkT5LYSJ+BVf1Tr0BL4rrgm5ifITnVN3fCsBjaFB9sKrC5AoHt q8diyS/jL4RvOUkB8n+UbRQhdOMpkBSqlOCXv1q90S3ZTpNlzuKvJnfDcCT5wpRGi+Kb bvVqXzMiXh3kkrwoNWxRGLhYgt0jWaxJURQrGJcDeoF2teljuElbjRdEdNZ5iq/PL3py FoicmVQMKyepjbg9qcSETcPgUnozLIkayQz9oLNo8Oq74ZjI3DLjFd9E3syL40hgKph4 BY0Q== 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=bOryrdzD3qCC5WFsDKYio83PoI6w7fQiXhMMT5rIdTM=; b=XVqSqI2W0uDdjLPr/qDUmxhW3EbWJ1BGTW85etxeORB1GaszOBobGmOyl6+BN9Js8c aY4nFIqBQ51fpMcPZpmjBa0fZo06jX5qg61yyC9hnooK4WWTKRw+1ikydLvbYEmzGFmG qr2Mu4SvCWJYiNqF8gPTWLdhMi/WrJArMJ8aJlTB/CBrk02F2f2olowuMhRmmLOrFAl5 wDFCbAcb9haA4bbzMXLmFJ04E1xt10Q09YJkn3hXNR2OBj/D8M0MPSOx1mZADNsCAOVd Paf/e5g31YWycFVGwc4B4BLejZAPU3wOIeCpMTf4mx4EuTK0dO/IKKUPaMFKP+ie6GAu QeXA== X-Gm-Message-State: AOAM531DRuiY3j1G0kdOlSEKZSRgnlXQbKWc836YKoaZTuMmWkS+PzkV PZQI/Et31Riw21ZvA+4sqfO47A== X-Received: by 2002:a92:b112:: with SMTP id t18mr11377156ilh.36.1629411573983; Thu, 19 Aug 2021 15:19:33 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 15:19:33 -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 5/5] net: ipa: kill ipa_clock_get() Date: Thu, 19 Aug 2021 17:19:27 -0500 Message-Id: <20210819221927.3286267-6-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 The only remaining user of the ipa_clock_{get,put}() interface is ipa_isr_thread(). Replace calls to ipa_clock_get() there calling pm_runtime_get_sync() instead. And call pm_runtime_put() there rather than ipa_clock_put(). Warn if we ever get an error. With that, we can get rid of ipa_clock_get() and ipa_clock_put(). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 17 ----------------- drivers/net/ipa/ipa_clock.h | 24 ------------------------ drivers/net/ipa/ipa_interrupt.c | 14 +++++++------- 3 files changed, 7 insertions(+), 48 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index 8f25107c1f1e7..357be73a45834 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -266,23 +266,6 @@ static int ipa_runtime_idle(struct device *dev) return -EAGAIN; } -/* Get an IPA clock reference. If the reference count is non-zero, it is - * incremented and return is immediate. Otherwise the IPA clock is - * enabled. - */ -int ipa_clock_get(struct ipa *ipa) -{ - return pm_runtime_get_sync(&ipa->pdev->dev); -} - -/* Attempt to remove an IPA clock reference. If this represents the - * last reference, disable the IPA clock. - */ -int ipa_clock_put(struct ipa *ipa) -{ - return pm_runtime_put(&ipa->pdev->dev); -} - static int ipa_suspend(struct device *dev) { struct ipa *ipa = dev_get_drvdata(dev); diff --git a/drivers/net/ipa/ipa_clock.h b/drivers/net/ipa/ipa_clock.h index 5c53241336a1a..8c21a007c4375 100644 --- a/drivers/net/ipa/ipa_clock.h +++ b/drivers/net/ipa/ipa_clock.h @@ -52,28 +52,4 @@ struct ipa_clock *ipa_clock_init(struct device *dev, */ void ipa_clock_exit(struct ipa_clock *clock); -/** - * ipa_clock_get() - Get an IPA clock reference - * @ipa: IPA pointer - * - * Return: 0 if clock started, 1 if clock already running, or a negative - * error code - * - * This call blocks if this is the first reference. A reference is - * taken even if an error occurs starting the IPA clock. - */ -int ipa_clock_get(struct ipa *ipa); - -/** - * ipa_clock_put() - Drop an IPA clock reference - * @ipa: IPA pointer - * - * Return: 0 if successful, or a negative error code - * - * This drops a clock reference. If the last reference is being dropped, - * the clock is stopped and RX endpoints are suspended. This call will - * not block unless the last reference is dropped. - */ -int ipa_clock_put(struct ipa *ipa); - #endif /* _IPA_CLOCK_H_ */ diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index 934c14e066a0a..3fecaadb4a37e 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -21,9 +21,9 @@ #include #include +#include #include "ipa.h" -#include "ipa_clock.h" #include "ipa_reg.h" #include "ipa_endpoint.h" #include "ipa_interrupt.h" @@ -80,14 +80,16 @@ static irqreturn_t ipa_isr_thread(int irq, void *dev_id) struct ipa_interrupt *interrupt = dev_id; struct ipa *ipa = interrupt->ipa; u32 enabled = interrupt->enabled; + struct device *dev; u32 pending; u32 offset; u32 mask; int ret; - ret = ipa_clock_get(ipa); + dev = &ipa->pdev->dev; + ret = pm_runtime_get_sync(dev); if (WARN_ON(ret < 0)) - goto out_clock_put; + goto out_power_put; /* The status register indicates which conditions are present, * including conditions whose interrupt is not enabled. Handle @@ -108,15 +110,13 @@ static irqreturn_t ipa_isr_thread(int irq, void *dev_id) /* If any disabled interrupts are pending, clear them */ if (pending) { - struct device *dev = &ipa->pdev->dev; - dev_dbg(dev, "clearing disabled IPA interrupts 0x%08x\n", pending); offset = ipa_reg_irq_clr_offset(ipa->version); iowrite32(pending, ipa->reg_virt + offset); } -out_clock_put: - (void)ipa_clock_put(ipa); +out_power_put: + (void)pm_runtime_put(dev); return IRQ_HANDLED; }