History

genirq/msi: Convert to new functions

Use the new iterator functions and add locking where required.

Thomas Gleixner committed 4 years ago

Commit 495c66a1 parent ef8dd011 file · +14 −9Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/irq/msi.c+14−9
@@ -320,6 +320,7 @@ EXPORT_SYMBOL_GPL(msi_next_desc); · 319 unmodified lines
320320 unsigned int msi_get_virq(struct device *dev, unsigned int index)
321321 {
322322 struct msi_desc *desc;
323+ unsigned int ret = 0;
323324 bool pcimsi;
324325
325326 if (!dev->msi.data)
@@ -327,11 +328,12 @@ unsigned int msi_get_virq(struct device *dev, unsigned int index) · 1 unmodified line
327328
328329 pcimsi = dev_is_pci(dev) ? to_pci_dev(dev)->msi_enabled : false;
329330
330− for_each_msi_entry(desc, dev) {
331+ msi_lock_descs(dev);
332+ msi_for_each_desc(desc, dev, MSI_DESC_ASSOCIATED) {
331333 /* PCI-MSI has only one descriptor for multiple interrupts. */
332334 if (pcimsi) {
333− if (desc->irq && index < desc->nvec_used)
334− return desc->irq + index;
335+ if (index < desc->nvec_used)
336+ ret = desc->irq + index;
335337 break;
336338 }
337339
@@ -339,10 +341,13 @@ unsigned int msi_get_virq(struct device *dev, unsigned int index) · 1 unmodified line
339341 * PCI-MSIX and platform MSI use a descriptor per
340342 * interrupt.
341343 */
342− if (desc->msi_index == index)
343− return desc->irq;
344+ if (desc->msi_index == index) {
345+ ret = desc->irq;
346+ break;
347+ }
344348 }
345− return 0;
349+ msi_unlock_descs(dev);
350+ return ret;
346351 }
347352 EXPORT_SYMBOL_GPL(msi_get_virq);
348353
@@ -373,7 +378,7 @@ static const struct attribute_group **msi_populate_sysfs(struct device *dev) · 24 unmodified lines
373378 int i;
374379
375380 /* Determine how many msi entries we have */
376− for_each_msi_entry(entry, dev)
381+ msi_for_each_desc(entry, dev, MSI_DESC_ALL)
377382 num_msi += entry->nvec_used;
378383 if (!num_msi)
379384 return NULL;
@@ -383,7 +388,7 @@ static const struct attribute_group **msi_populate_sysfs(struct device *dev) · 3 unmodified lines
383388 if (!msi_attrs)
384389 return ERR_PTR(-ENOMEM);
385390
386− for_each_msi_entry(entry, dev) {
391+ msi_for_each_desc(entry, dev, MSI_DESC_ALL) {
387392 for (i = 0; i < entry->nvec_used; i++) {
388393 msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL);
389394 if (!msi_dev_attr)
@@ -803,7 +808,7 @@ static bool msi_check_reservation_mode(struct irq_domain *domain, · 413 unmodified lines
803808 * Checking the first MSI descriptor is sufficient. MSIX supports
804809 * masking and MSI does so when the can_mask attribute is set.
805810 */
806− desc = first_msi_entry(dev);
811+ desc = msi_first_desc(dev, MSI_DESC_ALL);
807812 return desc->pci.msi_attrib.is_msix || desc->pci.msi_attrib.can_mask;
808813 }
809814