aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/core/sysfs.c')
-rw-r--r--drivers/infiniband/core/sysfs.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 1f1743c5c9a..5982d687a00 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -445,13 +445,7 @@ static int ib_device_uevent(struct class_device *cdev, char **envp,
445 return -ENOMEM; 445 return -ENOMEM;
446 446
447 /* 447 /*
448 * It might be nice to pass the node GUID with the event, but 448 * It would be nice to pass the node GUID with the event...
449 * right now the only way to get it is to query the device
450 * provider, and this can crash during device removal because
451 * we are will be running after driver removal has started.
452 * We could add a node_guid field to struct ib_device, or we
453 * could just let userspace read the node GUID from sysfs when
454 * devices are added.
455 */ 449 */
456 450
457 envp[i] = NULL; 451 envp[i] = NULL;
@@ -623,21 +617,15 @@ static ssize_t show_sys_image_guid(struct class_device *cdev, char *buf)
623static ssize_t show_node_guid(struct class_device *cdev, char *buf) 617static ssize_t show_node_guid(struct class_device *cdev, char *buf)
624{ 618{
625 struct ib_device *dev = container_of(cdev, struct ib_device, class_dev); 619 struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);
626 struct ib_device_attr attr;
627 ssize_t ret;
628 620
629 if (!ibdev_is_alive(dev)) 621 if (!ibdev_is_alive(dev))
630 return -ENODEV; 622 return -ENODEV;
631 623
632 ret = ib_query_device(dev, &attr);
633 if (ret)
634 return ret;
635
636 return sprintf(buf, "%04x:%04x:%04x:%04x\n", 624 return sprintf(buf, "%04x:%04x:%04x:%04x\n",
637 be16_to_cpu(((__be16 *) &attr.node_guid)[0]), 625 be16_to_cpu(((__be16 *) &dev->node_guid)[0]),
638 be16_to_cpu(((__be16 *) &attr.node_guid)[1]), 626 be16_to_cpu(((__be16 *) &dev->node_guid)[1]),
639 be16_to_cpu(((__be16 *) &attr.node_guid)[2]), 627 be16_to_cpu(((__be16 *) &dev->node_guid)[2]),
640 be16_to_cpu(((__be16 *) &attr.node_guid)[3])); 628 be16_to_cpu(((__be16 *) &dev->node_guid)[3]));
641} 629}
642 630
643static CLASS_DEVICE_ATTR(node_type, S_IRUGO, show_node_type, NULL); 631static CLASS_DEVICE_ATTR(node_type, S_IRUGO, show_node_type, NULL);