Use the new iterator functions and add locking where required.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -320,6 +320,7 @@ EXPORT_SYMBOL_GPL(msi_next_desc); · 319 unmodified lines | ||
| 320 | 320 | unsigned int msi_get_virq(struct device *dev, unsigned int index) |
| 321 | 321 | { |
| 322 | 322 | struct msi_desc *desc; |
| 323 | + unsigned int ret = 0; | |
| 323 | 324 | bool pcimsi; |
| 324 | 325 | |
| 325 | 326 | if (!dev->msi.data) |
| @@ -327,11 +328,12 @@ unsigned int msi_get_virq(struct device *dev, unsigned int index) · 1 unmodified line | ||
| 327 | 328 | |
| 328 | 329 | pcimsi = dev_is_pci(dev) ? to_pci_dev(dev)->msi_enabled : false; |
| 329 | 330 | |
| 330 | − for_each_msi_entry(desc, dev) { | |
| 331 | + msi_lock_descs(dev); | |
| 332 | + msi_for_each_desc(desc, dev, MSI_DESC_ASSOCIATED) { | |
| 331 | 333 | /* PCI-MSI has only one descriptor for multiple interrupts. */ |
| 332 | 334 | 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; | |
| 335 | 337 | break; |
| 336 | 338 | } |
| 337 | 339 | |
| @@ -339,10 +341,13 @@ unsigned int msi_get_virq(struct device *dev, unsigned int index) · 1 unmodified line | ||
| 339 | 341 | * PCI-MSIX and platform MSI use a descriptor per |
| 340 | 342 | * interrupt. |
| 341 | 343 | */ |
| 342 | − if (desc->msi_index == index) | |
| 343 | − return desc->irq; | |
| 344 | + if (desc->msi_index == index) { | |
| 345 | + ret = desc->irq; | |
| 346 | + break; | |
| 347 | + } | |
| 344 | 348 | } |
| 345 | − return 0; | |
| 349 | + msi_unlock_descs(dev); | |
| 350 | + return ret; | |
| 346 | 351 | } |
| 347 | 352 | EXPORT_SYMBOL_GPL(msi_get_virq); |
| 348 | 353 | |
| @@ -373,7 +378,7 @@ static const struct attribute_group **msi_populate_sysfs(struct device *dev) · 24 unmodified lines | ||
| 373 | 378 | int i; |
| 374 | 379 | |
| 375 | 380 | /* Determine how many msi entries we have */ |
| 376 | − for_each_msi_entry(entry, dev) | |
| 381 | + msi_for_each_desc(entry, dev, MSI_DESC_ALL) | |
| 377 | 382 | num_msi += entry->nvec_used; |
| 378 | 383 | if (!num_msi) |
| 379 | 384 | return NULL; |
| @@ -383,7 +388,7 @@ static const struct attribute_group **msi_populate_sysfs(struct device *dev) · 3 unmodified lines | ||
| 383 | 388 | if (!msi_attrs) |
| 384 | 389 | return ERR_PTR(-ENOMEM); |
| 385 | 390 | |
| 386 | − for_each_msi_entry(entry, dev) { | |
| 391 | + msi_for_each_desc(entry, dev, MSI_DESC_ALL) { | |
| 387 | 392 | for (i = 0; i < entry->nvec_used; i++) { |
| 388 | 393 | msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL); |
| 389 | 394 | if (!msi_dev_attr) |
| @@ -803,7 +808,7 @@ static bool msi_check_reservation_mode(struct irq_domain *domain, · 413 unmodified lines | ||
| 803 | 808 | * Checking the first MSI descriptor is sufficient. MSIX supports |
| 804 | 809 | * masking and MSI does so when the can_mask attribute is set. |
| 805 | 810 | */ |
| 806 | − desc = first_msi_entry(dev); | |
| 811 | + desc = msi_first_desc(dev, MSI_DESC_ALL); | |
| 807 | 812 | return desc->pci.msi_attrib.is_msix || desc->pci.msi_attrib.can_mask; |
| 808 | 813 | } |
| 809 | 814 | |