[openib-general] [openfabrics-ewg] new OFED 1.2 package

Michael S. Tsirkin mst at mellanox.co.il
Sun Feb 25 09:08:16 PST 2007


> Quoting r. Woodruff, Robert J <robert.j.woodruff at intel.com>:
> Subject: Re: [openfabrics-ewg] new OFED 1.2 package
> 
> I am also still seeing the issue with the rdma_cm abi_version on RedHat
> EL4-U3,
> bug number, 347. The bug report contains the patch that should fix this.

OK, here's a somewhat cleaned-up patch.  However, I have a question: should not the
module cleanup function remove ucma_class and class_attr_abi_version that were
created at module initialization?

----

diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index e2e8d32..e9e024e 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -847,13 +847,12 @@ static struct miscdevice ucma_misc = {
 	.fops	= &ucma_fops,
 };
 
-static ssize_t show_abi_version(struct device *dev,
-				struct device_attribute *attr,
-				char *buf)
+static struct class *ucma_class;
+static ssize_t show_abi_version(struct class *class_dev, char *buf)
 {
 	return sprintf(buf, "%d\n", RDMA_USER_CM_ABI_VERSION);
 }
-static DEVICE_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
+static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
 
 static int __init ucma_init(void)
 {
@@ -863,7 +862,13 @@ static int __init ucma_init(void)
 	if (ret)
 		return ret;
 
-	ret = device_create_file(ucma_misc.this_device, &dev_attr_abi_version);
+	ucma_class = class_create(THIS_MODULE, "infiniband_ucma");
+	if (IS_ERR(ucma_class)) {
+		printk(KERN_ERR "rdma_ucm: couldn't create class infiniband_ucma\n");
+		goto err;
+	}
+
+	ret = class_create_file(ucma_class, &class_attr_abi_version);
 	if (ret) {
 		printk(KERN_ERR "rdma_ucm: couldn't create abi_version attr\n");
 		goto err;
@@ -876,7 +881,6 @@ err:
 
 static void __exit ucma_cleanup(void)
 {
-	device_remove_file(ucma_misc.this_device, &dev_attr_abi_version);
 	misc_deregister(&ucma_misc);
 	idr_destroy(&ctx_idr);
 }


-- 
MST




More information about the general mailing list