Commit 39431acb authored by Thomas Gleixner's avatar Thomas Gleixner

pci: Cleanup the irq_desc mess in msi

Handing down irq_desc to msi just so that msi can access
irq_desc.irq_data.msi_desc is a pretty stupid idea. The calling code
can hand down a pointer to msi_desc so msi code does not need to know
about the irq descriptor at all.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarIngo Molnar <mingo@elte.hu>
Acked-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 1c9db525
...@@ -3383,14 +3383,14 @@ static int set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask) ...@@ -3383,14 +3383,14 @@ static int set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask)
cfg = desc->chip_data; cfg = desc->chip_data;
get_cached_msi_msg_desc(desc, &msg); __get_cached_msi_msg(desc->irq_data.msi_desc, &msg);
msg.data &= ~MSI_DATA_VECTOR_MASK; msg.data &= ~MSI_DATA_VECTOR_MASK;
msg.data |= MSI_DATA_VECTOR(cfg->vector); msg.data |= MSI_DATA_VECTOR(cfg->vector);
msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
msg.address_lo |= MSI_ADDR_DEST_ID(dest); msg.address_lo |= MSI_ADDR_DEST_ID(dest);
write_msi_msg_desc(desc, &msg); __write_msi_msg(desc->irq_data.msi_desc, &msg);
return 0; return 0;
} }
......
...@@ -193,10 +193,8 @@ void unmask_msi_irq(struct irq_data *data) ...@@ -193,10 +193,8 @@ void unmask_msi_irq(struct irq_data *data)
msi_set_mask_bit(data, 0); msi_set_mask_bit(data, 0);
} }
void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
{ {
struct msi_desc *entry = get_irq_desc_msi(desc);
BUG_ON(entry->dev->current_state != PCI_D0); BUG_ON(entry->dev->current_state != PCI_D0);
if (entry->msi_attrib.is_msix) { if (entry->msi_attrib.is_msix) {
...@@ -227,15 +225,13 @@ void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) ...@@ -227,15 +225,13 @@ void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg)
void read_msi_msg(unsigned int irq, struct msi_msg *msg) void read_msi_msg(unsigned int irq, struct msi_msg *msg)
{ {
struct irq_desc *desc = irq_to_desc(irq); struct msi_desc *entry = get_irq_msi(irq);
read_msi_msg_desc(desc, msg); __read_msi_msg(entry, msg);
} }
void get_cached_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
{ {
struct msi_desc *entry = get_irq_desc_msi(desc);
/* Assert that the cache is valid, assuming that /* Assert that the cache is valid, assuming that
* valid messages are not all-zeroes. */ * valid messages are not all-zeroes. */
BUG_ON(!(entry->msg.address_hi | entry->msg.address_lo | BUG_ON(!(entry->msg.address_hi | entry->msg.address_lo |
...@@ -246,15 +242,13 @@ void get_cached_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) ...@@ -246,15 +242,13 @@ void get_cached_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg)
void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg) void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg)
{ {
struct irq_desc *desc = irq_to_desc(irq); struct msi_desc *entry = get_irq_msi(irq);
get_cached_msi_msg_desc(desc, msg); __get_cached_msi_msg(entry, msg);
} }
void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
{ {
struct msi_desc *entry = get_irq_desc_msi(desc);
if (entry->dev->current_state != PCI_D0) { if (entry->dev->current_state != PCI_D0) {
/* Don't touch the hardware now */ /* Don't touch the hardware now */
} else if (entry->msi_attrib.is_msix) { } else if (entry->msi_attrib.is_msix) {
...@@ -292,9 +286,9 @@ void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) ...@@ -292,9 +286,9 @@ void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg)
void write_msi_msg(unsigned int irq, struct msi_msg *msg) void write_msi_msg(unsigned int irq, struct msi_msg *msg)
{ {
struct irq_desc *desc = irq_to_desc(irq); struct msi_desc *entry = get_irq_msi(irq);
write_msi_msg_desc(desc, msg); __write_msi_msg(entry, msg);
} }
static void free_msi_irqs(struct pci_dev *dev) static void free_msi_irqs(struct pci_dev *dev)
......
...@@ -10,13 +10,13 @@ struct msi_msg { ...@@ -10,13 +10,13 @@ struct msi_msg {
}; };
/* Helper functions */ /* Helper functions */
struct irq_desc;
struct irq_data; struct irq_data;
struct msi_desc;
extern void mask_msi_irq(struct irq_data *data); extern void mask_msi_irq(struct irq_data *data);
extern void unmask_msi_irq(struct irq_data *data); extern void unmask_msi_irq(struct irq_data *data);
extern void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); extern void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
extern void get_cached_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); extern void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
extern void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); extern void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); extern void read_msi_msg(unsigned int irq, struct msi_msg *msg);
extern void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg); extern void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg);
extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); extern void write_msi_msg(unsigned int irq, struct msi_msg *msg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment