infiniband: utilize the new cdev_set_parent function

This replaces the suspect looking cdev.kobj.parent lines with the
equivalent cdev_set_parent function. This is a straightforward change
that's largely cosmetic but it does push the kobj.parent ownership
into char_dev.c where it belongs.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Logan Gunthorpe 2017-03-17 12:48:16 -06:00 committed by Greg Kroah-Hartman
parent a0d78193dc
commit 985087157c
3 changed files with 4 additions and 4 deletions

View File

@ -1183,7 +1183,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
cdev_init(&port->cdev, &umad_fops); cdev_init(&port->cdev, &umad_fops);
port->cdev.owner = THIS_MODULE; port->cdev.owner = THIS_MODULE;
port->cdev.kobj.parent = &umad_dev->kobj; cdev_set_parent(&port->cdev, &umad_dev->kobj);
kobject_set_name(&port->cdev.kobj, "umad%d", port->dev_num); kobject_set_name(&port->cdev.kobj, "umad%d", port->dev_num);
if (cdev_add(&port->cdev, base, 1)) if (cdev_add(&port->cdev, base, 1))
goto err_cdev; goto err_cdev;
@ -1202,7 +1202,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
base += IB_UMAD_MAX_PORTS; base += IB_UMAD_MAX_PORTS;
cdev_init(&port->sm_cdev, &umad_sm_fops); cdev_init(&port->sm_cdev, &umad_sm_fops);
port->sm_cdev.owner = THIS_MODULE; port->sm_cdev.owner = THIS_MODULE;
port->sm_cdev.kobj.parent = &umad_dev->kobj; cdev_set_parent(&port->sm_cdev, &umad_dev->kobj);
kobject_set_name(&port->sm_cdev.kobj, "issm%d", port->dev_num); kobject_set_name(&port->sm_cdev.kobj, "issm%d", port->dev_num);
if (cdev_add(&port->sm_cdev, base, 1)) if (cdev_add(&port->sm_cdev, base, 1))
goto err_sm_cdev; goto err_sm_cdev;

View File

@ -1189,7 +1189,7 @@ static void ib_uverbs_add_one(struct ib_device *device)
cdev_init(&uverbs_dev->cdev, NULL); cdev_init(&uverbs_dev->cdev, NULL);
uverbs_dev->cdev.owner = THIS_MODULE; uverbs_dev->cdev.owner = THIS_MODULE;
uverbs_dev->cdev.ops = device->mmap ? &uverbs_mmap_fops : &uverbs_fops; uverbs_dev->cdev.ops = device->mmap ? &uverbs_mmap_fops : &uverbs_fops;
uverbs_dev->cdev.kobj.parent = &uverbs_dev->kobj; cdev_set_parent(&uverbs_dev->cdev, &uverbs_dev->kobj);
kobject_set_name(&uverbs_dev->cdev.kobj, "uverbs%d", uverbs_dev->devnum); kobject_set_name(&uverbs_dev->cdev.kobj, "uverbs%d", uverbs_dev->devnum);
if (cdev_add(&uverbs_dev->cdev, base, 1)) if (cdev_add(&uverbs_dev->cdev, base, 1))
goto err_cdev; goto err_cdev;

View File

@ -69,7 +69,7 @@ int hfi1_cdev_init(int minor, const char *name,
cdev_init(cdev, fops); cdev_init(cdev, fops);
cdev->owner = THIS_MODULE; cdev->owner = THIS_MODULE;
cdev->kobj.parent = parent; cdev_set_parent(cdev, parent);
kobject_set_name(&cdev->kobj, name); kobject_set_name(&cdev->kobj, name);
ret = cdev_add(cdev, dev, 1); ret = cdev_add(cdev, dev, 1);