Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp940025pxb; Thu, 19 Aug 2021 15:21:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSgDUEBalHfv2KLFTAAXDnOd6LQdOcZmyt4khOrqMsf9JZDd2qefmidd7UzygHIfx3BWcb X-Received: by 2002:a17:907:1744:: with SMTP id lf4mr17862786ejc.52.1629411686323; Thu, 19 Aug 2021 15:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629411686; cv=none; d=google.com; s=arc-20160816; b=keEGmaV/hZY22b+vhDSkoif6AWk1yfMlFPtM9u8C7OG4Lsg7344lsnB7o6K8hZH1m6 myAABiF1hQBVz9EfscVgKoK1i4DP3x3Sz6vKv96Gyx0DL/kaLKjCdoyrNgzCv8+8oycb rd1S6JNuLvToRvVa0gg/ikGm1n2kyKxw6Rr8navMtJWCkZYT9LnSzkbpOFHchxKFZ/HM bd7YqUlU2tonEYaOGLnWrrgy1hkcpBE2UjEo6E3zE6KYvr89e0RfpR8OL2m6KLuD6Qic i0PV2zM4AUdf5YkriNlQs4gB7iOcnwfD9J3cr0ieXqzYF4YkIEGT4nGYsUMHvJonkmDz 91sQ== 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=aGQZ6lR+GAObkzOARAUuYluYPiiRpYtS/mlwHfR2eq9Jy906n2O7bKo4WeHR3HsxFJ NbYMPxrkO0c8Npva1gaBlEr0upVSEyfDFbd3TbXa986hDD1UfeYZS8yhZkv/qdqUWi3r 8C+Wdg/WjLx1fWp+/E1ewf3Sr5TaeKeFziF3g2po20tBiyskFWCch40V5x+DaTALooM6 xCRXqJd6P1QRktpknETw0wuQVsFJEJo8Bg9CFbkE8CCdAX3mB/ad9ZtbGpY2hnkBLJao hAKyUvzOuFn8Dhvpx+n7u/gacmRQ5PagAx/VfZ9r1ByzkG9Rqlxx2Ya7pZTThzfpOJnu RQFQ== 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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 f13si4718866edq.202.2021.08.19.15.21.00; Thu, 19 Aug 2021 15:21:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S236865AbhHSWUN (ORCPT + 99 others); Thu, 19 Aug 2021 18:20:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235945AbhHSWUH (ORCPT ); Thu, 19 Aug 2021 18:20:07 -0400 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46151C061756 for ; Thu, 19 Aug 2021 15:19:31 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id f15so7508217ilk.4 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=HETlK2Ye7tuENDkDwaqsNpusHPV+3I0KoE7XyQPRUmK47phGAmQNwgRxvWUkrD6e9H 372p58PEv5QwP/O7Sdqzqxzh5YORfpODUQU90/c/r/wuCp7OIwILJT1bYNie6T0o+hr1 YKJ7dJ4hISv60t09KGZSHvraRC13RXY5FkdUmSpV5MB93lyeVf7zEgmBd9xECvGwJMLd iAxlE0o8/miwznKNbL9iIVMWcf8SepbvQpyuz9moJE1MI/erN+KJvx94JLesDL3JbVM6 2JgaEt3iav39HQL5qMVTnLnv1tvt2hnjC2cmgFPZrs7lQ8iSFgYTDdoXyrqasxqHjTBD xzMw== X-Gm-Message-State: AOAM5329ZzMkyYCfxr+z/jel5SGGM0/PE3PwxFDhUrBLTjbNvR0pzBDI cIIcMrVfzvA7qNSQdXrA2FlY0g== 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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); -- 2.27.0