From 4c6a4da84431415b1f451e2715a17487f9b3474e Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Thu, 19 Aug 2021 17:19:23 -0500 Subject: [PATCH] net: ipa: don't use ipa_clock_get() in "ipa_main.c" 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 Signed-off-by: David S. Miller --- 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 69fa4b3..3969aef 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.7.4