Skip to content

Commit d50ed35

Browse files
Alex Elderkuba-moo
authored andcommitted
net: ipa: enable IPA interrupt handlers separate from registration
Expose ipa_interrupt_enable() and have functions that register IPA interrupt handlers enable them directly, rather than having the registration process do that. Do the same for disabling IPA interrupt handlers. Signed-off-by: Alex Elder <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8e461e1 commit d50ed35

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

drivers/net/ipa/ipa_interrupt.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ static void ipa_interrupt_enabled_update(struct ipa *ipa)
135135
}
136136

137137
/* Enable an IPA interrupt type */
138-
static void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq)
138+
void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq)
139139
{
140140
/* Update the IPA interrupt mask to enable it */
141141
ipa->interrupt->enabled |= BIT(ipa_irq);
142142
ipa_interrupt_enabled_update(ipa);
143143
}
144144

145145
/* Disable an IPA interrupt type */
146-
static void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq)
146+
void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq)
147147
{
148148
/* Update the IPA interrupt mask to disable it */
149149
ipa->interrupt->enabled &= ~BIT(ipa_irq);
@@ -231,8 +231,6 @@ void ipa_interrupt_add(struct ipa_interrupt *interrupt,
231231
return;
232232

233233
interrupt->handler[ipa_irq] = handler;
234-
235-
ipa_interrupt_enable(interrupt->ipa, ipa_irq);
236234
}
237235

238236
/* Remove the handler for an IPA interrupt type */
@@ -242,8 +240,6 @@ ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq)
242240
if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT))
243241
return;
244242

245-
ipa_interrupt_disable(interrupt->ipa, ipa_irq);
246-
247243
interrupt->handler[ipa_irq] = NULL;
248244
}
249245

drivers/net/ipa/ipa_interrupt.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
struct ipa;
1313
struct ipa_interrupt;
14+
enum ipa_irq_id;
1415

1516
/**
1617
* typedef ipa_irq_handler_t - IPA interrupt handler function type
@@ -85,6 +86,20 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt);
8586
*/
8687
void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt);
8788

89+
/**
90+
* ipa_interrupt_enable() - Enable an IPA interrupt type
91+
* @ipa: IPA pointer
92+
* @ipa_irq: IPA interrupt ID
93+
*/
94+
void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq);
95+
96+
/**
97+
* ipa_interrupt_disable() - Disable an IPA interrupt type
98+
* @ipa: IPA pointer
99+
* @ipa_irq: IPA interrupt ID
100+
*/
101+
void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq);
102+
88103
/**
89104
* ipa_interrupt_config() - Configure the IPA interrupt framework
90105
* @ipa: IPA pointer

drivers/net/ipa/ipa_power.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,17 +337,21 @@ int ipa_power_setup(struct ipa *ipa)
337337

338338
ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND,
339339
ipa_suspend_handler);
340+
ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND);
340341

341342
ret = device_init_wakeup(&ipa->pdev->dev, true);
342-
if (ret)
343+
if (ret) {
344+
ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND);
343345
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND);
346+
}
344347

345348
return ret;
346349
}
347350

348351
void ipa_power_teardown(struct ipa *ipa)
349352
{
350353
(void)device_init_wakeup(&ipa->pdev->dev, false);
354+
ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND);
351355
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND);
352356
}
353357

drivers/net/ipa/ipa_uc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,19 @@ void ipa_uc_config(struct ipa *ipa)
187187
ipa->uc_powered = false;
188188
ipa->uc_loaded = false;
189189
ipa_interrupt_add(interrupt, IPA_IRQ_UC_0, ipa_uc_interrupt_handler);
190+
ipa_interrupt_enable(ipa, IPA_IRQ_UC_0);
190191
ipa_interrupt_add(interrupt, IPA_IRQ_UC_1, ipa_uc_interrupt_handler);
192+
ipa_interrupt_enable(ipa, IPA_IRQ_UC_1);
191193
}
192194

193195
/* Inverse of ipa_uc_config() */
194196
void ipa_uc_deconfig(struct ipa *ipa)
195197
{
196198
struct device *dev = &ipa->pdev->dev;
197199

200+
ipa_interrupt_disable(ipa, IPA_IRQ_UC_1);
198201
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1);
202+
ipa_interrupt_disable(ipa, IPA_IRQ_UC_0);
199203
ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0);
200204
if (ipa->uc_loaded)
201205
ipa_power_retention(ipa, false);

0 commit comments

Comments
 (0)