aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cm.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 8dc442984c82..922d35f4fc08 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -44,6 +44,7 @@
44#include <linux/spinlock.h> 44#include <linux/spinlock.h>
45#include <linux/sysfs.h> 45#include <linux/sysfs.h>
46#include <linux/workqueue.h> 46#include <linux/workqueue.h>
47#include <linux/kdev_t.h>
47 48
48#include <rdma/ib_cache.h> 49#include <rdma/ib_cache.h>
49#include <rdma/ib_cm.h> 50#include <rdma/ib_cm.h>
@@ -163,7 +164,7 @@ struct cm_port {
163struct cm_device { 164struct cm_device {
164 struct list_head list; 165 struct list_head list;
165 struct ib_device *ib_device; 166 struct ib_device *ib_device;
166 struct kobject dev_obj; 167 struct device *device;
167 u8 ack_delay; 168 u8 ack_delay;
168 struct cm_port *port[0]; 169 struct cm_port *port[0];
169}; 170};
@@ -3618,18 +3619,6 @@ static struct kobj_type cm_port_obj_type = {
3618 .release = cm_release_port_obj 3619 .release = cm_release_port_obj
3619}; 3620};
3620 3621
3621static void cm_release_dev_obj(struct kobject *obj)
3622{
3623 struct cm_device *cm_dev;
3624
3625 cm_dev = container_of(obj, struct cm_device, dev_obj);
3626 kfree(cm_dev);
3627}
3628
3629static struct kobj_type cm_dev_obj_type = {
3630 .release = cm_release_dev_obj
3631};
3632
3633struct class cm_class = { 3622struct class cm_class = {
3634 .name = "infiniband_cm", 3623 .name = "infiniband_cm",
3635}; 3624};
@@ -3640,7 +3629,7 @@ static int cm_create_port_fs(struct cm_port *port)
3640 int i, ret; 3629 int i, ret;
3641 3630
3642 ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type, 3631 ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type,
3643 &port->cm_dev->dev_obj, 3632 &port->cm_dev->device->kobj,
3644 "%d", port->port_num); 3633 "%d", port->port_num);
3645 if (ret) { 3634 if (ret) {
3646 kfree(port); 3635 kfree(port);
@@ -3702,10 +3691,10 @@ static void cm_add_one(struct ib_device *ib_device)
3702 cm_dev->ib_device = ib_device; 3691 cm_dev->ib_device = ib_device;
3703 cm_get_ack_delay(cm_dev); 3692 cm_get_ack_delay(cm_dev);
3704 3693
3705 ret = kobject_init_and_add(&cm_dev->dev_obj, &cm_dev_obj_type, 3694 cm_dev->device = device_create_drvdata(&cm_class, &ib_device->dev,
3706 &cm_class.subsys.kobj, "%s", 3695 MKDEV(0, 0), NULL,
3707 ib_device->name); 3696 "%s", ib_device->name);
3708 if (ret) { 3697 if (!cm_dev->device) {
3709 kfree(cm_dev); 3698 kfree(cm_dev);
3710 return; 3699 return;
3711 } 3700 }
@@ -3758,7 +3747,7 @@ error1:
3758 ib_unregister_mad_agent(port->mad_agent); 3747 ib_unregister_mad_agent(port->mad_agent);
3759 cm_remove_port_fs(port); 3748 cm_remove_port_fs(port);
3760 } 3749 }
3761 kobject_put(&cm_dev->dev_obj); 3750 device_unregister(cm_dev->device);
3762} 3751}
3763 3752
3764static void cm_remove_one(struct ib_device *ib_device) 3753static void cm_remove_one(struct ib_device *ib_device)
@@ -3786,7 +3775,7 @@ static void cm_remove_one(struct ib_device *ib_device)
3786 flush_workqueue(cm.wq); 3775 flush_workqueue(cm.wq);
3787 cm_remove_port_fs(port); 3776 cm_remove_port_fs(port);
3788 } 3777 }
3789 kobject_put(&cm_dev->dev_obj); 3778 device_unregister(cm_dev->device);
3790} 3779}
3791 3780
3792static int __init ib_cm_init(void) 3781static int __init ib_cm_init(void)