diff options
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/qib/qib_init.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_sysfs.c | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c index cf0cd30adc8d..dc14e100a7f1 100644 --- a/drivers/infiniband/hw/qib/qib_init.c +++ b/drivers/infiniband/hw/qib/qib_init.c | |||
@@ -102,6 +102,8 @@ void qib_set_ctxtcnt(struct qib_devdata *dd) | |||
102 | dd->cfgctxts = qib_cfgctxts; | 102 | dd->cfgctxts = qib_cfgctxts; |
103 | else | 103 | else |
104 | dd->cfgctxts = dd->ctxtcnt; | 104 | dd->cfgctxts = dd->ctxtcnt; |
105 | dd->freectxts = (dd->first_user_ctxt > dd->cfgctxts) ? 0 : | ||
106 | dd->cfgctxts - dd->first_user_ctxt; | ||
105 | } | 107 | } |
106 | 108 | ||
107 | /* | 109 | /* |
@@ -402,7 +404,6 @@ static void enable_chip(struct qib_devdata *dd) | |||
402 | if (rcd) | 404 | if (rcd) |
403 | dd->f_rcvctrl(rcd->ppd, rcvmask, i); | 405 | dd->f_rcvctrl(rcd->ppd, rcvmask, i); |
404 | } | 406 | } |
405 | dd->freectxts = dd->cfgctxts - dd->first_user_ctxt; | ||
406 | } | 407 | } |
407 | 408 | ||
408 | static void verify_interrupt(unsigned long opaque) | 409 | static void verify_interrupt(unsigned long opaque) |
diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c index dae51604cfcd..dd9cd49d0979 100644 --- a/drivers/infiniband/hw/qib/qib_sysfs.c +++ b/drivers/infiniband/hw/qib/qib_sysfs.c | |||
@@ -503,8 +503,11 @@ static ssize_t show_nctxts(struct device *device, | |||
503 | struct qib_devdata *dd = dd_from_dev(dev); | 503 | struct qib_devdata *dd = dd_from_dev(dev); |
504 | 504 | ||
505 | /* Return the number of user ports (contexts) available. */ | 505 | /* Return the number of user ports (contexts) available. */ |
506 | return scnprintf(buf, PAGE_SIZE, "%u\n", dd->cfgctxts - | 506 | /* The calculation below deals with a special case where |
507 | dd->first_user_ctxt); | 507 | * cfgctxts is set to 1 on a single-port board. */ |
508 | return scnprintf(buf, PAGE_SIZE, "%u\n", | ||
509 | (dd->first_user_ctxt > dd->cfgctxts) ? 0 : | ||
510 | (dd->cfgctxts - dd->first_user_ctxt)); | ||
508 | } | 511 | } |
509 | 512 | ||
510 | static ssize_t show_nfreectxts(struct device *device, | 513 | static ssize_t show_nfreectxts(struct device *device, |