misc/GenWQE: fix pci_enable_msi usage
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Wed, 9 Jul 2014 10:46:39 +0000 (12:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jul 2014 21:16:48 +0000 (14:16 -0700)
GenWQE used to call pci_enable_msi_block to allocate a desired number
of MSI's. If that was not possible pci_enable_msi_block returned with a
smaller number which might be possible to allocate. GenWQE then called
pci_enable_msi_block with that number.

Since commit a30d0108b
"GenWQE: Use pci_enable_msi_exact() instead of pci_enable_msi_block()"
pci_enable_msi_exact is used which fails if the desired number of MSI's
was not possible to allocate. Change GenWQE to use pci_enable_msi_range
to restore the old behavior.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/genwqe/card_ddcb.c
drivers/misc/genwqe/card_utils.c

index f0de6153bea22aaa1a3249f63b88d97eba95a2ba..dc9851a5540e2d3473d2ea3c281793ad52f78219 100644 (file)
@@ -1251,9 +1251,7 @@ int genwqe_setup_service_layer(struct genwqe_dev *cd)
        }
 
        rc = genwqe_set_interrupt_capability(cd, GENWQE_MSI_IRQS);
-       if (rc > 0)
-               rc = genwqe_set_interrupt_capability(cd, rc);
-       if (rc != 0) {
+       if (rc) {
                rc = -ENODEV;
                goto stop_kthread;
        }
index 4a500582eef09229532ebbee90cef80efd36538a..a6400f09229cf058a363686cc49da8f372f10480 100644 (file)
@@ -728,10 +728,12 @@ int genwqe_set_interrupt_capability(struct genwqe_dev *cd, int count)
        int rc;
        struct pci_dev *pci_dev = cd->pci_dev;
 
-       rc = pci_enable_msi_exact(pci_dev, count);
-       if (rc == 0)
-               cd->flags |= GENWQE_FLAG_MSI_ENABLED;
-       return rc;
+       rc = pci_enable_msi_range(pci_dev, 1, count);
+       if (rc < 0)
+               return rc;
+
+       cd->flags |= GENWQE_FLAG_MSI_ENABLED;
+       return 0;
 }
 
 /**