IB: Set class_dev->dev in core for nice device symlink
authorJoachim Fenkes <fenkes@de.ibm.com>
Mon, 23 Apr 2007 16:20:27 +0000 (18:20 +0200)
committerRoland Dreier <rolandd@cisco.com>
Wed, 25 Apr 2007 04:30:38 +0000 (21:30 -0700)
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: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/sysfs.c
drivers/infiniband/hw/amso1100/c2_provider.c
drivers/infiniband/hw/cxgb3/iwch_provider.c
drivers/infiniband/hw/ipath/ipath_verbs.c
drivers/infiniband/hw/mthca/mthca_provider.c

index 000c086bf2e9bf9d6ec0e8d90e7d9c5cec7fc4ec..08c299ebf4a8b5da88872c9116782ce5dd91c3ec 100644 (file)
@@ -683,6 +683,7 @@ int ib_device_register_sysfs(struct ib_device *device)
 
        class_dev->class      = &ib_class;
        class_dev->class_data = device;
+       class_dev->dev        = device->dma_device;
        strlcpy(class_dev->class_id, device->name, BUS_ID_SIZE);
 
        INIT_LIST_HEAD(&device->port_list);
index fef972752912f821a035bca8c03bbb4e18db6b90..607c09bf764c5d514d87f8e265ea0717314ba24f 100644 (file)
@@ -796,7 +796,6 @@ int c2_register_device(struct c2_dev *dev)
        memcpy(&dev->ibdev.node_guid, dev->pseudo_netdev->dev_addr, 6);
        dev->ibdev.phys_port_cnt = 1;
        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_port = c2_query_port;
        dev->ibdev.modify_port = c2_modify_port;
index 24e0df04f7dbcc01310666924db6cc3204c4ee7f..af28a317016d058b3a824783126e7a4d209e1646 100644 (file)
@@ -1108,7 +1108,6 @@ int iwch_register_device(struct iwch_dev *dev)
        memcpy(dev->ibdev.node_desc, IWCH_NODE_DESC, sizeof(IWCH_NODE_DESC));
        dev->ibdev.phys_port_cnt = dev->rdev.port_info.nports;
        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_port = iwch_query_port;
        dev->ibdev.modify_port = iwch_modify_port;
index f5604b876500a8d203240757743ae093aaadbb3c..18c6df2052c2533cae5726e31ebcb60d47b2e8aa 100644 (file)
@@ -1559,7 +1559,6 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
        dev->node_type = RDMA_NODE_IB_CA;
        dev->phys_port_cnt = 1;
        dev->dma_device = &dd->pcidev->dev;
-       dev->class_dev.dev = dev->dma_device;
        dev->query_device = ipath_query_device;
        dev->modify_device = ipath_modify_device;
        dev->query_port = ipath_query_port;
index 0725ad7ad9bf7ca43b31f96609311bb2defbfea9..47e6fd46d9c27ca219e1b5ae97ee4833a31ab74f 100644 (file)
@@ -1293,7 +1293,6 @@ int mthca_register_device(struct mthca_dev *dev)
        dev->ib_dev.node_type            = RDMA_NODE_IB_CA;
        dev->ib_dev.phys_port_cnt        = dev->limits.num_ports;
        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_port           = mthca_query_port;
        dev->ib_dev.modify_device        = mthca_modify_device;