Commit 1912ffbb authored by Joachim Fenkes's avatar Joachim Fenkes Committed by Roland Dreier

IB: Set class_dev->dev in core for nice device symlink

All RDMA drivers except ehca set class_dev->dev to their dma_device
value (ehca leaves this unset).  dma_device is the only value that
makes any sense, so move this assignment to core/sysfs.c.  This reduce
the duplicated code in the rest of the drivers and gives ehca a nice
/sys/class/infiniband/ehcaX/device symlink.
Signed-off-by: default avatarJoachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent c4ed790d
...@@ -683,6 +683,7 @@ int ib_device_register_sysfs(struct ib_device *device) ...@@ -683,6 +683,7 @@ int ib_device_register_sysfs(struct ib_device *device)
class_dev->class = &ib_class; class_dev->class = &ib_class;
class_dev->class_data = device; class_dev->class_data = device;
class_dev->dev = device->dma_device;
strlcpy(class_dev->class_id, device->name, BUS_ID_SIZE); strlcpy(class_dev->class_id, device->name, BUS_ID_SIZE);
INIT_LIST_HEAD(&device->port_list); INIT_LIST_HEAD(&device->port_list);
......
...@@ -796,7 +796,6 @@ int c2_register_device(struct c2_dev *dev) ...@@ -796,7 +796,6 @@ int c2_register_device(struct c2_dev *dev)
memcpy(&dev->ibdev.node_guid, dev->pseudo_netdev->dev_addr, 6); memcpy(&dev->ibdev.node_guid, dev->pseudo_netdev->dev_addr, 6);
dev->ibdev.phys_port_cnt = 1; dev->ibdev.phys_port_cnt = 1;
dev->ibdev.dma_device = &dev->pcidev->dev; dev->ibdev.dma_device = &dev->pcidev->dev;
dev->ibdev.class_dev.dev = &dev->pcidev->dev;
dev->ibdev.query_device = c2_query_device; dev->ibdev.query_device = c2_query_device;
dev->ibdev.query_port = c2_query_port; dev->ibdev.query_port = c2_query_port;
dev->ibdev.modify_port = c2_modify_port; dev->ibdev.modify_port = c2_modify_port;
......
...@@ -1108,7 +1108,6 @@ int iwch_register_device(struct iwch_dev *dev) ...@@ -1108,7 +1108,6 @@ int iwch_register_device(struct iwch_dev *dev)
memcpy(dev->ibdev.node_desc, IWCH_NODE_DESC, sizeof(IWCH_NODE_DESC)); memcpy(dev->ibdev.node_desc, IWCH_NODE_DESC, sizeof(IWCH_NODE_DESC));
dev->ibdev.phys_port_cnt = dev->rdev.port_info.nports; dev->ibdev.phys_port_cnt = dev->rdev.port_info.nports;
dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev); dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev);
dev->ibdev.class_dev.dev = &(dev->rdev.rnic_info.pdev->dev);
dev->ibdev.query_device = iwch_query_device; dev->ibdev.query_device = iwch_query_device;
dev->ibdev.query_port = iwch_query_port; dev->ibdev.query_port = iwch_query_port;
dev->ibdev.modify_port = iwch_modify_port; dev->ibdev.modify_port = iwch_modify_port;
......
...@@ -1559,7 +1559,6 @@ int ipath_register_ib_device(struct ipath_devdata *dd) ...@@ -1559,7 +1559,6 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
dev->node_type = RDMA_NODE_IB_CA; dev->node_type = RDMA_NODE_IB_CA;
dev->phys_port_cnt = 1; dev->phys_port_cnt = 1;
dev->dma_device = &dd->pcidev->dev; dev->dma_device = &dd->pcidev->dev;
dev->class_dev.dev = dev->dma_device;
dev->query_device = ipath_query_device; dev->query_device = ipath_query_device;
dev->modify_device = ipath_modify_device; dev->modify_device = ipath_modify_device;
dev->query_port = ipath_query_port; dev->query_port = ipath_query_port;
......
...@@ -1293,7 +1293,6 @@ int mthca_register_device(struct mthca_dev *dev) ...@@ -1293,7 +1293,6 @@ int mthca_register_device(struct mthca_dev *dev)
dev->ib_dev.node_type = RDMA_NODE_IB_CA; dev->ib_dev.node_type = RDMA_NODE_IB_CA;
dev->ib_dev.phys_port_cnt = dev->limits.num_ports; dev->ib_dev.phys_port_cnt = dev->limits.num_ports;
dev->ib_dev.dma_device = &dev->pdev->dev; dev->ib_dev.dma_device = &dev->pdev->dev;
dev->ib_dev.class_dev.dev = &dev->pdev->dev;
dev->ib_dev.query_device = mthca_query_device; dev->ib_dev.query_device = mthca_query_device;
dev->ib_dev.query_port = mthca_query_port; dev->ib_dev.query_port = mthca_query_port;
dev->ib_dev.modify_device = mthca_modify_device; dev->ib_dev.modify_device = mthca_modify_device;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment