[RFC Part4 v1 08/17] PCI/MSI: Use irq_chip.irq_write_msi_msg() to share common code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change PCI MSI code to use irq_chip.irq_write_msi_msg() to share more
common code later.

Signed-off-by: Jiang Liu <jiang.liu@xxxxxxxxxxxxxxx>
---
 drivers/pci/msi.c   |   24 ++++++------------------
 include/linux/msi.h |    3 +++
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index b811739b43c5..cc6207e3b6bc 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1111,7 +1111,7 @@ int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,
 	ret = parent->chip->irq_set_affinity(parent, mask, force);
 	if (ret >= 0 && ret != IRQ_SET_MASK_OK_DONE) {
 		irq_chip_compose_msi_msg(data, &msg);
-		__write_msi_msg(data->msi_desc, &msg);
+		irq_chip_write_msi_msg(data, &msg);
 	}
 
 	return ret;
@@ -1177,32 +1177,20 @@ static void msi_domain_free(struct irq_domain *domain, unsigned int virq,
 	irq_domain_free_irqs_top(domain, virq, nr_irqs);
 }
 
-static void msi_domain_activate(struct irq_domain *domain,
-				struct irq_data *irq_data)
+void msi_domain_activate(struct irq_domain *domain, struct irq_data *irq_data)
 {
 	struct msi_msg msg;
 
-	/*
-	 * irq_data->chip_data is MSI/MSI-X offset.
-	 * MSI-X message is written per-IRQ, the offset is always 0.
-	 * MSI message denotes a contiguous group of IRQs, written for 0th IRQ.
-	 */
-	if (irq_data->chip_data)
-		return;
-
 	BUG_ON(irq_chip_compose_msi_msg(irq_data, &msg));
-	__write_msi_msg(irq_data->msi_desc, &msg);
+	irq_chip_write_msi_msg(irq_data, &msg);
 }
 
-static void msi_domain_deactivate(struct irq_domain *domain,
-				  struct irq_data *irq_data)
+void msi_domain_deactivate(struct irq_domain *domain, struct irq_data *irq_data)
 {
 	struct msi_msg msg;
 
-	if (!irq_data->chip_data) {
-		memset(&msg, 0, sizeof(msg));
-		__write_msi_msg(irq_data->msi_desc, &msg);
-	}
+	memset(&msg, 0, sizeof(msg));
+	irq_chip_write_msi_msg(irq_data, &msg);
 }
 
 static struct irq_domain_ops msi_domain_ops = {
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 312197f64070..bd0f9d8c6fe1 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -81,6 +81,9 @@ struct irq_chip;
 
 int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,
 			    bool force);
+void msi_domain_activate(struct irq_domain *domain, struct irq_data *irq_data);
+void msi_domain_deactivate(struct irq_domain *domain,
+			   struct irq_data *irq_data);
 struct irq_domain *msi_create_irq_domain(struct device_node *of_node,
 					 struct irq_chip *chip,
 					 struct irq_domain *parent);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux