Any entry point that leads to IPA hardware access must ensure the
hardware is operational (clocked). Currently we ensure this by
taking an extra clock reference during setup that is not released
until we receive a system suspend request. But this extra reference
will soon go away.
When the platform driver ->probe function is called, we first need
hardware access in ipa_config(). Although ipa_config() takes an IPA
clock reference, it the special reference taken to prevent suspending
the hardware.
Have ipa_probe() take a reference before calling ipa_config(), so
that the "no-suspend" reference can eventually go away. Drop this
reference before ipa_probe() returns.
Similarly, the driver ->remove function can be called at any time.
Take an IPA clock reference at the beginning of that function, and
drop it again after the deconfig stage has completed (at which point
hardware access is no longer needed).
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
if (ret)
goto err_table_exit;
+ /* The clock needs to be active for config and setup */
+ ipa_clock_get(ipa);
+
ret = ipa_config(ipa, data);
if (ret)
- goto err_modem_exit;
+ goto err_clock_put; /* Error */
dev_info(dev, "IPA driver initialized");
* we're done here.
*/
if (modem_init)
- return 0;
+ goto out_clock_put; /* Done; no error */
/* Otherwise we need to load the firmware and have Trust Zone validate
* and install it. If that succeeds we can proceed with setup.
if (ret)
goto err_deconfig;
+out_clock_put:
+ ipa_clock_put(ipa);
+
return 0;
err_deconfig:
ipa_deconfig(ipa);
-err_modem_exit:
+err_clock_put:
+ ipa_clock_put(ipa);
ipa_modem_exit(ipa);
err_table_exit:
ipa_table_exit(ipa);
struct ipa_clock *clock = ipa->clock;
int ret;
+ ipa_clock_get(ipa);
+
if (ipa->setup_complete) {
ret = ipa_modem_stop(ipa);
/* If starting or stopping is in progress, try once more */
}
ipa_deconfig(ipa);
+
+ ipa_clock_put(ipa);
+
ipa_modem_exit(ipa);
ipa_table_exit(ipa);
ipa_endpoint_exit(ipa);