aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/sysfs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-26 15:47:08 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-26 15:47:08 -0700
commit39b566eedbe9e35d38502cc5e62ef7abf1aff9c9 (patch)
tree114d963f3eb4e8aff401ed74ae0429aefc55c9fd /drivers/infiniband/core/sysfs.c
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6 (diff)
parentMerge branches 'cxgb3', 'endian', 'ipath', 'ipoib', 'iser', 'mad', 'misc', 'mlx4', 'mthca', 'nes' and 'sysfs' into for-next (diff)
downloadlinux-dev-39b566eedbe9e35d38502cc5e62ef7abf1aff9c9.tar.xz
linux-dev-39b566eedbe9e35d38502cc5e62ef7abf1aff9c9.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (30 commits) RDMA/cxgb3: Enforce required firmware IB/mlx4: Unregister IB device prior to CLOSE PORT command mlx4_core: Add link type autosensing mlx4_core: Don't perform SET_PORT command for Ethernet ports RDMA/nes: Handle MPA Reject message properly RDMA/nes: Improve use of PBLs RDMA/nes: Remove LLTX RDMA/nes: Inform hardware that asynchronous event has been handled RDMA/nes: Fix tmp_addr compilation warning RDMA/nes: Report correct vendor_id and vendor_part_id RDMA/nes: Update copyright to new legal entity and year RDMA/nes: Account for freed PBL after HW operation IB: Remove useless ibdev_is_alive() tests from sysfs code IB/sa_query: Fix AH leak due to update_sm_ah() race IB/mad: Fix ib_post_send_mad() returning 0 with no generate send comp IB/mad: initialize mad_agent_priv before putting on lists IB/mad: Fix null pointer dereference in local_completions() IB/mad: Fix RMPP header RRespTime manipulation IB/iser: Remove hard setting of path MTU mlx4_core: Add device IDs for MT25458 10GigE devices ...
Diffstat (limited to 'drivers/infiniband/core/sysfs.c')
-rw-r--r--drivers/infiniband/core/sysfs.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index b43f7d3682d3..5c04cfb54cb9 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -66,11 +66,6 @@ struct port_table_attribute {
int index;
};
-static inline int ibdev_is_alive(const struct ib_device *dev)
-{
- return dev->reg_state == IB_DEV_REGISTERED;
-}
-
static ssize_t port_attr_show(struct kobject *kobj,
struct attribute *attr, char *buf)
{
@@ -80,8 +75,6 @@ static ssize_t port_attr_show(struct kobject *kobj,
if (!port_attr->show)
return -EIO;
- if (!ibdev_is_alive(p->ibdev))
- return -ENODEV;
return port_attr->show(p, port_attr, buf);
}
@@ -562,9 +555,6 @@ static ssize_t show_node_type(struct device *device,
{
struct ib_device *dev = container_of(device, struct ib_device, dev);
- if (!ibdev_is_alive(dev))
- return -ENODEV;
-
switch (dev->node_type) {
case RDMA_NODE_IB_CA: return sprintf(buf, "%d: CA\n", dev->node_type);
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,
struct ib_device_attr attr;
ssize_t ret;
- if (!ibdev_is_alive(dev))
- return -ENODEV;
-
ret = ib_query_device(dev, &attr);
if (ret)
return ret;
@@ -600,9 +587,6 @@ static ssize_t show_node_guid(struct device *device,
{
struct ib_device *dev = container_of(device, struct ib_device, dev);
- if (!ibdev_is_alive(dev))
- return -ENODEV;
-
return sprintf(buf, "%04x:%04x:%04x:%04x\n",
be16_to_cpu(((__be16 *) &dev->node_guid)[0]),
be16_to_cpu(((__be16 *) &dev->node_guid)[1]),
@@ -848,6 +832,9 @@ void ib_device_unregister_sysfs(struct ib_device *device)
struct kobject *p, *t;
struct ib_port *port;
+ /* Hold kobject until ib_dealloc_device() */
+ kobject_get(&device->dev.kobj);
+
list_for_each_entry_safe(p, t, &device->port_list, entry) {
list_del(&p->entry);
port = container_of(p, struct ib_port, kobj);