IB/mad: Update module to [pr|dev]_* style print messages

Use dev_* style print when struct device is available.

Also combine previously line broken user-visible strings as per
Documentation/CodingStyle:

"However, never break user-visible strings such as printk messages,
because that breaks the ability to grep for them."

Signed-off-by: Ira Weiny <ira.weiny@intel.com>

[ Remove PFX so the patch actually builds.  - Roland ]

Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:
Ira Weiny 2014-08-08 19:00:53 -04:00 committed by Roland Dreier
parent f426a40eb6
commit 7ef5d4b046
3 changed files with 85 additions and 77 deletions

View File

@ -94,14 +94,14 @@ void agent_send_response(struct ib_mad *mad, struct ib_grh *grh,
port_priv = ib_get_agent_port(device, port_num); port_priv = ib_get_agent_port(device, port_num);
if (!port_priv) { if (!port_priv) {
printk(KERN_ERR SPFX "Unable to find port agent\n"); dev_err(&device->dev, "Unable to find port agent\n");
return; return;
} }
agent = port_priv->agent[qpn]; agent = port_priv->agent[qpn];
ah = ib_create_ah_from_wc(agent->qp->pd, wc, grh, port_num); ah = ib_create_ah_from_wc(agent->qp->pd, wc, grh, port_num);
if (IS_ERR(ah)) { if (IS_ERR(ah)) {
printk(KERN_ERR SPFX "ib_create_ah_from_wc error %ld\n", dev_err(&device->dev, "ib_create_ah_from_wc error %ld\n",
PTR_ERR(ah)); PTR_ERR(ah));
return; return;
} }
@ -110,7 +110,7 @@ void agent_send_response(struct ib_mad *mad, struct ib_grh *grh,
IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA,
GFP_KERNEL); GFP_KERNEL);
if (IS_ERR(send_buf)) { if (IS_ERR(send_buf)) {
printk(KERN_ERR SPFX "ib_create_send_mad error\n"); dev_err(&device->dev, "ib_create_send_mad error\n");
goto err1; goto err1;
} }
@ -125,7 +125,7 @@ void agent_send_response(struct ib_mad *mad, struct ib_grh *grh,
} }
if (ib_post_send_mad(send_buf, NULL)) { if (ib_post_send_mad(send_buf, NULL)) {
printk(KERN_ERR SPFX "ib_post_send_mad error\n"); dev_err(&device->dev, "ib_post_send_mad error\n");
goto err2; goto err2;
} }
return; return;
@ -151,7 +151,7 @@ int ib_agent_port_open(struct ib_device *device, int port_num)
/* Create new device info */ /* Create new device info */
port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL); port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL);
if (!port_priv) { if (!port_priv) {
printk(KERN_ERR SPFX "No memory for ib_agent_port_private\n"); dev_err(&device->dev, "No memory for ib_agent_port_private\n");
ret = -ENOMEM; ret = -ENOMEM;
goto error1; goto error1;
} }
@ -202,7 +202,7 @@ int ib_agent_port_close(struct ib_device *device, int port_num)
port_priv = __ib_get_agent_port(device, port_num); port_priv = __ib_get_agent_port(device, port_num);
if (port_priv == NULL) { if (port_priv == NULL) {
spin_unlock_irqrestore(&ib_agent_port_list_lock, flags); spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
printk(KERN_ERR SPFX "Port %d not found\n", port_num); dev_err(&device->dev, "Port %d not found\n", port_num);
return -ENODEV; return -ENODEV;
} }
list_del(&port_priv->port_list); list_del(&port_priv->port_list);

View File

