PCI/switchtec: Add check of event support
[linux-2.6-microblaze.git] / drivers / pci / switch / switchtec.c
index 236cb40..38c2b03 100644 (file)
@@ -1024,6 +1024,9 @@ static int event_ctl(struct switchtec_dev *stdev,
                return PTR_ERR(reg);
 
        hdr = ioread32(reg);
+       if (hdr & SWITCHTEC_EVENT_NOT_SUPP)
+               return -EOPNOTSUPP;
+
        for (i = 0; i < ARRAY_SIZE(ctl->data); i++)
                ctl->data[i] = ioread32(&reg[i + 1]);
 
@@ -1096,7 +1099,7 @@ static int ioctl_event_ctl(struct switchtec_dev *stdev,
                for (ctl.index = 0; ctl.index < nr_idxs; ctl.index++) {
                        ctl.flags = event_flags;
                        ret = event_ctl(stdev, &ctl);
-                       if (ret < 0)
+                       if (ret < 0 && ret != -EOPNOTSUPP)
                                return ret;
                }
        } else {
@@ -1403,6 +1406,9 @@ static int mask_event(struct switchtec_dev *stdev, int eid, int idx)
        hdr_reg = event_regs[eid].map_reg(stdev, off, idx);
        hdr = ioread32(hdr_reg);
 
+       if (hdr & SWITCHTEC_EVENT_NOT_SUPP)
+               return 0;
+
        if (!(hdr & SWITCHTEC_EVENT_OCCURRED && hdr & SWITCHTEC_EVENT_EN_IRQ))
                return 0;