summaryrefslogtreecommitdiffstats
path: root/drivers/staging/rdma/hfi1/chip.c
diff options
context:
space:
mode:
authorDean Luick2016-02-18 20:13:01 +0100
committerDoug Ledford2016-03-11 02:45:45 +0100
commit582e05c3deeaf56ed04df62ad9f1fa6e88199bd9 (patch)
treefcb5c3388462932c584bff2725a1f9bc6820faf3 /drivers/staging/rdma/hfi1/chip.c
parentstaging/rdma/hfi1: Guard i2c access against cp (diff)
downloadkernel-qcow2-linux-582e05c3deeaf56ed04df62ad9f1fa6e88199bd9.tar.gz
kernel-qcow2-linux-582e05c3deeaf56ed04df62ad9f1fa6e88199bd9.tar.xz
kernel-qcow2-linux-582e05c3deeaf56ed04df62ad9f1fa6e88199bd9.zip
staging/rdma/hfi1: Fix counter read for cp
A cp or cat of /sys/kernel/debug/hfi1/hfi1_0/port1counters produces the following message: hfi1 0000:81:00.0: hfi1_0: index not supported hfi1 0000:81:00.0: hfi1_0: read_cntrs does not support indexing Fix by removing the file position logic and the associated messages and make the file positioning the responsibility of the caller. The port counter read function argument is changed to the per port data structure since the counters are relative to the port and not the device. Reviewed-by: Sebastian Sanchez <sebastian.sanchez@intel.com> Signed-off-by: Dean Luick <dean.luick@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/staging/rdma/hfi1/chip.c')
-rw-r--r--drivers/staging/rdma/hfi1/chip.c30
1 files changed, 5 insertions, 25 deletions
diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c
index 483b37ae698e..fe73ebf077e4 100644
--- a/drivers/staging/rdma/hfi1/chip.c
+++ b/drivers/staging/rdma/hfi1/chip.c
@@ -11407,28 +11407,19 @@ void hfi1_rcvctrl(struct hfi1_devdata *dd, unsigned int op, int ctxt)
dd->rcvhdrtail_dummy_physaddr);
}
-u32 hfi1_read_cntrs(struct hfi1_devdata *dd, loff_t pos, char **namep,
- u64 **cntrp)
+u32 hfi1_read_cntrs(struct hfi1_devdata *dd, char **namep, u64 **cntrp)
{
int ret;
u64 val = 0;
if (namep) {
ret = dd->cntrnameslen;
- if (pos != 0) {
- dd_dev_err(dd, "read_cntrs does not support indexing");
- return 0;
- }
*namep = dd->cntrnames;
} else {
const struct cntr_entry *entry;
int i, j;
ret = (dd->ndevcntrs) * sizeof(u64);
- if (pos != 0) {
- dd_dev_err(dd, "read_cntrs does not support indexing");
- return 0;
- }
/* Get the start of the block of counters */
*cntrp = dd->cntrs;
@@ -11487,30 +11478,19 @@ u32 hfi1_read_cntrs(struct hfi1_devdata *dd, loff_t pos, char **namep,
/*
* Used by sysfs to create files for hfi stats to read
*/
-u32 hfi1_read_portcntrs(struct hfi1_devdata *dd, loff_t pos, u32 port,
- char **namep, u64 **cntrp)
+u32 hfi1_read_portcntrs(struct hfi1_pportdata *ppd, char **namep, u64 **cntrp)
{
int ret;
u64 val = 0;
if (namep) {
- ret = dd->portcntrnameslen;
- if (pos != 0) {
- dd_dev_err(dd, "index not supported");
- return 0;
- }
- *namep = dd->portcntrnames;
+ ret = ppd->dd->portcntrnameslen;
+ *namep = ppd->dd->portcntrnames;
} else {
const struct cntr_entry *entry;
- struct hfi1_pportdata *ppd;
int i, j;
- ret = (dd->nportcntrs) * sizeof(u64);
- if (pos != 0) {
- dd_dev_err(dd, "indexing not supported");
- return 0;
- }
- ppd = (struct hfi1_pportdata *)(dd + 1 + port);
+ ret = ppd->dd->nportcntrs * sizeof(u64);
*cntrp = ppd->cntrs;
for (i = 0; i < PORT_CNTR_LAST; i++) {