diff options
author | Roland Dreier <roland@purestorage.com> | 2011-05-23 14:21:47 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2011-05-23 14:24:28 -0400 |
commit | c3af0980ce01dfb8e946990c3ae4c3727b1e9f26 (patch) | |
tree | 13552e10c7b36da435d4aa950a9a569e561f3dff /drivers/infiniband/core | |
parent | c8367c4cd9de512d296fc557f121be62a43987f3 (diff) |
IB: Add devnode methods to cm_class and umad_class
We want the ucmX, umadX and issmX device nodes to show up under
/dev/infiniband, and additionally ucmX should have mode 0666. Add
appropriate devnode methods to their class structs for this.
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/cm.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/core/user_mad.c | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index f804e28e1ebb..f62f52fb9ece 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -3639,8 +3639,16 @@ static struct kobj_type cm_port_obj_type = { | |||
3639 | .release = cm_release_port_obj | 3639 | .release = cm_release_port_obj |
3640 | }; | 3640 | }; |
3641 | 3641 | ||
3642 | static char *cm_devnode(struct device *dev, mode_t *mode) | ||
3643 | { | ||
3644 | *mode = 0666; | ||
3645 | return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev)); | ||
3646 | } | ||
3647 | |||
3642 | struct class cm_class = { | 3648 | struct class cm_class = { |
3649 | .owner = THIS_MODULE, | ||
3643 | .name = "infiniband_cm", | 3650 | .name = "infiniband_cm", |
3651 | .devnode = cm_devnode, | ||
3644 | }; | 3652 | }; |
3645 | EXPORT_SYMBOL(cm_class); | 3653 | EXPORT_SYMBOL(cm_class); |
3646 | 3654 | ||
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index cd1996d0ad08..8d261b6ea5fe 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -1176,6 +1176,11 @@ static void ib_umad_remove_one(struct ib_device *device) | |||
1176 | kref_put(&umad_dev->ref, ib_umad_release_dev); | 1176 | kref_put(&umad_dev->ref, ib_umad_release_dev); |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | static char *umad_devnode(struct device *dev, mode_t *mode) | ||
1180 | { | ||
1181 | return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev)); | ||
1182 | } | ||
1183 | |||
1179 | static int __init ib_umad_init(void) | 1184 | static int __init ib_umad_init(void) |
1180 | { | 1185 | { |
1181 | int ret; | 1186 | int ret; |
@@ -1194,6 +1199,8 @@ static int __init ib_umad_init(void) | |||
1194 | goto out_chrdev; | 1199 | goto out_chrdev; |
1195 | } | 1200 | } |
1196 | 1201 | ||
1202 | umad_class->devnode = umad_devnode; | ||
1203 | |||
1197 | ret = class_create_file(umad_class, &class_attr_abi_version.attr); | 1204 | ret = class_create_file(umad_class, &class_attr_abi_version.attr); |
1198 | if (ret) { | 1205 | if (ret) { |
1199 | printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n"); | 1206 | printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n"); |