]> git.itanic.dy.fi Git - linux-stable/commitdiff
net: ipa: register IPA interrupt handlers directly
authorAlex Elder <elder@linaro.org>
Wed, 4 Jan 2023 17:52:31 +0000 (11:52 -0600)
committerJakub Kicinski <kuba@kernel.org>
Fri, 6 Jan 2023 06:03:14 +0000 (22:03 -0800)
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>
drivers/net/ipa/ipa_interrupt.c
drivers/net/ipa/ipa_power.c
drivers/net/ipa/ipa_power.h
drivers/net/ipa/ipa_uc.c
drivers/net/ipa/ipa_uc.h

index f05ddd496dbe1b988e5e352d89a49e4e3eb42933..a0140d1d59502bd6b850a50d2f30dedea55352ee 100644 (file)
@@ -26,6 +26,8 @@
 #include "ipa.h"
 #include "ipa_reg.h"
 #include "ipa_endpoint.h"
+#include "ipa_power.h"
+#include "ipa_uc.h"
 #include "ipa_interrupt.h"
 
 /**
@@ -227,20 +229,14 @@ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt)
 void ipa_interrupt_add(struct ipa_interrupt *interrupt,
                       enum ipa_irq_id ipa_irq, ipa_irq_handler_t handler)
 {
-       if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT))
-               return;
-
-       interrupt->handler[ipa_irq] = handler;
+       WARN_ON(ipa_irq >= IPA_IRQ_COUNT);
 }
 
 /* Remove the handler for an IPA interrupt type */
 void
 ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq)
 {
-       if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT))
-               return;
-
-       interrupt->handler[ipa_irq] = NULL;
+       WARN_ON(ipa_irq >= IPA_IRQ_COUNT);
 }
 
 /* Configure the IPA interrupt framework */
@@ -283,6 +279,10 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa)
                goto err_free_irq;
        }
 
+       interrupt->handler[IPA_IRQ_UC_0] = ipa_uc_interrupt_handler;
+       interrupt->handler[IPA_IRQ_UC_1] = ipa_uc_interrupt_handler;
+       interrupt->handler[IPA_IRQ_TX_SUSPEND] = ipa_power_suspend_handler;
+
        return interrupt;
 
 err_free_irq:
index 9148d606d5fc25f61c898bc3fa576d698ec2b745..4198f8e97e40b7e48ba3af5011f82331581d9bbe 100644 (file)
@@ -202,17 +202,7 @@ u32 ipa_core_clock_rate(struct ipa *ipa)
        return ipa->power ? (u32)clk_get_rate(ipa->power->core) : 0;
 }
 
-/**
- * ipa_suspend_handler() - Handle the suspend IPA interrupt
- * @ipa:       IPA pointer
- * @irq_id:    IPA interrupt type (unused)
- *
- * If an RX endpoint is suspended, and the IPA has a packet destined for
- * that endpoint, the IPA generates a SUSPEND interrupt to inform the AP
- * that it should resume the endpoint.  If we get one of these interrupts
- * we just wake up the system.
- */
-static void ipa_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id)
+void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id)
 {
        /* To handle an IPA interrupt we will have resumed the hardware
         * just to handle the interrupt, so we're done.  If we are in a
@@ -336,7 +326,7 @@ int ipa_power_setup(struct ipa *ipa)
        int ret;
 
        ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND,
-                         ipa_suspend_handler);
+                         ipa_power_suspend_handler);
        ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND);
 
        ret = device_init_wakeup(&ipa->pdev->dev, true);
index 896f052e51a1ca67ec89dfd011b554437a06c8d0..3a4c59ea1222b4a463daa1a7d96188113e552b3c 100644 (file)
@@ -10,6 +10,7 @@ struct device;
 
 struct ipa;
 struct ipa_power_data;
+enum ipa_irq_id;
 
 /* IPA device power management function block */
 extern const struct dev_pm_ops ipa_pm_ops;
@@ -47,6 +48,17 @@ void ipa_power_modem_queue_active(struct ipa *ipa);
  */
 void ipa_power_retention(struct ipa *ipa, bool enable);
 
+/**
+ * ipa_power_suspend_handler() - Handler for SUSPEND IPA interrupts
+ * @ipa:       IPA pointer
+ * @irq_id:    IPA interrupt ID (unused)
+ *
+ * If an RX endpoint is suspended, and the IPA has a packet destined for
+ * that endpoint, the IPA generates a SUSPEND interrupt to inform the AP
+ * that it should resume the endpoint.
+ */
+void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id);
+
 /**
  * ipa_power_setup() - Set up IPA power management
  * @ipa:       IPA pointer
index af541758d047fce15ae969d693e4f8c0a9160ffd..6b7d289cfaffa9448408194eed7f0eab9e4bca33 100644 (file)
@@ -170,7 +170,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa)
        }
 }
 
-static void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id)
+void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id)
 {
        /* Silently ignore anything unrecognized */
        if (irq_id == IPA_IRQ_UC_0)
index 8514096e6f36f277e9e8555dd17cd91bca67662f..85aa0df818c230c98b0118a594ed723f4c058dc5 100644 (file)
@@ -7,6 +7,14 @@
 #define _IPA_UC_H_
 
 struct ipa;
+enum ipa_irq_id;
+
+/**
+ * ipa_uc_interrupt_handler() - Handler for microcontroller IPA interrupts
+ * @ipa:       IPA pointer
+ * @irq_id:    IPA interrupt ID
+ */
+void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id);
 
 /**
  * ipa_uc_config() - Configure the IPA microcontroller subsystem