diff options
| -rw-r--r-- | drivers/infiniband/hw/qib/qib_fs.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c index 755470440ef1..edef8527eb34 100644 --- a/drivers/infiniband/hw/qib/qib_fs.c +++ b/drivers/infiniband/hw/qib/qib_fs.c | |||
| @@ -144,10 +144,11 @@ static ssize_t dev_counters_read(struct file *file, char __user *buf, | |||
| 144 | size_t count, loff_t *ppos) | 144 | size_t count, loff_t *ppos) |
| 145 | { | 145 | { |
| 146 | u64 *counters; | 146 | u64 *counters; |
| 147 | size_t avail; | ||
| 147 | struct qib_devdata *dd = private2dd(file); | 148 | struct qib_devdata *dd = private2dd(file); |
| 148 | 149 | ||
| 149 | return simple_read_from_buffer(buf, count, ppos, counters, | 150 | avail = dd->f_read_cntrs(dd, *ppos, NULL, &counters); |
| 150 | dd->f_read_cntrs(dd, *ppos, NULL, &counters)); | 151 | return simple_read_from_buffer(buf, count, ppos, counters, avail); |
| 151 | } | 152 | } |
| 152 | 153 | ||
| 153 | /* read the per-device counters */ | 154 | /* read the per-device counters */ |
| @@ -155,10 +156,11 @@ static ssize_t dev_names_read(struct file *file, char __user *buf, | |||
| 155 | size_t count, loff_t *ppos) | 156 | size_t count, loff_t *ppos) |
| 156 | { | 157 | { |
| 157 | char *names; | 158 | char *names; |
| 159 | size_t avail; | ||
| 158 | struct qib_devdata *dd = private2dd(file); | 160 | struct qib_devdata *dd = private2dd(file); |
| 159 | 161 | ||
| 160 | return simple_read_from_buffer(buf, count, ppos, names, | 162 | avail = dd->f_read_cntrs(dd, *ppos, &names, NULL); |
| 161 | dd->f_read_cntrs(dd, *ppos, &names, NULL)); | 163 | return simple_read_from_buffer(buf, count, ppos, names, avail); |
| 162 | } | 164 | } |
| 163 | 165 | ||
| 164 | static const struct file_operations cntr_ops[] = { | 166 | static const struct file_operations cntr_ops[] = { |
| @@ -176,10 +178,11 @@ static ssize_t portnames_read(struct file *file, char __user *buf, | |||
| 176 | size_t count, loff_t *ppos) | 178 | size_t count, loff_t *ppos) |
| 177 | { | 179 | { |
| 178 | char *names; | 180 | char *names; |
| 181 | size_t avail; | ||
| 179 | struct qib_devdata *dd = private2dd(file); | 182 | struct qib_devdata *dd = private2dd(file); |
| 180 | 183 | ||
| 181 | return simple_read_from_buffer(buf, count, ppos, names, | 184 | avail = dd->f_read_portcntrs(dd, *ppos, 0, &names, NULL); |
| 182 | dd->f_read_portcntrs(dd, *ppos, 0, &names, NULL)); | 185 | return simple_read_from_buffer(buf, count, ppos, names, avail); |
| 183 | } | 186 | } |
| 184 | 187 | ||
| 185 | /* read the per-port counters for port 1 (pidx 0) */ | 188 | /* read the per-port counters for port 1 (pidx 0) */ |
| @@ -187,10 +190,11 @@ static ssize_t portcntrs_1_read(struct file *file, char __user *buf, | |||
| 187 | size_t count, loff_t *ppos) | 190 | size_t count, loff_t *ppos) |
| 188 | { | 191 | { |
| 189 | u64 *counters; | 192 | u64 *counters; |
| 193 | size_t avail; | ||
| 190 | struct qib_devdata *dd = private2dd(file); | 194 | struct qib_devdata *dd = private2dd(file); |
| 191 | 195 | ||
| 192 | return simple_read_from_buffer(buf, count, ppos, counters, | 196 | avail = dd->f_read_portcntrs(dd, *ppos, 0, NULL, &counters); |
| 193 | dd->f_read_portcntrs(dd, *ppos, 0, NULL, &counters)); | 197 | return simple_read_from_buffer(buf, count, ppos, counters, avail); |
| 194 | } | 198 | } |
| 195 | 199 | ||
| 196 | /* read the per-port counters for port 2 (pidx 1) */ | 200 | /* read the per-port counters for port 2 (pidx 1) */ |
| @@ -198,10 +202,11 @@ static ssize_t portcntrs_2_read(struct file *file, char __user *buf, | |||
| 198 | size_t count, loff_t *ppos) | 202 | size_t count, loff_t *ppos) |
| 199 | { | 203 | { |
| 200 | u64 *counters; | 204 | u64 *counters; |
| 205 | size_t avail; | ||
| 201 | struct qib_devdata *dd = private2dd(file); | 206 | struct qib_devdata *dd = private2dd(file); |
| 202 | 207 | ||
| 203 | return simple_read_from_buffer(buf, count, ppos, counters, | 208 | avail = dd->f_read_portcntrs(dd, *ppos, 1, NULL, &counters); |
| 204 | dd->f_read_portcntrs(dd, *ppos, 1, NULL, &counters)); | 209 | return simple_read_from_buffer(buf, count, ppos, counters, avail); |
| 205 | } | 210 | } |
| 206 | 211 | ||
| 207 | static const struct file_operations portcntr_ops[] = { | 212 | static const struct file_operations portcntr_ops[] = { |
