* [PATCH] ib_core: Add missing device link to class device
@ 2007-04-23 16:20 Joachim Fenkes
2007-04-23 19:17 ` Roland Dreier
0 siblings, 1 reply; 4+ messages in thread
From: Joachim Fenkes @ 2007-04-23 16:20 UTC (permalink / raw)
To: LinuxPPC-Dev, LKML, OF-General, Roland Dreier
Add the missing device link from /sys/class/infiniband/* to the actual devi=
ce.
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
=2D--
sysfs.c | 1 +
1 file changed, 1 insertion(+)
=2D-- linux-2.6.20/drivers/infiniband/core/sysfs.c.old 2007-04-23 15:37:=
37.000000000 +0200
+++ linux-2.6.20/drivers/infiniband/core/sysfs.c 2007-04-23 15:38:22=
=2E000000000 +0200
@@ -683,6 +683,7 @@ int ib_device_register_sysfs(struct ib_d
class_dev->class =3D &ib_class;
class_dev->class_data =3D device;
+ class_dev->dev =3D device->dma_device;
strlcpy(class_dev->class_id, device->name, BUS_ID_SIZE);
INIT_LIST_HEAD(&device->port_list);
=2D-=20
Joachim Fenkes =A0-- =A0eHCA Linux Driver Developer and Hardware Tamer
IBM Deutschland Entwicklung GmbH =A0-- =A0Dept. 3627 (I/O Firmware Dev. 2)
Schoenaicher Strasse 220 =A0-- =A071032 Boeblingen =A0-- =A0Germany
eMail: fenkes@de.ibm.com =A0-- =A0Phone: +49 7031 16 1239
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ib_core: Add missing device link to class device
2007-04-23 16:20 [PATCH] ib_core: Add missing device link to class device Joachim Fenkes
@ 2007-04-23 19:17 ` Roland Dreier
2007-04-24 12:06 ` Joachim Fenkes
0 siblings, 1 reply; 4+ messages in thread
From: Roland Dreier @ 2007-04-23 19:17 UTC (permalink / raw)
To: Joachim Fenkes; +Cc: LinuxPPC-Dev, LKML, OF-General
Hmm, I have links like this on my system already:
$ ls -l /sys/class/infiniband/mlx4_0/device
lrwxrwxrwx 1 root root 0 2007-04-23 12:14 /sys/class/infiniband/mlx4_0/device -> ../../../devices/pci0000:00/0000:00:06.0/0000:0d:00.0
the patch actually looks sane but I don't understand why it's needed.
Could you explain?
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ib_core: Add missing device link to class device
2007-04-23 19:17 ` Roland Dreier
@ 2007-04-24 12:06 ` Joachim Fenkes
2007-04-24 18:27 ` Roland Dreier
0 siblings, 1 reply; 4+ messages in thread
From: Joachim Fenkes @ 2007-04-24 12:06 UTC (permalink / raw)
To: Roland Dreier; +Cc: LinuxPPC-Dev, LKML, OF-General
Roland Dreier <rdreier@cisco.com> wrote on 23.04.2007 21:17:48:
> Hmm, I have links like this on my system already:
>
> the patch actually looks sane but I don't understand why it's needed.
> Could you explain?
I had a look at the kernel code -- currently, all device drivers except
ehca do this by themselves:
cxgb3:
1110 dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev);
1111 dev->ibdev.class_dev.dev = &(dev->rdev.rnic_info.pdev->dev);
amso1100:
798 dev->ibdev.dma_device = &dev->pcidev->dev;
799 dev->ibdev.class_dev.dev = &dev->pcidev->dev;
ipath:
1559 dev->dma_device = &dd->pcidev->dev;
1560 dev->class_dev.dev = dev->dma_device;
mthca:
1295 dev->ib_dev.dma_device = &dev->pdev->dev;
1296 dev->ib_dev.class_dev.dev = &dev->pdev->dev;
So I think it makes a lot of sense to put the class_dev.dev assignment
into generic ib_core code instead of repeating it in all the drivers.
The respective lines could move out of the drivers in the future but
won't hurt anyone until then.
What's your take on this?
Cheers,
Joachim
---
Joachim Fenkes -- eHCA Linux Driver Developer and Hardware Tamer
IBM Deutschland Entwicklung GmbH -- Dept. 3627 (I/O Firmware Dev. 2)
Schoenaicher Strasse 220 -- 71032 Boeblingen -- Germany
eMail: fenkes@de.ibm.com -- Phone: +49 7031 16 1239
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ib_core: Add missing device link to class device
2007-04-24 12:06 ` Joachim Fenkes
@ 2007-04-24 18:27 ` Roland Dreier
0 siblings, 0 replies; 4+ messages in thread
From: Roland Dreier @ 2007-04-24 18:27 UTC (permalink / raw)
To: Joachim Fenkes; +Cc: LinuxPPC-Dev, LKML, OF-General
> I had a look at the kernel code -- currently, all device drivers except
> ehca do this by themselves:
> So I think it makes a lot of sense to put the class_dev.dev assignment
> into generic ib_core code instead of repeating it in all the drivers.
> The respective lines could move out of the drivers in the future but
> won't hurt anyone until then.
Actually I think we should delete the duplicate code now while merging
this. So I queued this up for 2.6.22:
commit f19c8d7cbe3153d68f0a559afd02f66655310238
Author: Joachim Fenkes <fenkes@de.ibm.com>
Date: Mon Apr 23 18:20:27 2007 +0200
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: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 000c086..08c299e 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -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);
diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c b/drivers/infiniband/hw/amso1100/c2_provider.c
index fef9727..607c09b 100644
--- a/drivers/infiniband/hw/amso1100/c2_provider.c
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c
@@ -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;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 24e0df0..af28a31 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -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;
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index f5604b8..18c6df2 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -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;
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 0725ad7..47e6fd4 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -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;
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-04-24 18:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-23 16:20 [PATCH] ib_core: Add missing device link to class device Joachim Fenkes
2007-04-23 19:17 ` Roland Dreier
2007-04-24 12:06 ` Joachim Fenkes
2007-04-24 18:27 ` Roland Dreier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).