Skip to content

Commit 33a1531

Browse files
Alex Elderdavem330
authored andcommitted
net: ipa: directly disable ipa-setup-ready interrupt
We currently maintain a "disabled" Boolean flag to determine whether the "ipa-setup-ready" SMP2P IRQ handler does anything. That flag must be accessed under protection of a mutex. Instead, disable the SMP2P interrupt when requested, which prevents the interrupt handler from ever being called. More importantly, it synchronizes a thread disabling the interrupt with the completion of the interrupt handler in case they run concurrently. Use the IPA setup_complete flag rather than the disabled flag in the handler to determine whether to ignore any interrupts arriving after the first. Rename the "disabled" flag to be "setup_disabled", to be specific about its purpose. Fixes: 530f921 ("soc: qcom: ipa: AP/modem communications") Signed-off-by: Alex Elder <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bd08ee2 commit 33a1531

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

drivers/net/ipa/ipa_smp2p.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
* @setup_ready_irq: IPA interrupt triggered by modem to signal GSI ready
5454
* @power_on: Whether IPA power is on
5555
* @notified: Whether modem has been notified of power state
56-
* @disabled: Whether setup ready interrupt handling is disabled
56+
* @setup_disabled: Whether setup ready interrupt handler is disabled
5757
* @mutex: Mutex protecting ready-interrupt/shutdown interlock
5858
* @panic_notifier: Panic notifier structure
5959
*/
@@ -67,7 +67,7 @@ struct ipa_smp2p {
6767
u32 setup_ready_irq;
6868
bool power_on;
6969
bool notified;
70-
bool disabled;
70+
bool setup_disabled;
7171
struct mutex mutex;
7272
struct notifier_block panic_notifier;
7373
};
@@ -155,11 +155,9 @@ static irqreturn_t ipa_smp2p_modem_setup_ready_isr(int irq, void *dev_id)
155155
struct device *dev;
156156
int ret;
157157

158-
mutex_lock(&smp2p->mutex);
159-
160-
if (smp2p->disabled)
161-
goto out_mutex_unlock;
162-
smp2p->disabled = true; /* If any others arrive, ignore them */
158+
/* Ignore any (spurious) interrupts received after the first */
159+
if (smp2p->ipa->setup_complete)
160+
return IRQ_HANDLED;
163161

164162
/* Power needs to be active for setup */
165163
dev = &smp2p->ipa->pdev->dev;
@@ -176,8 +174,6 @@ static irqreturn_t ipa_smp2p_modem_setup_ready_isr(int irq, void *dev_id)
176174
out_power_put:
177175
pm_runtime_mark_last_busy(dev);
178176
(void)pm_runtime_put_autosuspend(dev);
179-
out_mutex_unlock:
180-
mutex_unlock(&smp2p->mutex);
181177

182178
return IRQ_HANDLED;
183179
}
@@ -322,7 +318,10 @@ void ipa_smp2p_disable(struct ipa *ipa)
322318

323319
mutex_lock(&smp2p->mutex);
324320

325-
smp2p->disabled = true;
321+
if (!smp2p->setup_disabled) {
322+
disable_irq(smp2p->setup_ready_irq);
323+
smp2p->setup_disabled = true;
324+
}
326325

327326
mutex_unlock(&smp2p->mutex);
328327
}

0 commit comments

Comments
 (0)