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

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: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>

+15 -21
+2 -2
arch/x86/kernel/apic/io_apic.c
··· 3383 3383 3384 3384 cfg = desc->chip_data; 3385 3385 3386 - get_cached_msi_msg_desc(desc, &msg); 3386 + __get_cached_msi_msg(desc->irq_data.msi_desc, &msg); 3387 3387 3388 3388 msg.data &= ~MSI_DATA_VECTOR_MASK; 3389 3389 msg.data |= MSI_DATA_VECTOR(cfg->vector); 3390 3390 msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; 3391 3391 msg.address_lo |= MSI_ADDR_DEST_ID(dest); 3392 3392 3393 - write_msi_msg_desc(desc, &msg); 3393 + __write_msi_msg(desc->irq_data.msi_desc, &msg); 3394 3394 3395 3395 return 0; 3396 3396 }
+9 -15
drivers/pci/msi.c
··· 193 193 msi_set_mask_bit(data, 0); 194 194 } 195 195 196 - void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) 196 + void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg) 197 197 { 198 - struct msi_desc *entry = get_irq_desc_msi(desc); 199 - 200 198 BUG_ON(entry->dev->current_state != PCI_D0); 201 199 202 200 if (entry->msi_attrib.is_msix) { ··· 225 227 226 228 void read_msi_msg(unsigned int irq, struct msi_msg *msg) 227 229 { 228 - struct irq_desc *desc = irq_to_desc(irq); 230 + struct msi_desc *entry = get_irq_msi(irq); 229 231 230 - read_msi_msg_desc(desc, msg); 232 + __read_msi_msg(entry, msg); 231 233 } 232 234 233 - void get_cached_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) 235 + void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg) 234 236 { 235 - struct msi_desc *entry = get_irq_desc_msi(desc); 236 - 237 237 /* Assert that the cache is valid, assuming that 238 238 * valid messages are not all-zeroes. */ 239 239 BUG_ON(!(entry->msg.address_hi | entry->msg.address_lo | ··· 242 246 243 247 void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg) 244 248 { 245 - struct irq_desc *desc = irq_to_desc(irq); 249 + struct msi_desc *entry = get_irq_msi(irq); 246 250 247 - get_cached_msi_msg_desc(desc, msg); 251 + __get_cached_msi_msg(entry, msg); 248 252 } 249 253 250 - void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) 254 + void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) 251 255 { 252 - struct msi_desc *entry = get_irq_desc_msi(desc); 253 - 254 256 if (entry->dev->current_state != PCI_D0) { 255 257 /* Don't touch the hardware now */ 256 258 } else if (entry->msi_attrib.is_msix) { ··· 286 292 287 293 void write_msi_msg(unsigned int irq, struct msi_msg *msg) 288 294 { 289 - struct irq_desc *desc = irq_to_desc(irq); 295 + struct msi_desc *entry = get_irq_msi(irq); 290 296 291 - write_msi_msg_desc(desc, msg); 297 + __write_msi_msg(entry, msg); 292 298 } 293 299 294 300 static void free_msi_irqs(struct pci_dev *dev)
+4 -4
include/linux/msi.h
··· 10 10 }; 11 11 12 12 /* Helper functions */ 13 - struct irq_desc; 14 13 struct irq_data; 14 + struct msi_desc; 15 15 extern void mask_msi_irq(struct irq_data *data); 16 16 extern void unmask_msi_irq(struct irq_data *data); 17 - extern void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); 18 - extern void get_cached_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); 19 - extern void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); 17 + extern void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 18 + extern void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 19 + extern void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 20 20 extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); 21 21 extern void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg); 22 22 extern void write_msi_msg(unsigned int irq, struct msi_msg *msg);