@ -33,6 +33,9 @@
* SOFTWARE. * SOFTWARE.
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
@ -706,7 +709,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
smi_handle_dr_smp_send(smp, device->node_type, port_num) == smi_handle_dr_smp_send(smp, device->node_type, port_num) ==
IB_SMI_DISCARD) { IB_SMI_DISCARD) {
ret = -EINVAL; ret = -EINVAL;
printk(KERN_ERR PFX "Invalid directed route\n"); dev_err(&device->dev, "Invalid directed route\n");
goto out; goto out;
} }
@ -718,7 +721,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
local = kmalloc(sizeof *local, GFP_ATOMIC); local = kmalloc(sizeof *local, GFP_ATOMIC);
if (!local) { if (!local) {
ret = -ENOMEM; ret = -ENOMEM;
printk(KERN_ERR PFX "No memory for ib_mad_local_private\n"); dev_err(&device->dev, "No memory for ib_mad_local_private\n");
goto out; goto out;
} }
local->mad_priv = NULL; local->mad_priv = NULL;
@ -726,7 +729,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
mad_priv = kmem_cache_alloc(ib_mad_cache, GFP_ATOMIC); mad_priv = kmem_cache_alloc(ib_mad_cache, GFP_ATOMIC);
if (!mad_priv) { if (!mad_priv) {
ret = -ENOMEM; ret = -ENOMEM;
printk(KERN_ERR PFX "No memory for local response MAD\n"); dev_err(&device->dev, "No memory for local response MAD\n");
kfree(local); kfree(local);
goto out; goto out;
} }
@ -837,9 +840,9 @@ static int alloc_send_rmpp_list(struct ib_mad_send_wr_private *send_wr,
for (left = send_buf->data_len + pad; left > 0; left -= seg_size) { for (left = send_buf->data_len + pad; left > 0; left -= seg_size) {
seg = kmalloc(sizeof (*seg) + seg_size, gfp_mask); seg = kmalloc(sizeof (*seg) + seg_size, gfp_mask);
if (!seg) { if (!seg) {
printk(KERN_ERR "alloc_send_rmpp_segs: RMPP mem " dev_err(&send_buf->mad_agent->device->dev,
"alloc failed for len %zd, gfp %#x\n", "alloc_send_rmpp_segs: RMPP mem alloc failed for len %zd, gfp %#x\n",
sizeof (*seg) + seg_size, gfp_mask); sizeof (*seg) + seg_size, gfp_mask);
free_send_rmpp_list(send_wr); free_send_rmpp_list(send_wr);
return -ENOMEM; return -ENOMEM;
} }
@ -1199,7 +1202,8 @@ EXPORT_SYMBOL(ib_redirect_mad_qp);
int ib_process_mad_wc(struct ib_mad_agent *mad_agent, int ib_process_mad_wc(struct ib_mad_agent *mad_agent,
struct ib_wc *wc) struct ib_wc *wc)
{ {
printk(KERN_ERR PFX "ib_process_mad_wc() not implemented yet\n"); dev_err(&mad_agent->device->dev,
"ib_process_mad_wc() not implemented yet\n");
return 0; return 0;
} }
EXPORT_SYMBOL(ib_process_mad_wc); EXPORT_SYMBOL(ib_process_mad_wc);
@ -1211,7 +1215,7 @@ static int method_in_use(struct ib_mad_mgmt_method_table **method,
for_each_set_bit(i, mad_reg_req->method_mask, IB_MGMT_MAX_METHODS) { for_each_set_bit(i, mad_reg_req->method_mask, IB_MGMT_MAX_METHODS) {
if ((*method)->agent[i]) { if ((*method)->agent[i]) {
printk(KERN_ERR PFX "Method %d already in use\n", i); pr_err("Method %d already in use\n", i);
return -EINVAL; return -EINVAL;
} }
} }
@ -1223,8 +1227,7 @@ static int allocate_method_table(struct ib_mad_mgmt_method_table **method)
/* Allocate management method table */ /* Allocate management method table */
*method = kzalloc(sizeof **method, GFP_ATOMIC); *method = kzalloc(sizeof **method, GFP_ATOMIC);
if (!*method) { if (!*method) {
printk(KERN_ERR PFX "No memory for " pr_err("No memory for ib_mad_mgmt_method_table\n");
"ib_mad_mgmt_method_table\n");
return -ENOMEM; return -ENOMEM;
} }
@ -1319,8 +1322,8 @@ static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req,
/* Allocate management class table for "new" class version */ /* Allocate management class table for "new" class version */
*class = kzalloc(sizeof **class, GFP_ATOMIC); *class = kzalloc(sizeof **class, GFP_ATOMIC);
if (!*class) { if (!*class) {
printk(KERN_ERR PFX "No memory for " dev_err(&agent_priv->agent.device->dev,
"ib_mad_mgmt_class_table\n"); "No memory for ib_mad_mgmt_class_table\n");
ret = -ENOMEM; ret = -ENOMEM;
goto error1; goto error1;
} }
@ -1386,8 +1389,8 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req,
/* Allocate mgmt vendor class table for "new" class version */ /* Allocate mgmt vendor class table for "new" class version */
vendor = kzalloc(sizeof *vendor, GFP_ATOMIC); vendor = kzalloc(sizeof *vendor, GFP_ATOMIC);
if (!vendor) { if (!vendor) {
printk(KERN_ERR PFX "No memory for " dev_err(&agent_priv->agent.device->dev,
"ib_mad_mgmt_vendor_class_table\n"); "No memory for ib_mad_mgmt_vendor_class_table\n");
goto error1; goto error1;
} }
@ -1397,8 +1400,8 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req,
/* Allocate table for this management vendor class */ /* Allocate table for this management vendor class */
vendor_class = kzalloc(sizeof *vendor_class, GFP_ATOMIC); vendor_class = kzalloc(sizeof *vendor_class, GFP_ATOMIC);
if (!vendor_class) { if (!vendor_class) {
printk(KERN_ERR PFX "No memory for " dev_err(&agent_priv->agent.device->dev,
"ib_mad_mgmt_vendor_class\n"); "No memory for ib_mad_mgmt_vendor_class\n");
goto error2; goto error2;
} }
@ -1429,7 +1432,7 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req,
goto check_in_use; goto check_in_use;
} }
} }
printk(KERN_ERR PFX "All OUI slots in use\n"); dev_err(&agent_priv->agent.device->dev, "All OUI slots in use\n");
goto error3; goto error3;
check_in_use: check_in_use:
@ -1640,9 +1643,9 @@ find_mad_agent(struct ib_mad_port_private *port_priv,
if (mad_agent->agent.recv_handler) if (mad_agent->agent.recv_handler)
atomic_inc(&mad_agent->refcount); atomic_inc(&mad_agent->refcount);
else { else {
printk(KERN_NOTICE PFX "No receive handler for client " dev_notice(&port_priv->device->dev,
"%p on port %d\n", "No receive handler for client %p on port %d\n",
&mad_agent->agent, port_priv->port_num); &mad_agent->agent, port_priv->port_num);
mad_agent = NULL; mad_agent = NULL;
} }
} }
@ -1658,8 +1661,8 @@ static int validate_mad(struct ib_mad *mad, u32 qp_num)
/* Make sure MAD base version is understood */ /* Make sure MAD base version is understood */
if (mad->mad_hdr.base_version != IB_MGMT_BASE_VERSION) { if (mad->mad_hdr.base_version != IB_MGMT_BASE_VERSION) {
printk(KERN_ERR PFX "MAD received with unsupported base " pr_err("MAD received with unsupported base version %d\n",
"version %d\n", mad->mad_hdr.base_version); mad->mad_hdr.base_version);
goto out; goto out;
} }
@ -1911,8 +1914,8 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv,
response = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL); response = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL);
if (!response) { if (!response) {
printk(KERN_ERR PFX "ib_mad_recv_done_handler no memory " dev_err(&port_priv->device->dev,
"for response buffer\n"); "ib_mad_recv_done_handler no memory for response buffer\n");
goto out; goto out;
} }
@ -2176,7 +2179,8 @@ retry:
ret = ib_post_send(qp_info->qp, &queued_send_wr->send_wr, ret = ib_post_send(qp_info->qp, &queued_send_wr->send_wr,
&bad_send_wr); &bad_send_wr);
if (ret) { if (ret) {
printk(KERN_ERR PFX "ib_post_send failed: %d\n", ret); dev_err(&port_priv->device->dev,
"ib_post_send failed: %d\n", ret);
mad_send_wr = queued_send_wr; mad_send_wr = queued_send_wr;
wc->status = IB_WC_LOC_QP_OP_ERR; wc->status = IB_WC_LOC_QP_OP_ERR;
goto retry; goto retry;
@ -2248,8 +2252,9 @@ static void mad_error_handler(struct ib_mad_port_private *port_priv,
IB_QP_STATE | IB_QP_CUR_STATE); IB_QP_STATE | IB_QP_CUR_STATE);
kfree(attr); kfree(attr);
if (ret) if (ret)
printk(KERN_ERR PFX "mad_error_handler - " dev_err(&port_priv->device->dev,
"ib_modify_qp to RTS : %d\n", ret); "mad_error_handler - ib_modify_qp to RTS : %d\n",
ret);
else else
mark_sends_for_retry(qp_info); mark_sends_for_retry(qp_info);
} }
@ -2408,7 +2413,8 @@ static void local_completions(struct work_struct *work)
if (local->mad_priv) { if (local->mad_priv) {
recv_mad_agent = local->recv_mad_agent; recv_mad_agent = local->recv_mad_agent;
if (!recv_mad_agent) { if (!recv_mad_agent) {
printk(KERN_ERR PFX "No receive MAD agent for local completion\n"); dev_err(&mad_agent_priv->agent.device->dev,
"No receive MAD agent for local completion\n");
free_mad = 1; free_mad = 1;
goto local_send_completion; goto local_send_completion;
} }
@ -2589,7 +2595,8 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info,
} else { } else {
mad_priv = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL); mad_priv = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL);
if (!mad_priv) { if (!mad_priv) {
printk(KERN_ERR PFX "No memory for receive buffer\n"); dev_err(&qp_info->port_priv->device->dev,
"No memory for receive buffer\n");
ret = -ENOMEM; ret = -ENOMEM;
break; break;
} }
@ -2625,7 +2632,8 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info,
sizeof mad_priv->header, sizeof mad_priv->header,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
kmem_cache_free(ib_mad_cache, mad_priv); kmem_cache_free(ib_mad_cache, mad_priv);
printk(KERN_ERR PFX "ib_post_recv failed: %d\n", ret); dev_err(&qp_info->port_priv->device->dev,
"ib_post_recv failed: %d\n", ret);
break; break;
} }
} while (post); } while (post);
@ -2681,7 +2689,8 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv)
attr = kmalloc(sizeof *attr, GFP_KERNEL); attr = kmalloc(sizeof *attr, GFP_KERNEL);
if (!attr) { if (!attr) {
printk(KERN_ERR PFX "Couldn't kmalloc ib_qp_attr\n"); dev_err(&port_priv->device->dev,
"Couldn't kmalloc ib_qp_attr\n");
return -ENOMEM; return -ENOMEM;
} }
@ -2705,16 +2714,18 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv)
ret = ib_modify_qp(qp, attr, IB_QP_STATE | ret = ib_modify_qp(qp, attr, IB_QP_STATE |
IB_QP_PKEY_INDEX | IB_QP_QKEY); IB_QP_PKEY_INDEX | IB_QP_QKEY);
if (ret) { if (ret) {
printk(KERN_ERR PFX "Couldn't change QP%d state to " dev_err(&port_priv->device->dev,
"INIT: %d\n", i, ret); "Couldn't change QP%d state to INIT: %d\n",
i, ret);
goto out; goto out;
} }
attr->qp_state = IB_QPS_RTR; attr->qp_state = IB_QPS_RTR;
ret = ib_modify_qp(qp, attr, IB_QP_STATE); ret = ib_modify_qp(qp, attr, IB_QP_STATE);
if (ret) { if (ret) {
printk(KERN_ERR PFX "Couldn't change QP%d state to " dev_err(&port_priv->device->dev,
"RTR: %d\n", i, ret); "Couldn't change QP%d state to RTR: %d\n",
i, ret);
goto out; goto out;
} }
@ -2722,16 +2733,18 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv)
attr->sq_psn = IB_MAD_SEND_Q_PSN; attr->sq_psn = IB_MAD_SEND_Q_PSN;
ret = ib_modify_qp(qp, attr, IB_QP_STATE | IB_QP_SQ_PSN); ret = ib_modify_qp(qp, attr, IB_QP_STATE | IB_QP_SQ_PSN);
if (ret) { if (ret) {
printk(KERN_ERR PFX "Couldn't change QP%d state to " dev_err(&port_priv->device->dev,
"RTS: %d\n", i, ret); "Couldn't change QP%d state to RTS: %d\n",
i, ret);
goto out; goto out;
} }
} }
ret = ib_req_notify_cq(port_priv->cq, IB_CQ_NEXT_COMP); ret = ib_req_notify_cq(port_priv->cq, IB_CQ_NEXT_COMP);
if (ret) { if (ret) {
printk(KERN_ERR PFX "Failed to request completion " dev_err(&port_priv->device->dev,
"notification: %d\n", ret); "Failed to request completion notification: %d\n",
ret);
goto out; goto out;
} }
@ -2741,7 +2754,8 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv)
ret = ib_mad_post_receive_mads(&port_priv->qp_info[i], NULL); ret = ib_mad_post_receive_mads(&port_priv->qp_info[i], NULL);
if (ret) { if (ret) {
printk(KERN_ERR PFX "Couldn't post receive WRs\n"); dev_err(&port_priv->device->dev,
"Couldn't post receive WRs\n");
goto out; goto out;
} }
} }
@ -2755,7 +2769,8 @@ static void qp_event_handler(struct ib_event *event, void *qp_context)
struct ib_mad_qp_info *qp_info = qp_context; struct ib_mad_qp_info *qp_info = qp_context;
/* It's worse than that! He's dead, Jim! */ /* It's worse than that! He's dead, Jim! */
printk(KERN_ERR PFX "Fatal error (%d) on MAD QP (%d)\n", dev_err(&qp_info->port_priv->device->dev,
"Fatal error (%d) on MAD QP (%d)\n",
event->event, qp_info->qp->qp_num); event->event, qp_info->qp->qp_num);
} }
@ -2801,8 +2816,9 @@ static int create_mad_qp(struct ib_mad_qp_info *qp_info,
qp_init_attr.event_handler = qp_event_handler; qp_init_attr.event_handler = qp_event_handler;
qp_info->qp = ib_create_qp(qp_info->port_priv->pd, &qp_init_attr); qp_info->qp = ib_create_qp(qp_info->port_priv->pd, &qp_init_attr);
if (IS_ERR(qp_info->qp)) { if (IS_ERR(qp_info->qp)) {
printk(KERN_ERR PFX "Couldn't create ib_mad QP%d\n", dev_err(&qp_info->port_priv->device->dev,
get_spl_qp_index(qp_type)); "Couldn't create ib_mad QP%d\n",
get_spl_qp_index(qp_type));
ret = PTR_ERR(qp_info->qp); ret = PTR_ERR(qp_info->qp);
goto error; goto error;
} }
@ -2840,7 +2856,7 @@ static int ib_mad_port_open(struct ib_device *device,
/* Create new device info */ /* Create new device info */
port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL); port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL);
if (!port_priv) { if (!port_priv) {
printk(KERN_ERR PFX "No memory for ib_mad_port_private\n"); dev_err(&device->dev, "No memory for ib_mad_port_private\n");
return -ENOMEM; return -ENOMEM;
} }
@ -2860,21 +2876,21 @@ static int ib_mad_port_open(struct ib_device *device,
ib_mad_thread_completion_handler, ib_mad_thread_completion_handler,
NULL, port_priv, cq_size, 0); NULL, port_priv, cq_size, 0);
if (IS_ERR(port_priv->cq)) { if (IS_ERR(port_priv->cq)) {
printk(KERN_ERR PFX "Couldn't create ib_mad CQ\n"); dev_err(&device->dev, "Couldn't create ib_mad CQ\n");
ret = PTR_ERR(port_priv->cq); ret = PTR_ERR(port_priv->cq);
goto error3; goto error3;
} }
port_priv->pd = ib_alloc_pd(device); port_priv->pd = ib_alloc_pd(device);
if (IS_ERR(port_priv->pd)) { if (IS_ERR(port_priv->pd)) {
printk(KERN_ERR PFX "Couldn't create ib_mad PD\n"); dev_err(&device->dev, "Couldn't create ib_mad PD\n");
ret = PTR_ERR(port_priv->pd); ret = PTR_ERR(port_priv->pd);
goto error4; goto error4;
} }
port_priv->mr = ib_get_dma_mr(port_priv->pd, IB_ACCESS_LOCAL_WRITE); port_priv->mr = ib_get_dma_mr(port_priv->pd, IB_ACCESS_LOCAL_WRITE);
if (IS_ERR(port_priv->mr)) { if (IS_ERR(port_priv->mr)) {
printk(KERN_ERR PFX "Couldn't get ib_mad DMA MR\n"); dev_err(&device->dev, "Couldn't get ib_mad DMA MR\n");
ret = PTR_ERR(port_priv->mr); ret = PTR_ERR(port_priv->mr);
goto error5; goto error5;
} }
@ -2902,7 +2918,7 @@ static int ib_mad_port_open(struct ib_device *device,
ret = ib_mad_port_start(port_priv); ret = ib_mad_port_start(port_priv);
if (ret) { if (ret) {
printk(KERN_ERR PFX "Couldn't start port\n"); dev_err(&device->dev, "Couldn't start port\n");
goto error9; goto error9;
} }
@ -2946,7 +2962,7 @@ static int ib_mad_port_close(struct ib_device *device, int port_num)
port_priv = __ib_get_mad_port(device, port_num); port_priv = __ib_get_mad_port(device, port_num);
if (port_priv == NULL) { if (port_priv == NULL) {
spin_unlock_irqrestore(&ib_mad_port_list_lock, flags); spin_unlock_irqrestore(&ib_mad_port_list_lock, flags);
printk(KERN_ERR PFX "Port %d not found\n", port_num); dev_err(&device->dev, "Port %d not found\n", port_num);
return -ENODEV; return -ENODEV;
} }
list_del_init(&port_priv->port_list); list_del_init(&port_priv->port_list);
@ -2984,14 +3000,12 @@ static void ib_mad_init_device(struct ib_device *device)
for (i = start; i <= end; i++) { for (i = start; i <= end; i++) {
if (ib_mad_port_open(device, i)) { if (ib_mad_port_open(device, i)) {
printk(KERN_ERR PFX "Couldn't open %s port %d\n", dev_err(&device->dev, "Couldn't open port %d\n", i);
device->name, i);
goto error; goto error;
} }
if (ib_agent_port_open(device, i)) { if (ib_agent_port_open(device, i)) {
printk(KERN_ERR PFX "Couldn't open %s port %d " dev_err(&device->dev,
"for agents\n", "Couldn't open port %d for agents\n", i);
device->name, i);
goto error_agent; goto error_agent;
} }
} }
@ -2999,20 +3013,17 @@ static void ib_mad_init_device(struct ib_device *device)
error_agent: error_agent:
if (ib_mad_port_close(device, i)) if (ib_mad_port_close(device, i))
printk(KERN_ERR PFX "Couldn't close %s port %d\n", dev_err(&device->dev, "Couldn't close port %d\n", i);
device->name, i);
error: error:
i--; i--;
while (i >= start) { while (i >= start) {
if (ib_agent_port_close(device, i)) if (ib_agent_port_close(device, i))
printk(KERN_ERR PFX "Couldn't close %s port %d " dev_err(&device->dev,
"for agents\n", "Couldn't close port %d for agents\n", i);
device->name, i);
if (ib_mad_port_close(device, i)) if (ib_mad_port_close(device, i))
printk(KERN_ERR PFX "Couldn't close %s port %d\n", dev_err(&device->dev, "Couldn't close port %d\n", i);
device->name, i);
i--; i--;
} }
} }
@ -3033,12 +3044,12 @@ static void ib_mad_remove_device(struct ib_device *device)
} }
for (i = 0; i < num_ports; i++, cur_port++) { for (i = 0; i < num_ports; i++, cur_port++) {
if (ib_agent_port_close(device, cur_port)) if (ib_agent_port_close(device, cur_port))
printk(KERN_ERR PFX "Couldn't close %s port %d " dev_err(&device->dev,
"for agents\n", "Couldn't close port %d for agents\n",
device->name, cur_port); cur_port);
if (ib_mad_port_close(device, cur_port)) if (ib_mad_port_close(device, cur_port))
printk(KERN_ERR PFX "Couldn't close %s port %d\n", dev_err(&device->dev, "Couldn't close port %d\n",
device->name, cur_port); cur_port);
} }
} }
@ -3064,7 +3075,7 @@ static int __init ib_mad_init_module(void)
SLAB_HWCACHE_ALIGN, SLAB_HWCACHE_ALIGN,
NULL); NULL);
if (!ib_mad_cache) { if (!ib_mad_cache) {
printk(KERN_ERR PFX "Couldn't create ib_mad cache\n"); pr_err("Couldn't create ib_mad cache\n");
ret = -ENOMEM; ret = -ENOMEM;
goto error1; goto error1;
} }
@ -3072,7 +3083,7 @@ static int __init ib_mad_init_module(void)
INIT_LIST_HEAD(&ib_mad_port_list); INIT_LIST_HEAD(&ib_mad_port_list);
if (ib_register_client(&mad_client)) { if (ib_register_client(&mad_client)) {
printk(KERN_ERR PFX "Couldn't register ib_mad client\n"); pr_err("Couldn't register ib_mad client\n");
ret = -EINVAL; ret = -EINVAL;
goto error2; goto error2;
} }

View File

@ -42,9 +42,6 @@
#include <rdma/ib_mad.h> #include <rdma/ib_mad.h>
#include <rdma/ib_smi.h> #include <rdma/ib_smi.h>
#define PFX "ib_mad: "
#define IB_MAD_QPS_CORE 2 /* Always QP0 and QP1 as a minimum */ #define IB_MAD_QPS_CORE 2 /* Always QP0 and QP1 as a minimum */
/* QP and CQ parameters */ /* QP and CQ parameters */