Use pci_find_ht_capability() in drivers/infiniband/hw/ipath/ipath_iba6110.c

The old code made no guarantees about whether slave_or_pri_blk() was called
before or after set_int_handler() - so I assume they're order independant.

We now always call slave_or_pri_blk() first (if at all), followed by
set_int_handler().

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
---

 drivers/infiniband/hw/ipath/ipath_iba6110.c |   31 ++++++++--------------------
 1 file changed, 9 insertions(+), 22 deletions(-)

Index: msi/drivers/infiniband/hw/ipath/ipath_iba6110.c
===================================================================
--- msi.orig/drivers/infiniband/hw/ipath/ipath_iba6110.c
+++ msi/drivers/infiniband/hw/ipath/ipath_iba6110.c
@@ -750,7 +750,6 @@ static int ipath_setup_ht_reset(struct i
        return 0;
 }
 
-#define HT_INTR_DISC_CONFIG  0x80      /* HT interrupt and discovery cap */
 #define HT_INTR_REG_INDEX    2 /* intconfig requires indirect accesses */
 
 /*
@@ -971,8 +970,7 @@ static int set_int_handler(struct ipath_
 static int ipath_setup_ht_config(struct ipath_devdata *dd,
                                 struct pci_dev *pdev)
 {
-       int pos, ret = 0;
-       int ihandler = 0;
+       int pos;
 
        /*
         * Read the capability info to find the interrupt info, and also
@@ -980,14 +978,8 @@ static int ipath_setup_ht_config(struct 
         * do this early, before we ever enable errors or hardware errors,
         * mostly to avoid causing the chip to enter freeze mode.
         */
-       pos = pci_find_capability(pdev, PCI_CAP_ID_HT);
-       if (!pos) {
-               ipath_dev_err(dd, "Couldn't find HyperTransport "
-                             "capability; no interrupts\n");
-               ret = -ENODEV;
-               goto bail;
-       }
-       do {
+       pos = pci_find_ht_capability(pdev, HT_CAPTYPE_SLAVE);
+       if (pos) {
                u8 cap_type;
 
                /* the HT capability type byte is 3 bytes after the
@@ -996,23 +988,18 @@ static int ipath_setup_ht_config(struct 
                if (pci_read_config_byte(pdev, pos + 3, &cap_type)) {
                        dev_info(&pdev->dev, "Couldn't read config "
                                 "command @ %d\n", pos);
-                       continue;
-               }
-               if (!(cap_type & 0xE0))
+               } else
                        slave_or_pri_blk(dd, pdev, pos, cap_type);
-               else if (cap_type == HT_INTR_DISC_CONFIG)
-                       ihandler = set_int_handler(dd, pdev, pos);
-       } while ((pos = pci_find_next_capability(pdev, pos,
-                                                PCI_CAP_ID_HT)));
+       }
 
-       if (!ihandler) {
+       pos = pci_find_ht_capability(pdev, HT_CAPTYPE_IRQ);
+       if (!pos || !set_int_handler(dd, pdev, pos)) {
                ipath_dev_err(dd, "Couldn't find interrupt handler in "
                              "config space\n");
-               ret = -ENODEV;
+               return -ENODEV;
        }
 
-bail:
-       return ret;
+       return 0;
 }
 
 /**

_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to