Skip to content

Commit e5709b7

Browse files
Alex Elderkuba-moo
authored andcommitted
net: ipa: introduce a common microcontroller interrupt handler
The prototype for an IPA interrupt handler supplies the IPA interrupt ID, so it's possible to use a single function to handle any type of microcontroller interrupt. Introduce ipa_uc_interrupt_handler(), which calls the event or the response handler depending on the IRQ ID provided. Register the new function as the handler for both microcontroller IPA interrupt types. The called functions don't use their "irq_id" arguments, so remove them. Signed-off-by: Alex Elder <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent afd50da commit e5709b7

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

drivers/net/ipa/ipa_uc.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static struct ipa_uc_mem_area *ipa_uc_shared(struct ipa *ipa)
124124
}
125125

126126
/* Microcontroller event IPA interrupt handler */
127-
static void ipa_uc_event_handler(struct ipa *ipa, enum ipa_irq_id irq_id)
127+
static void ipa_uc_event_handler(struct ipa *ipa)
128128
{
129129
struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa);
130130
struct device *dev = &ipa->pdev->dev;
@@ -138,7 +138,7 @@ static void ipa_uc_event_handler(struct ipa *ipa, enum ipa_irq_id irq_id)
138138
}
139139

140140
/* Microcontroller response IPA interrupt handler */
141-
static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id)
141+
static void ipa_uc_response_hdlr(struct ipa *ipa)
142142
{
143143
struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa);
144144
struct device *dev = &ipa->pdev->dev;
@@ -170,13 +170,24 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id)
170170
}
171171
}
172172

173+
static void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id)
174+
{
175+
/* Silently ignore anything unrecognized */
176+
if (irq_id == IPA_IRQ_UC_0)
177+
ipa_uc_event_handler(ipa);
178+
else if (irq_id == IPA_IRQ_UC_1)
179+
ipa_uc_response_hdlr(ipa);
180+
}
181+
173182
/* Configure the IPA microcontroller subsystem */
174183
void ipa_uc_config(struct ipa *ipa)
175184
{
185+
struct ipa_interrupt *interrupt = ipa->interrupt;
186+
176187
ipa->uc_powered = false;
177188
ipa->uc_loaded = false;
178-
ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_0, ipa_uc_event_handler);
179-
ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_1, ipa_uc_response_hdlr);
189+
ipa_interrupt_add(interrupt, IPA_IRQ_UC_0, ipa_uc_interrupt_handler);
190+
ipa_interrupt_add(interrupt, IPA_IRQ_UC_1, ipa_uc_interrupt_handler);
180191
}
181192

182193
/* Inverse of ipa_uc_config() */

0 commit comments

Comments
 (0)