aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2009-03-04 18:22:39 -0500
committerRoland Dreier <rolandd@cisco.com>2009-03-04 18:22:39 -0500
commit6432f366842c78d17b2df974c68f39cb5794f2c2 (patch)
tree1eae97fdf35e8344face61d4eea8ffcc237c7c3d /drivers/infiniband/core
parent9206dff15705267c19f8fed391c4fb95975540a3 (diff)
IB: Remove useless ibdev_is_alive() tests from sysfs code
Some attribute show functions test ibdev_is_alive() to make sure that it's OK to access device state. However, the sysfs attributes will not be registered until the device is fully initialized, and they'll be unregistered before anything is torn down, so ibdev_is_alive() doesn't do anything useful. Remove it. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r--drivers/infiniband/core/sysfs.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 5270aeb56e9e..5c04cfb54cb9 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -66,11 +66,6 @@ struct port_table_attribute {
66 int index; 66 int index;
67}; 67};
68 68
69static inline int ibdev_is_alive(const struct ib_device *dev)
70{
71 return dev->reg_state == IB_DEV_REGISTERED;
72}
73
74static ssize_t port_attr_show(struct kobject *kobj, 69static ssize_t port_attr_show(struct kobject *kobj,
75 struct attribute *attr, char *buf) 70 struct attribute *attr, char *buf)
76{ 71{
@@ -80,8 +75,6 @@ static ssize_t port_attr_show(struct kobject *kobj,
80 75
81 if (!port_attr->show) 76 if (!port_attr->show)
82 return -EIO; 77 return -EIO;
83 if (!ibdev_is_alive(p->ibdev))
84 return -ENODEV;
85 78
86 return port_attr->show(p, port_attr, buf); 79 return port_attr->show(p, port_attr, buf);
87} 80}
@@ -562,9 +555,6 @@ static ssize_t show_node_type(struct device *device,
562{ 555{
563 struct ib_device *dev = container_of(device, struct ib_device, dev); 556 struct ib_device *dev = container_of(device, struct ib_device, dev);
564 557
565 if (!ibdev_is_alive(dev))
566 return -ENODEV;
567
568 switch (dev->node_type) { 558 switch (dev->node_type) {
569 case RDMA_NODE_IB_CA: return sprintf(buf, "%d: CA\n", dev->node_type); 559 case RDMA_NODE_IB_CA: return sprintf(buf, "%d: CA\n", dev->node_type);
570 case RDMA_NODE_RNIC: return sprintf(buf, "%d: RNIC\n", dev->node_type); 560 case RDMA_NODE_RNIC: return sprintf(buf, "%d: RNIC\n", dev->node_type);
@@ -581,9 +571,6 @@ static ssize_t show_sys_image_guid(struct device *device,
581 struct ib_device_attr attr; 571 struct ib_device_attr attr;
582 ssize_t ret; 572 ssize_t ret;
583 573
584 if (!ibdev_is_alive(dev))
585 return -ENODEV;
586
587 ret = ib_query_device(dev, &attr); 574 ret = ib_query_device(dev, &attr);
588 if (ret) 575 if (ret)
589 return ret; 576 return ret;
@@ -600,9 +587,6 @@ static ssize_t show_node_guid(struct device *device,
600{ 587{
601 struct ib_device *dev = container_of(device, struct ib_device, dev); 588 struct ib_device *dev = container_of(device, struct ib_device, dev);
602 589
603 if (!ibdev_is_alive(dev))
604 return -ENODEV;
605
606 return sprintf(buf, "%04x:%04x:%04x:%04x\n", 590 return sprintf(buf, "%04x:%04x:%04x:%04x\n",
607 be16_to_cpu(((__be16 *) &dev->node_guid)[0]), 591 be16_to_cpu(((__be16 *) &dev->node_guid)[0]),
608 be16_to_cpu(((__be16 *) &dev->node_guid)[1]), 592 be16_to_cpu(((__be16 *) &dev->node_guid)[1]),