diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-05-27 11:28:53 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-05-27 11:28:53 -0700 |
| commit | afc1d93aa4935530985d7ec0a0439c9562836521 (patch) | |
| tree | 0bed26e0f7c7e59fd1ae16b6b9aeef198dd26f7e | |
| parent | 7f8e30cf2aced2f10d2820144a24ad8d86cc828f (diff) | |
| download | patches-afc1d93aa4935530985d7ec0a0439c9562836521.tar.gz | |
ib work to get class code working
4 files changed, 314 insertions, 2 deletions
diff --git a/class-move-driver-core-specific-parts-to-a-private-structure.patch b/class-move-driver-core-specific-parts-to-a-private-structure.patch index 96eb833f15a175..ab0ec062256888 100644 --- a/class-move-driver-core-specific-parts-to-a-private-structure.patch +++ b/class-move-driver-core-specific-parts-to-a-private-structure.patch @@ -1,4 +1,4 @@ -erom foo@baz Tue Apr 9 12:12:43 2002 +From foo@baz Tue Apr 9 12:12:43 2002 Date: Tue, 22 Jan 2008 18:17:41 -0500 To: Greg KH <greg@kroah.com> From: Greg Kroah-Hartman <gregkh@suse.de> diff --git a/driver-core/infiniband-make-cm_device-use-a-struct-device-and-not-a-kobject.patch b/driver-core/infiniband-make-cm_device-use-a-struct-device-and-not-a-kobject.patch new file mode 100644 index 00000000000000..604d0289454938 --- /dev/null +++ b/driver-core/infiniband-make-cm_device-use-a-struct-device-and-not-a-kobject.patch @@ -0,0 +1,105 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Tue, 27 May 2008 10:17:53 +0300 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: infiniband: make cm_device use a struct device and not a kobject. + +This object really should be a struct device, or at least contain a +pointer to a struct device, as it is trying to create a separate device +tree outside of the main device tree. This patch fixes this problem. + +It is needed for the class core rework that is being done in the driver +core. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Cc: Roland Dreier <rolandd@cisco.com> +Cc: Sean Hefty <sean.hefty@intel.com> +Cc: Hal Rosenstock <hal.rosenstock@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/infiniband/core/cm.c | 31 ++++++++++--------------------- + 1 file changed, 10 insertions(+), 21 deletions(-) + +--- a/drivers/infiniband/core/cm.c ++++ b/drivers/infiniband/core/cm.c +@@ -46,6 +46,7 @@ + #include <linux/spinlock.h> + #include <linux/sysfs.h> + #include <linux/workqueue.h> ++#include <linux/kdev_t.h> + + #include <rdma/ib_cache.h> + #include <rdma/ib_cm.h> +@@ -165,7 +166,7 @@ struct cm_port { + struct cm_device { + struct list_head list; + struct ib_device *ib_device; +- struct kobject dev_obj; ++ struct device *device; + u8 ack_delay; + struct cm_port *port[0]; + }; +@@ -3620,19 +3621,7 @@ static struct kobj_type cm_port_obj_type + .release = cm_release_port_obj + }; + +-static void cm_release_dev_obj(struct kobject *obj) +-{ +- struct cm_device *cm_dev; +- +- cm_dev = container_of(obj, struct cm_device, dev_obj); +- kfree(cm_dev); +-} +- +-static struct kobj_type cm_dev_obj_type = { +- .release = cm_release_dev_obj +-}; +- +-struct class cm_class = { ++static struct class cm_class = { + .name = "infiniband_cm", + }; + EXPORT_SYMBOL(cm_class); +@@ -3642,7 +3631,7 @@ static int cm_create_port_fs(struct cm_p + int i, ret; + + ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type, +- &port->cm_dev->dev_obj, ++ &port->cm_dev->device->kobj, + "%d", port->port_num); + if (ret) { + kfree(port); +@@ -3704,10 +3693,10 @@ static void cm_add_one(struct ib_device + cm_dev->ib_device = ib_device; + cm_get_ack_delay(cm_dev); + +- ret = kobject_init_and_add(&cm_dev->dev_obj, &cm_dev_obj_type, +- &cm_class.subsys.kobj, "%s", +- ib_device->name); +- if (ret) { ++ cm_dev->device = device_create_drvdata(&cm_class, &ib_device->dev, ++ MKDEV(0, 0), NULL, ++ "%s", ib_device->name); ++ if (!cm_dev->device) { + kfree(cm_dev); + return; + } +@@ -3760,7 +3749,7 @@ error1: + ib_unregister_mad_agent(port->mad_agent); + cm_remove_port_fs(port); + } +- kobject_put(&cm_dev->dev_obj); ++ device_unregister(cm_dev->device); + } + + static void cm_remove_one(struct ib_device *ib_device) +@@ -3788,7 +3777,7 @@ static void cm_remove_one(struct ib_devi + flush_workqueue(cm.wq); + cm_remove_port_fs(port); + } +- kobject_put(&cm_dev->dev_obj); ++ device_unregister(cm_dev->device); + } + + static int __init ib_cm_init(void) diff --git a/driver-core/infiniband-rename-device-to-ib_device-in-cm_device.patch b/driver-core/infiniband-rename-device-to-ib_device-in-cm_device.patch new file mode 100644 index 00000000000000..c1adab534c9a0f --- /dev/null +++ b/driver-core/infiniband-rename-device-to-ib_device-in-cm_device.patch @@ -0,0 +1,205 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Tue, 27 May 2008 10:17:53 +0300 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: infiniband: rename "device" to "ib_device" in cm_device + +This pointer really is a struct ib_device, not a ib_device, so name it +properly to help prevent confusion. + +This makes the followon patch in this series much smaller and easier to +understand as well. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Cc: Roland Dreier <rolandd@cisco.com> +Cc: Sean Hefty <sean.hefty@intel.com> +Cc: Hal Rosenstock <hal.rosenstock@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/infiniband/core/cm.c | 47 +++++++++++++++++++++---------------------- + 1 file changed, 24 insertions(+), 23 deletions(-) + +--- a/drivers/infiniband/core/cm.c ++++ b/drivers/infiniband/core/cm.c +@@ -164,7 +164,7 @@ struct cm_port { + + struct cm_device { + struct list_head list; +- struct ib_device *device; ++ struct ib_device *ib_device; + struct kobject dev_obj; + u8 ack_delay; + struct cm_port *port[0]; +@@ -341,7 +341,7 @@ static void cm_init_av_for_response(stru + { + av->port = port; + av->pkey_index = wc->pkey_index; +- ib_init_ah_from_wc(port->cm_dev->device, port->port_num, wc, ++ ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc, + grh, &av->ah_attr); + } + +@@ -355,7 +355,7 @@ static int cm_init_av_by_path(struct ib_ + + read_lock_irqsave(&cm.device_lock, flags); + list_for_each_entry(cm_dev, &cm.device_list, list) { +- if (!ib_find_cached_gid(cm_dev->device, &path->sgid, ++ if (!ib_find_cached_gid(cm_dev->ib_device, &path->sgid, + &p, NULL)) { + port = cm_dev->port[p-1]; + break; +@@ -366,13 +366,13 @@ static int cm_init_av_by_path(struct ib_ + if (!port) + return -EINVAL; + +- ret = ib_find_cached_pkey(cm_dev->device, port->port_num, ++ ret = ib_find_cached_pkey(cm_dev->ib_device, port->port_num, + be16_to_cpu(path->pkey), &av->pkey_index); + if (ret) + return ret; + + av->port = port; +- ib_init_ah_from_path(cm_dev->device, port->port_num, path, ++ ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path, + &av->ah_attr); + av->timeout = path->packet_life_time + 1; + return 0; +@@ -1517,7 +1517,7 @@ static int cm_req_handler(struct cm_work + + req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad; + +- cm_id = ib_create_cm_id(work->port->cm_dev->device, NULL, NULL); ++ cm_id = ib_create_cm_id(work->port->cm_dev->ib_device, NULL, NULL); + if (IS_ERR(cm_id)) + return PTR_ERR(cm_id); + +@@ -1552,7 +1552,7 @@ static int cm_req_handler(struct cm_work + cm_format_paths_from_req(req_msg, &work->path[0], &work->path[1]); + ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av); + if (ret) { +- ib_get_cached_gid(work->port->cm_dev->device, ++ ib_get_cached_gid(work->port->cm_dev->ib_device, + work->port->port_num, 0, &work->path[0].sgid); + ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID, + &work->path[0].sgid, sizeof work->path[0].sgid, +@@ -2952,7 +2952,7 @@ static int cm_sidr_req_handler(struct cm + struct cm_sidr_req_msg *sidr_req_msg; + struct ib_wc *wc; + +- cm_id = ib_create_cm_id(work->port->cm_dev->device, NULL, NULL); ++ cm_id = ib_create_cm_id(work->port->cm_dev->ib_device, NULL, NULL); + if (IS_ERR(cm_id)) + return PTR_ERR(cm_id); + cm_id_priv = container_of(cm_id, struct cm_id_private, id); +@@ -3580,7 +3580,7 @@ static void cm_get_ack_delay(struct cm_d + { + struct ib_device_attr attr; + +- if (ib_query_device(cm_dev->device, &attr)) ++ if (ib_query_device(cm_dev->ib_device, &attr)) + cm_dev->ack_delay = 0; /* acks will rely on packet life time */ + else + cm_dev->ack_delay = attr.local_ca_ack_delay; +@@ -3678,7 +3678,7 @@ static void cm_remove_port_fs(struct cm_ + kobject_put(&port->port_obj); + } + +-static void cm_add_one(struct ib_device *device) ++static void cm_add_one(struct ib_device *ib_device) + { + struct cm_device *cm_dev; + struct cm_port *port; +@@ -3693,26 +3693,27 @@ static void cm_add_one(struct ib_device + int ret; + u8 i; + +- if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) ++ if (rdma_node_get_transport(ib_device->node_type) != RDMA_TRANSPORT_IB) + return; + + cm_dev = kzalloc(sizeof(*cm_dev) + sizeof(*port) * +- device->phys_port_cnt, GFP_KERNEL); ++ ib_device->phys_port_cnt, GFP_KERNEL); + if (!cm_dev) + return; + +- cm_dev->device = device; ++ cm_dev->ib_device = ib_device; + cm_get_ack_delay(cm_dev); + + ret = kobject_init_and_add(&cm_dev->dev_obj, &cm_dev_obj_type, +- &cm_class.subsys.kobj, "%s", device->name); ++ &cm_class.subsys.kobj, "%s", ++ ib_device->name); + if (ret) { + kfree(cm_dev); + return; + } + + set_bit(IB_MGMT_METHOD_SEND, reg_req.method_mask); +- for (i = 1; i <= device->phys_port_cnt; i++) { ++ for (i = 1; i <= ib_device->phys_port_cnt; i++) { + port = kzalloc(sizeof *port, GFP_KERNEL); + if (!port) + goto error1; +@@ -3725,7 +3726,7 @@ static void cm_add_one(struct ib_device + if (ret) + goto error1; + +- port->mad_agent = ib_register_mad_agent(device, i, ++ port->mad_agent = ib_register_mad_agent(ib_device, i, + IB_QPT_GSI, + ®_req, + 0, +@@ -3735,11 +3736,11 @@ static void cm_add_one(struct ib_device + if (IS_ERR(port->mad_agent)) + goto error2; + +- ret = ib_modify_port(device, i, 0, &port_modify); ++ ret = ib_modify_port(ib_device, i, 0, &port_modify); + if (ret) + goto error3; + } +- ib_set_client_data(device, &cm_client, cm_dev); ++ ib_set_client_data(ib_device, &cm_client, cm_dev); + + write_lock_irqsave(&cm.device_lock, flags); + list_add_tail(&cm_dev->list, &cm.device_list); +@@ -3755,14 +3756,14 @@ error1: + port_modify.clr_port_cap_mask = IB_PORT_CM_SUP; + while (--i) { + port = cm_dev->port[i-1]; +- ib_modify_port(device, port->port_num, 0, &port_modify); ++ ib_modify_port(ib_device, port->port_num, 0, &port_modify); + ib_unregister_mad_agent(port->mad_agent); + cm_remove_port_fs(port); + } + kobject_put(&cm_dev->dev_obj); + } + +-static void cm_remove_one(struct ib_device *device) ++static void cm_remove_one(struct ib_device *ib_device) + { + struct cm_device *cm_dev; + struct cm_port *port; +@@ -3772,7 +3773,7 @@ static void cm_remove_one(struct ib_devi + unsigned long flags; + int i; + +- cm_dev = ib_get_client_data(device, &cm_client); ++ cm_dev = ib_get_client_data(ib_device, &cm_client); + if (!cm_dev) + return; + +@@ -3780,9 +3781,9 @@ static void cm_remove_one(struct ib_devi + list_del(&cm_dev->list); + write_unlock_irqrestore(&cm.device_lock, flags); + +- for (i = 1; i <= device->phys_port_cnt; i++) { ++ for (i = 1; i <= ib_device->phys_port_cnt; i++) { + port = cm_dev->port[i-1]; +- ib_modify_port(device, port->port_num, 0, &port_modify); ++ ib_modify_port(ib_device, port->port_num, 0, &port_modify); + ib_unregister_mad_agent(port->mad_agent); + flush_workqueue(cm.wq); + cm_remove_port_fs(port); @@ -77,6 +77,8 @@ driver-core/block-make-proc-files-seq_start-use-the-class_find_device.patch driver-core/block-move-header-for-proc-partitions-to-seq_start.patch driver-core/block-make-proc-partitions-and-proc-diskstats-use-class_find_device.patch driver-core/i2c-use-class_for_each_device.patch +driver-core/infiniband-rename-device-to-ib_device-in-cm_device.patch +driver-core/infiniband-make-cm_device-use-a-struct-device-and-not-a-kobject.patch driver-core/driver-core-remove-kobj_name_len-define.patch driver-core/driver-core-remove-device_name_size-define.patch @@ -186,7 +188,7 @@ ldp/oms-add-oms-maxp-driver.patch # not quite working yet... -#class-move-driver-core-specific-parts-to-a-private-structure.patch +class-move-driver-core-specific-parts-to-a-private-structure.patch #pending/greg-vmalloc-do-not-check-for-freed-locks-on-user-maps.patch #pending/greg-slab-add-a-flag-to-prevent-debug_free-checks-on-a-kmem_cache.patch |
