Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ipa: register IPA interrupt handlers directly

Declare the microcontroller IPA interrupt handler publicly, and
assign it directly in ipa_interrupt_config(). Make the SUSPEND IPA
interrupt handler public, and rename it ipa_power_suspend_handler().
Assign it directly in ipa_interrupt_config() as well.

This makes it unnecessary to do this in ipa_interrupt_add(). Make
similar changes for removing IPA interrupt handlers.

The next two patches will finish the cleanup, removing the
add/remove functions and the handler array entirely.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Alex Elder and committed by
Jakub Kicinski
482ae3a9 d50ed355

+31 -21
+8 -8
drivers/net/ipa/ipa_interrupt.c
··· 26 26 #include "ipa.h" 27 27 #include "ipa_reg.h" 28 28 #include "ipa_endpoint.h" 29 + #include "ipa_power.h" 30 + #include "ipa_uc.h" 29 31 #include "ipa_interrupt.h" 30 32 31 33 /** ··· 229 227 void ipa_interrupt_add(struct ipa_interrupt *interrupt, 230 228 enum ipa_irq_id ipa_irq, ipa_irq_handler_t handler) 231 229 { 232 - if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT)) 233 - return; 234 - 235 - interrupt->handler[ipa_irq] = handler; 230 + WARN_ON(ipa_irq >= IPA_IRQ_COUNT); 236 231 } 237 232 238 233 /* Remove the handler for an IPA interrupt type */ 239 234 void 240 235 ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq) 241 236 { 242 - if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT)) 243 - return; 244 - 245 - interrupt->handler[ipa_irq] = NULL; 237 + WARN_ON(ipa_irq >= IPA_IRQ_COUNT); 246 238 } 247 239 248 240 /* Configure the IPA interrupt framework */ ··· 278 282 dev_err(dev, "error %d enabling wakeup for \"ipa\" IRQ\n", ret); 279 283 goto err_free_irq; 280 284 } 285 + 286 + interrupt->handler[IPA_IRQ_UC_0] = ipa_uc_interrupt_handler; 287 + interrupt->handler[IPA_IRQ_UC_1] = ipa_uc_interrupt_handler; 288 + interrupt->handler[IPA_IRQ_TX_SUSPEND] = ipa_power_suspend_handler; 281 289 282 290 return interrupt; 283 291
+2 -12
drivers/net/ipa/ipa_power.c
··· 202 202 return ipa->power ? (u32)clk_get_rate(ipa->power->core) : 0; 203 203 } 204 204 205 - /** 206 - * ipa_suspend_handler() - Handle the suspend IPA interrupt 207 - * @ipa: IPA pointer 208 - * @irq_id: IPA interrupt type (unused) 209 - * 210 - * If an RX endpoint is suspended, and the IPA has a packet destined for 211 - * that endpoint, the IPA generates a SUSPEND interrupt to inform the AP 212 - * that it should resume the endpoint. If we get one of these interrupts 213 - * we just wake up the system. 214 - */ 215 - static void ipa_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) 205 + void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) 216 206 { 217 207 /* To handle an IPA interrupt we will have resumed the hardware 218 208 * just to handle the interrupt, so we're done. If we are in a ··· 326 336 int ret; 327 337 328 338 ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND, 329 - ipa_suspend_handler); 339 + ipa_power_suspend_handler); 330 340 ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND); 331 341 332 342 ret = device_init_wakeup(&ipa->pdev->dev, true);
+12
drivers/net/ipa/ipa_power.h
··· 10 10 11 11 struct ipa; 12 12 struct ipa_power_data; 13 + enum ipa_irq_id; 13 14 14 15 /* IPA device power management function block */ 15 16 extern const struct dev_pm_ops ipa_pm_ops; ··· 47 46 * @enable: Whether retention should be enabled or disabled 48 47 */ 49 48 void ipa_power_retention(struct ipa *ipa, bool enable); 49 + 50 + /** 51 + * ipa_power_suspend_handler() - Handler for SUSPEND IPA interrupts 52 + * @ipa: IPA pointer 53 + * @irq_id: IPA interrupt ID (unused) 54 + * 55 + * If an RX endpoint is suspended, and the IPA has a packet destined for 56 + * that endpoint, the IPA generates a SUSPEND interrupt to inform the AP 57 + * that it should resume the endpoint. 58 + */ 59 + void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id); 50 60 51 61 /** 52 62 * ipa_power_setup() - Set up IPA power management
+1 -1
drivers/net/ipa/ipa_uc.c
··· 170 170 } 171 171 } 172 172 173 - static void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id) 173 + void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id) 174 174 { 175 175 /* Silently ignore anything unrecognized */ 176 176 if (irq_id == IPA_IRQ_UC_0)
+8
drivers/net/ipa/ipa_uc.h
··· 7 7 #define _IPA_UC_H_ 8 8 9 9 struct ipa; 10 + enum ipa_irq_id; 11 + 12 + /** 13 + * ipa_uc_interrupt_handler() - Handler for microcontroller IPA interrupts 14 + * @ipa: IPA pointer 15 + * @irq_id: IPA interrupt ID 16 + */ 17 + void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id); 10 18 11 19 /** 12 20 * ipa_uc_config() - Configure the IPA microcontroller subsystem