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>
This commit is contained in:
parent
c8367c4cd9
commit
c3af0980ce
2 changed files with 15 additions and 0 deletions
|
@ -3639,8 +3639,16 @@ static struct kobj_type cm_port_obj_type = {
|
||||||
.release = cm_release_port_obj
|
.release = cm_release_port_obj
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static char *cm_devnode(struct device *dev, mode_t *mode)
|
||||||
|
{
|
||||||
|
*mode = 0666;
|
||||||
|
return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev));
|
||||||
|
}
|
||||||
|
|
||||||
struct class cm_class = {
|
struct class cm_class = {
|
||||||
|
.owner = THIS_MODULE,
|
||||||
.name = "infiniband_cm",
|
.name = "infiniband_cm",
|
||||||
|
.devnode = cm_devnode,
|
||||||
};
|
};
|
||||||
EXPORT_SYMBOL(cm_class);
|
EXPORT_SYMBOL(cm_class);
|
||||||
|
|
||||||
|
|
|
@ -1176,6 +1176,11 @@ static void ib_umad_remove_one(struct ib_device *device)
|
||||||
kref_put(&umad_dev->ref, ib_umad_release_dev);
|
kref_put(&umad_dev->ref, ib_umad_release_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *umad_devnode(struct device *dev, mode_t *mode)
|
||||||
|
{
|
||||||
|
return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev));
|
||||||
|
}
|
||||||
|
|
||||||
static int __init ib_umad_init(void)
|
static int __init ib_umad_init(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1194,6 +1199,8 @@ static int __init ib_umad_init(void)
|
||||||
goto out_chrdev;
|
goto out_chrdev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
umad_class->devnode = umad_devnode;
|
||||||
|
|
||||||
ret = class_create_file(umad_class, &class_attr_abi_version.attr);
|
ret = class_create_file(umad_class, &class_attr_abi_version.attr);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n");
|
printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue