[openib-general] [PATCH] remove add_mad_reg_req function

Sean Hefty mshefty at ichips.intel.com
Thu Dec 9 15:49:16 PST 2004


This patch removes add_mad_reg_req(), which removes redundant checks in the
code.

- Sean

Index: core/mad.c
===================================================================
--- core/mad.c	(revision 1317)
+++ core/mad.c	(working copy)
@@ -80,8 +80,6 @@
 /* Forward declarations */
 static int method_in_use(struct ib_mad_mgmt_method_table **method,
 			 struct ib_mad_reg_req *mad_reg_req);
-static int add_mad_reg_req(struct ib_mad_reg_req *mad_reg_req,
-			   struct ib_mad_agent_private *priv);
 static void remove_mad_reg_req(struct ib_mad_agent_private *priv); 
 static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info,
 				    struct ib_mad_private *mad);
@@ -321,6 +319,8 @@
 						goto error3;
 				}
 			}
+			ret2 = add_nonoui_reg_req(mad_reg_req, mad_agent_priv,
+						  mgmt_class);
 		} else {
 			/* "New" vendor class range */
 			vendor = port_priv->version[mad_reg_req->
@@ -335,13 +335,12 @@
 						goto error3;
 				}
 			}
+			ret2 = add_oui_reg_req(mad_reg_req, mad_agent_priv);
+		}
+		if (ret2) {
+			ret = ERR_PTR(ret2);	
+			goto error3;	
 		}
-	}
-
-	ret2 = add_mad_reg_req(mad_reg_req, mad_agent_priv);
-	if (ret2) {
-		ret = ERR_PTR(ret2);	
-		goto error3;	
 	}
 
 	/* Add mad agent into port's agent list */
@@ -1007,24 +1006,6 @@
 	return ret;
 }
 
-static int add_mad_reg_req(struct ib_mad_reg_req *mad_reg_req,
-			   struct ib_mad_agent_private *priv)
-{
-	int ret;
-	u8 mgmt_class;
-
-	/* Make sure MAD registration request supplied */
-	if (!mad_reg_req)
-		return 0;
-
-	mgmt_class = convert_mgmt_class(mad_reg_req->mgmt_class);
-	if (!is_vendor_class(mgmt_class))
-		ret = add_nonoui_reg_req(mad_reg_req, priv, mgmt_class);
-	else
-		ret = add_oui_reg_req(mad_reg_req, priv);
-	return ret;
-}
-
 static void remove_mad_reg_req(struct ib_mad_agent_private *agent_priv)
 {
 	struct ib_mad_port_private *port_priv;



More information about the general mailing list