Skip to content

Commit 799c5c2

Browse files
Alex Elderdavem330
authored andcommitted
net: ipa: don't use ipa_clock_get() in "ipa_uc.c"
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c43adc7 commit 799c5c2

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

drivers/net/ipa/ipa_uc.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#include <linux/types.h>
88
#include <linux/io.h>
99
#include <linux/delay.h>
10+
#include <linux/pm_runtime.h>
1011

1112
#include "ipa.h"
12-
#include "ipa_clock.h"
1313
#include "ipa_uc.h"
1414

1515
/**
@@ -154,7 +154,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id)
154154
case IPA_UC_RESPONSE_INIT_COMPLETED:
155155
if (ipa->uc_clocked) {
156156
ipa->uc_loaded = true;
157-
(void)ipa_clock_put(ipa);
157+
(void)pm_runtime_put(dev);
158158
ipa->uc_clocked = false;
159159
} else {
160160
dev_warn(dev, "unexpected init_completed response\n");
@@ -182,25 +182,29 @@ void ipa_uc_deconfig(struct ipa *ipa)
182182
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1);
183183
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0);
184184
if (ipa->uc_clocked)
185-
(void)ipa_clock_put(ipa);
185+
(void)pm_runtime_put(&ipa->pdev->dev);
186186
}
187187

188188
/* Take a proxy clock reference for the microcontroller */
189189
void ipa_uc_clock(struct ipa *ipa)
190190
{
191191
static bool already;
192+
struct device *dev;
192193
int ret;
193194

194195
if (already)
195196
return;
196197
already = true; /* Only do this on first boot */
197198

198-
/* This clock reference dropped in ipa_uc_response_hdlr() above */
199-
ret = ipa_clock_get(ipa);
200-
if (WARN(ret < 0, "error %d getting proxy clock\n", ret))
201-
(void)ipa_clock_put(ipa);
202-
203-
ipa->uc_clocked = ret >= 0;
199+
/* This power reference dropped in ipa_uc_response_hdlr() above */
200+
dev = &ipa->pdev->dev;
201+
ret = pm_runtime_get_sync(dev);
202+
if (ret < 0) {
203+
pm_runtime_put_noidle(dev);
204+
dev_err(dev, "error %d getting proxy power\n", ret);
205+
} else {
206+
ipa->uc_clocked = true;
207+
}
204208
}
205209

206210
/* Send a command to the microcontroller */

0 commit comments

Comments
 (0)