i2c-eg20t: change timeout value 50msec to 1000msec
[zen-stable.git] / drivers / infiniband / hw / qib / qib_sysfs.c
blobdae51604cfcd24f287790467892d9960884905e0
1 /*
2 * Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved.
3 * Copyright (c) 2006 PathScale, Inc. All rights reserved.
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
33 #include <linux/ctype.h>
35 #include "qib.h"
37 /**
38 * qib_parse_ushort - parse an unsigned short value in an arbitrary base
39 * @str: the string containing the number
40 * @valp: where to put the result
42 * Returns the number of bytes consumed, or negative value on error.
44 static int qib_parse_ushort(const char *str, unsigned short *valp)
46 unsigned long val;
47 char *end;
48 int ret;
50 if (!isdigit(str[0])) {
51 ret = -EINVAL;
52 goto bail;
55 val = simple_strtoul(str, &end, 0);
57 if (val > 0xffff) {
58 ret = -EINVAL;
59 goto bail;
62 *valp = val;
64 ret = end + 1 - str;
65 if (ret == 0)
66 ret = -EINVAL;
68 bail:
69 return ret;
72 /* start of per-port functions */
74 * Get/Set heartbeat enable. OR of 1=enabled, 2=auto
76 static ssize_t show_hrtbt_enb(struct qib_pportdata *ppd, char *buf)
78 struct qib_devdata *dd = ppd->dd;
79 int ret;
81 ret = dd->f_get_ib_cfg(ppd, QIB_IB_CFG_HRTBT);
82 ret = scnprintf(buf, PAGE_SIZE, "%d\n", ret);
83 return ret;
86 static ssize_t store_hrtbt_enb(struct qib_pportdata *ppd, const char *buf,
87 size_t count)
89 struct qib_devdata *dd = ppd->dd;
90 int ret;
91 u16 val;
93 ret = qib_parse_ushort(buf, &val);
96 * Set the "intentional" heartbeat enable per either of
97 * "Enable" and "Auto", as these are normally set together.
98 * This bit is consulted when leaving loopback mode,
99 * because entering loopback mode overrides it and automatically
100 * disables heartbeat.
102 if (ret >= 0)
103 ret = dd->f_set_ib_cfg(ppd, QIB_IB_CFG_HRTBT, val);
104 if (ret < 0)
105 qib_dev_err(dd, "attempt to set invalid Heartbeat enable\n");
106 return ret < 0 ? ret : count;
109 static ssize_t store_loopback(struct qib_pportdata *ppd, const char *buf,
110 size_t count)
112 struct qib_devdata *dd = ppd->dd;
113 int ret = count, r;
115 r = dd->f_set_ib_loopback(ppd, buf);
116 if (r < 0)
117 ret = r;
119 return ret;
122 static ssize_t store_led_override(struct qib_pportdata *ppd, const char *buf,
123 size_t count)
125 struct qib_devdata *dd = ppd->dd;
126 int ret;
127 u16 val;
129 ret = qib_parse_ushort(buf, &val);
130 if (ret > 0)
131 qib_set_led_override(ppd, val);
132 else
133 qib_dev_err(dd, "attempt to set invalid LED override\n");
134 return ret < 0 ? ret : count;
137 static ssize_t show_status(struct qib_pportdata *ppd, char *buf)
139 ssize_t ret;
141 if (!ppd->statusp)
142 ret = -EINVAL;
143 else
144 ret = scnprintf(buf, PAGE_SIZE, "0x%llx\n",
145 (unsigned long long) *(ppd->statusp));
146 return ret;
150 * For userland compatibility, these offsets must remain fixed.
151 * They are strings for QIB_STATUS_*
153 static const char * const qib_status_str[] = {
154 "Initted",
159 "Present",
160 "IB_link_up",
161 "IB_configured",
163 "Fatal_Hardware_Error",
164 NULL,
167 static ssize_t show_status_str(struct qib_pportdata *ppd, char *buf)
169 int i, any;
170 u64 s;
171 ssize_t ret;
173 if (!ppd->statusp) {
174 ret = -EINVAL;
175 goto bail;
178 s = *(ppd->statusp);
179 *buf = '\0';
180 for (any = i = 0; s && qib_status_str[i]; i++) {
181 if (s & 1) {
182 /* if overflow */
183 if (any && strlcat(buf, " ", PAGE_SIZE) >= PAGE_SIZE)
184 break;
185 if (strlcat(buf, qib_status_str[i], PAGE_SIZE) >=
186 PAGE_SIZE)
187 break;
188 any = 1;
190 s >>= 1;
192 if (any)
193 strlcat(buf, "\n", PAGE_SIZE);
195 ret = strlen(buf);
197 bail:
198 return ret;
201 /* end of per-port functions */
204 * Start of per-port file structures and support code
205 * Because we are fitting into other infrastructure, we have to supply the
206 * full set of kobject/sysfs_ops structures and routines.
208 #define QIB_PORT_ATTR(name, mode, show, store) \
209 static struct qib_port_attr qib_port_attr_##name = \
210 __ATTR(name, mode, show, store)
212 struct qib_port_attr {
213 struct attribute attr;
214 ssize_t (*show)(struct qib_pportdata *, char *);
215 ssize_t (*store)(struct qib_pportdata *, const char *, size_t);
218 QIB_PORT_ATTR(loopback, S_IWUSR, NULL, store_loopback);
219 QIB_PORT_ATTR(led_override, S_IWUSR, NULL, store_led_override);
220 QIB_PORT_ATTR(hrtbt_enable, S_IWUSR | S_IRUGO, show_hrtbt_enb,
221 store_hrtbt_enb);
222 QIB_PORT_ATTR(status, S_IRUGO, show_status, NULL);
223 QIB_PORT_ATTR(status_str, S_IRUGO, show_status_str, NULL);
225 static struct attribute *port_default_attributes[] = {
226 &qib_port_attr_loopback.attr,
227 &qib_port_attr_led_override.attr,
228 &qib_port_attr_hrtbt_enable.attr,
229 &qib_port_attr_status.attr,
230 &qib_port_attr_status_str.attr,
231 NULL
234 static ssize_t qib_portattr_show(struct kobject *kobj,
235 struct attribute *attr, char *buf)
237 struct qib_port_attr *pattr =
238 container_of(attr, struct qib_port_attr, attr);
239 struct qib_pportdata *ppd =
240 container_of(kobj, struct qib_pportdata, pport_kobj);
242 return pattr->show(ppd, buf);
245 static ssize_t qib_portattr_store(struct kobject *kobj,
246 struct attribute *attr, const char *buf, size_t len)
248 struct qib_port_attr *pattr =
249 container_of(attr, struct qib_port_attr, attr);
250 struct qib_pportdata *ppd =
251 container_of(kobj, struct qib_pportdata, pport_kobj);
253 return pattr->store(ppd, buf, len);
256 static void qib_port_release(struct kobject *kobj)
258 /* nothing to do since memory is freed by qib_free_devdata() */
261 static const struct sysfs_ops qib_port_ops = {
262 .show = qib_portattr_show,
263 .store = qib_portattr_store,
266 static struct kobj_type qib_port_ktype = {
267 .release = qib_port_release,
268 .sysfs_ops = &qib_port_ops,
269 .default_attrs = port_default_attributes
272 /* Start sl2vl */
274 #define QIB_SL2VL_ATTR(N) \
275 static struct qib_sl2vl_attr qib_sl2vl_attr_##N = { \
276 .attr = { .name = __stringify(N), .mode = 0444 }, \
277 .sl = N \
280 struct qib_sl2vl_attr {
281 struct attribute attr;
282 int sl;
285 QIB_SL2VL_ATTR(0);
286 QIB_SL2VL_ATTR(1);
287 QIB_SL2VL_ATTR(2);
288 QIB_SL2VL_ATTR(3);
289 QIB_SL2VL_ATTR(4);
290 QIB_SL2VL_ATTR(5);
291 QIB_SL2VL_ATTR(6);
292 QIB_SL2VL_ATTR(7);
293 QIB_SL2VL_ATTR(8);
294 QIB_SL2VL_ATTR(9);
295 QIB_SL2VL_ATTR(10);
296 QIB_SL2VL_ATTR(11);
297 QIB_SL2VL_ATTR(12);
298 QIB_SL2VL_ATTR(13);
299 QIB_SL2VL_ATTR(14);
300 QIB_SL2VL_ATTR(15);
302 static struct attribute *sl2vl_default_attributes[] = {
303 &qib_sl2vl_attr_0.attr,
304 &qib_sl2vl_attr_1.attr,
305 &qib_sl2vl_attr_2.attr,
306 &qib_sl2vl_attr_3.attr,
307 &qib_sl2vl_attr_4.attr,
308 &qib_sl2vl_attr_5.attr,
309 &qib_sl2vl_attr_6.attr,
310 &qib_sl2vl_attr_7.attr,
311 &qib_sl2vl_attr_8.attr,
312 &qib_sl2vl_attr_9.attr,
313 &qib_sl2vl_attr_10.attr,
314 &qib_sl2vl_attr_11.attr,
315 &qib_sl2vl_attr_12.attr,
316 &qib_sl2vl_attr_13.attr,
317 &qib_sl2vl_attr_14.attr,
318 &qib_sl2vl_attr_15.attr,
319 NULL
322 static ssize_t sl2vl_attr_show(struct kobject *kobj, struct attribute *attr,
323 char *buf)
325 struct qib_sl2vl_attr *sattr =
326 container_of(attr, struct qib_sl2vl_attr, attr);
327 struct qib_pportdata *ppd =
328 container_of(kobj, struct qib_pportdata, sl2vl_kobj);
329 struct qib_ibport *qibp = &ppd->ibport_data;
331 return sprintf(buf, "%u\n", qibp->sl_to_vl[sattr->sl]);
334 static const struct sysfs_ops qib_sl2vl_ops = {
335 .show = sl2vl_attr_show,
338 static struct kobj_type qib_sl2vl_ktype = {
339 .release = qib_port_release,
340 .sysfs_ops = &qib_sl2vl_ops,
341 .default_attrs = sl2vl_default_attributes
344 /* End sl2vl */
346 /* Start diag_counters */
348 #define QIB_DIAGC_ATTR(N) \
349 static struct qib_diagc_attr qib_diagc_attr_##N = { \
350 .attr = { .name = __stringify(N), .mode = 0664 }, \
351 .counter = offsetof(struct qib_ibport, n_##N) \
354 struct qib_diagc_attr {
355 struct attribute attr;
356 size_t counter;
359 QIB_DIAGC_ATTR(rc_resends);
360 QIB_DIAGC_ATTR(rc_acks);
361 QIB_DIAGC_ATTR(rc_qacks);
362 QIB_DIAGC_ATTR(rc_delayed_comp);
363 QIB_DIAGC_ATTR(seq_naks);
364 QIB_DIAGC_ATTR(rdma_seq);
365 QIB_DIAGC_ATTR(rnr_naks);
366 QIB_DIAGC_ATTR(other_naks);
367 QIB_DIAGC_ATTR(rc_timeouts);
368 QIB_DIAGC_ATTR(loop_pkts);
369 QIB_DIAGC_ATTR(pkt_drops);
370 QIB_DIAGC_ATTR(dmawait);
371 QIB_DIAGC_ATTR(unaligned);
372 QIB_DIAGC_ATTR(rc_dupreq);
373 QIB_DIAGC_ATTR(rc_seqnak);
375 static struct attribute *diagc_default_attributes[] = {
376 &qib_diagc_attr_rc_resends.attr,
377 &qib_diagc_attr_rc_acks.attr,
378 &qib_diagc_attr_rc_qacks.attr,
379 &qib_diagc_attr_rc_delayed_comp.attr,
380 &qib_diagc_attr_seq_naks.attr,
381 &qib_diagc_attr_rdma_seq.attr,
382 &qib_diagc_attr_rnr_naks.attr,
383 &qib_diagc_attr_other_naks.attr,
384 &qib_diagc_attr_rc_timeouts.attr,
385 &qib_diagc_attr_loop_pkts.attr,
386 &qib_diagc_attr_pkt_drops.attr,
387 &qib_diagc_attr_dmawait.attr,
388 &qib_diagc_attr_unaligned.attr,
389 &qib_diagc_attr_rc_dupreq.attr,
390 &qib_diagc_attr_rc_seqnak.attr,
391 NULL
394 static ssize_t diagc_attr_show(struct kobject *kobj, struct attribute *attr,
395 char *buf)
397 struct qib_diagc_attr *dattr =
398 container_of(attr, struct qib_diagc_attr, attr);
399 struct qib_pportdata *ppd =
400 container_of(kobj, struct qib_pportdata, diagc_kobj);
401 struct qib_ibport *qibp = &ppd->ibport_data;
403 return sprintf(buf, "%u\n", *(u32 *)((char *)qibp + dattr->counter));
406 static ssize_t diagc_attr_store(struct kobject *kobj, struct attribute *attr,
407 const char *buf, size_t size)
409 struct qib_diagc_attr *dattr =
410 container_of(attr, struct qib_diagc_attr, attr);
411 struct qib_pportdata *ppd =
412 container_of(kobj, struct qib_pportdata, diagc_kobj);
413 struct qib_ibport *qibp = &ppd->ibport_data;
414 char *endp;
415 long val = simple_strtol(buf, &endp, 0);
417 if (val < 0 || endp == buf)
418 return -EINVAL;
420 *(u32 *)((char *) qibp + dattr->counter) = val;
421 return size;
424 static const struct sysfs_ops qib_diagc_ops = {
425 .show = diagc_attr_show,
426 .store = diagc_attr_store,
429 static struct kobj_type qib_diagc_ktype = {
430 .release = qib_port_release,
431 .sysfs_ops = &qib_diagc_ops,
432 .default_attrs = diagc_default_attributes
435 /* End diag_counters */
437 /* end of per-port file structures and support code */
440 * Start of per-unit (or driver, in some cases, but replicated
441 * per unit) functions (these get a device *)
443 static ssize_t show_rev(struct device *device, struct device_attribute *attr,
444 char *buf)
446 struct qib_ibdev *dev =
447 container_of(device, struct qib_ibdev, ibdev.dev);
449 return sprintf(buf, "%x\n", dd_from_dev(dev)->minrev);
452 static ssize_t show_hca(struct device *device, struct device_attribute *attr,
453 char *buf)
455 struct qib_ibdev *dev =
456 container_of(device, struct qib_ibdev, ibdev.dev);
457 struct qib_devdata *dd = dd_from_dev(dev);
458 int ret;
460 if (!dd->boardname)
461 ret = -EINVAL;
462 else
463 ret = scnprintf(buf, PAGE_SIZE, "%s\n", dd->boardname);
464 return ret;
467 static ssize_t show_version(struct device *device,
468 struct device_attribute *attr, char *buf)
470 /* The string printed here is already newline-terminated. */
471 return scnprintf(buf, PAGE_SIZE, "%s", (char *)ib_qib_version);
474 static ssize_t show_boardversion(struct device *device,
475 struct device_attribute *attr, char *buf)
477 struct qib_ibdev *dev =
478 container_of(device, struct qib_ibdev, ibdev.dev);
479 struct qib_devdata *dd = dd_from_dev(dev);
481 /* The string printed here is already newline-terminated. */
482 return scnprintf(buf, PAGE_SIZE, "%s", dd->boardversion);
486 static ssize_t show_localbus_info(struct device *device,
487 struct device_attribute *attr, char *buf)
489 struct qib_ibdev *dev =
490 container_of(device, struct qib_ibdev, ibdev.dev);
491 struct qib_devdata *dd = dd_from_dev(dev);
493 /* The string printed here is already newline-terminated. */
494 return scnprintf(buf, PAGE_SIZE, "%s", dd->lbus_info);
498 static ssize_t show_nctxts(struct device *device,
499 struct device_attribute *attr, char *buf)
501 struct qib_ibdev *dev =
502 container_of(device, struct qib_ibdev, ibdev.dev);
503 struct qib_devdata *dd = dd_from_dev(dev);
505 /* Return the number of user ports (contexts) available. */
506 return scnprintf(buf, PAGE_SIZE, "%u\n", dd->cfgctxts -
507 dd->first_user_ctxt);
510 static ssize_t show_nfreectxts(struct device *device,
511 struct device_attribute *attr, char *buf)
513 struct qib_ibdev *dev =
514 container_of(device, struct qib_ibdev, ibdev.dev);
515 struct qib_devdata *dd = dd_from_dev(dev);
517 /* Return the number of free user ports (contexts) available. */
518 return scnprintf(buf, PAGE_SIZE, "%u\n", dd->freectxts);
521 static ssize_t show_serial(struct device *device,
522 struct device_attribute *attr, char *buf)
524 struct qib_ibdev *dev =
525 container_of(device, struct qib_ibdev, ibdev.dev);
526 struct qib_devdata *dd = dd_from_dev(dev);
528 buf[sizeof dd->serial] = '\0';
529 memcpy(buf, dd->serial, sizeof dd->serial);
530 strcat(buf, "\n");
531 return strlen(buf);
534 static ssize_t store_chip_reset(struct device *device,
535 struct device_attribute *attr, const char *buf,
536 size_t count)
538 struct qib_ibdev *dev =
539 container_of(device, struct qib_ibdev, ibdev.dev);
540 struct qib_devdata *dd = dd_from_dev(dev);
541 int ret;
543 if (count < 5 || memcmp(buf, "reset", 5) || !dd->diag_client) {
544 ret = -EINVAL;
545 goto bail;
548 ret = qib_reset_device(dd->unit);
549 bail:
550 return ret < 0 ? ret : count;
553 static ssize_t show_logged_errs(struct device *device,
554 struct device_attribute *attr, char *buf)
556 struct qib_ibdev *dev =
557 container_of(device, struct qib_ibdev, ibdev.dev);
558 struct qib_devdata *dd = dd_from_dev(dev);
559 int idx, count;
561 /* force consistency with actual EEPROM */
562 if (qib_update_eeprom_log(dd) != 0)
563 return -ENXIO;
565 count = 0;
566 for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) {
567 count += scnprintf(buf + count, PAGE_SIZE - count, "%d%c",
568 dd->eep_st_errs[idx],
569 idx == (QIB_EEP_LOG_CNT - 1) ? '\n' : ' ');
572 return count;
576 * Dump tempsense regs. in decimal, to ease shell-scripts.
578 static ssize_t show_tempsense(struct device *device,
579 struct device_attribute *attr, char *buf)
581 struct qib_ibdev *dev =
582 container_of(device, struct qib_ibdev, ibdev.dev);
583 struct qib_devdata *dd = dd_from_dev(dev);
584 int ret;
585 int idx;
586 u8 regvals[8];
588 ret = -ENXIO;
589 for (idx = 0; idx < 8; ++idx) {
590 if (idx == 6)
591 continue;
592 ret = dd->f_tempsense_rd(dd, idx);
593 if (ret < 0)
594 break;
595 regvals[idx] = ret;
597 if (idx == 8)
598 ret = scnprintf(buf, PAGE_SIZE, "%d %d %02X %02X %d %d\n",
599 *(signed char *)(regvals),
600 *(signed char *)(regvals + 1),
601 regvals[2], regvals[3],
602 *(signed char *)(regvals + 5),
603 *(signed char *)(regvals + 7));
604 return ret;
608 * end of per-unit (or driver, in some cases, but replicated
609 * per unit) functions
612 /* start of per-unit file structures and support code */
613 static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL);
614 static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL);
615 static DEVICE_ATTR(board_id, S_IRUGO, show_hca, NULL);
616 static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
617 static DEVICE_ATTR(nctxts, S_IRUGO, show_nctxts, NULL);
618 static DEVICE_ATTR(nfreectxts, S_IRUGO, show_nfreectxts, NULL);
619 static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL);
620 static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL);
621 static DEVICE_ATTR(logged_errors, S_IRUGO, show_logged_errs, NULL);
622 static DEVICE_ATTR(tempsense, S_IRUGO, show_tempsense, NULL);
623 static DEVICE_ATTR(localbus_info, S_IRUGO, show_localbus_info, NULL);
624 static DEVICE_ATTR(chip_reset, S_IWUSR, NULL, store_chip_reset);
626 static struct device_attribute *qib_attributes[] = {
627 &dev_attr_hw_rev,
628 &dev_attr_hca_type,
629 &dev_attr_board_id,
630 &dev_attr_version,
631 &dev_attr_nctxts,
632 &dev_attr_nfreectxts,
633 &dev_attr_serial,
634 &dev_attr_boardversion,
635 &dev_attr_logged_errors,
636 &dev_attr_tempsense,
637 &dev_attr_localbus_info,
638 &dev_attr_chip_reset,
641 int qib_create_port_files(struct ib_device *ibdev, u8 port_num,
642 struct kobject *kobj)
644 struct qib_pportdata *ppd;
645 struct qib_devdata *dd = dd_from_ibdev(ibdev);
646 int ret;
648 if (!port_num || port_num > dd->num_pports) {
649 qib_dev_err(dd, "Skipping infiniband class with "
650 "invalid port %u\n", port_num);
651 ret = -ENODEV;
652 goto bail;
654 ppd = &dd->pport[port_num - 1];
656 ret = kobject_init_and_add(&ppd->pport_kobj, &qib_port_ktype, kobj,
657 "linkcontrol");
658 if (ret) {
659 qib_dev_err(dd, "Skipping linkcontrol sysfs info, "
660 "(err %d) port %u\n", ret, port_num);
661 goto bail;
663 kobject_uevent(&ppd->pport_kobj, KOBJ_ADD);
665 ret = kobject_init_and_add(&ppd->sl2vl_kobj, &qib_sl2vl_ktype, kobj,
666 "sl2vl");
667 if (ret) {
668 qib_dev_err(dd, "Skipping sl2vl sysfs info, "
669 "(err %d) port %u\n", ret, port_num);
670 goto bail_sl;
672 kobject_uevent(&ppd->sl2vl_kobj, KOBJ_ADD);
674 ret = kobject_init_and_add(&ppd->diagc_kobj, &qib_diagc_ktype, kobj,
675 "diag_counters");
676 if (ret) {
677 qib_dev_err(dd, "Skipping diag_counters sysfs info, "
678 "(err %d) port %u\n", ret, port_num);
679 goto bail_diagc;
681 kobject_uevent(&ppd->diagc_kobj, KOBJ_ADD);
683 return 0;
685 bail_diagc:
686 kobject_put(&ppd->sl2vl_kobj);
687 bail_sl:
688 kobject_put(&ppd->pport_kobj);
689 bail:
690 return ret;
694 * Register and create our files in /sys/class/infiniband.
696 int qib_verbs_register_sysfs(struct qib_devdata *dd)
698 struct ib_device *dev = &dd->verbs_dev.ibdev;
699 int i, ret;
701 for (i = 0; i < ARRAY_SIZE(qib_attributes); ++i) {
702 ret = device_create_file(&dev->dev, qib_attributes[i]);
703 if (ret)
704 return ret;
707 return 0;
711 * Unregister and remove our files in /sys/class/infiniband.
713 void qib_verbs_unregister_sysfs(struct qib_devdata *dd)
715 struct qib_pportdata *ppd;
716 int i;
718 for (i = 0; i < dd->num_pports; i++) {
719 ppd = &dd->pport[i];
720 kobject_put(&ppd->pport_kobj);
721 kobject_put(&ppd->sl2vl_kobj);