Commit c3af0980ce01dfb8e946990c3ae4c3727b1e9f26
1 parent
c8367c4cd9
Exists in
master
and in
7 other branches
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>
Showing 2 changed files with 15 additions and 0 deletions Side-by-side Diff
drivers/infiniband/core/cm.c
... | ... | @@ -3639,8 +3639,16 @@ |
3639 | 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 | 3648 | struct class cm_class = { |
3649 | + .owner = THIS_MODULE, | |
3643 | 3650 | .name = "infiniband_cm", |
3651 | + .devnode = cm_devnode, | |
3644 | 3652 | }; |
3645 | 3653 | EXPORT_SYMBOL(cm_class); |
3646 | 3654 |
drivers/infiniband/core/user_mad.c
... | ... | @@ -1176,6 +1176,11 @@ |
1176 | 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 | 1184 | static int __init ib_umad_init(void) |
1180 | 1185 | { |
1181 | 1186 | int ret; |
... | ... | @@ -1193,6 +1198,8 @@ |
1193 | 1198 | printk(KERN_ERR "user_mad: couldn't create class infiniband_mad\n"); |
1194 | 1199 | goto out_chrdev; |
1195 | 1200 | } |
1201 | + | |
1202 | + umad_class->devnode = umad_devnode; | |
1196 | 1203 | |
1197 | 1204 | ret = class_create_file(umad_class, &class_attr_abi_version.attr); |
1198 | 1205 | if (ret) { |