Skip to content

Commit dc2b453

Browse files
committed
PCI: hv: Rework MSI handling
Replace the about to vanish iterators and make use of the filtering. Take the descriptor lock around the iterators. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Michael Kelley <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 706b585 commit dc2b453

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/pci/controller/pci-hyperv.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3445,18 +3445,23 @@ static int hv_pci_suspend(struct hv_device *hdev)
34453445

34463446
static int hv_pci_restore_msi_msg(struct pci_dev *pdev, void *arg)
34473447
{
3448-
struct msi_desc *entry;
34493448
struct irq_data *irq_data;
3449+
struct msi_desc *entry;
3450+
int ret = 0;
34503451

3451-
for_each_pci_msi_entry(entry, pdev) {
3452+
msi_lock_descs(&pdev->dev);
3453+
msi_for_each_desc(entry, &pdev->dev, MSI_DESC_ASSOCIATED) {
34523454
irq_data = irq_get_irq_data(entry->irq);
3453-
if (WARN_ON_ONCE(!irq_data))
3454-
return -EINVAL;
3455+
if (WARN_ON_ONCE(!irq_data)) {
3456+
ret = -EINVAL;
3457+
break;
3458+
}
34553459

34563460
hv_compose_msi_msg(irq_data, &entry->msg);
34573461
}
3462+
msi_unlock_descs(&pdev->dev);
34583463

3459-
return 0;
3464+
return ret;
34603465
}
34613466

34623467
/*

0 commit comments

Comments
 (0)