[openib-general] [PATCH][kdapl] Integrate dapl_hca_alloc/dapl_hca_free to dapl_provider.c

Itamar Rabenstein itamar at mellanox.co.il
Mon Jun 20 01:50:10 PDT 2005


ntegrate dapl_hca_alloc/dapl_hca_free to dapl_provider.c
(no need for 2 files just for 2 simple function that kmalloc and kfree.
 There is not any special logic in this functions that need to separate
 them into different files)

Signed-off-by: Itamar Rabenstein <itamar at mellanox.co.il>

diff -Nurp -X dontdiff dat-provider_link_ia/Makefile dat-provider/Makefile
--- dat-provider_link_ia/Makefile	Sun Jun 19 18:43:16 2005
+++ dat-provider/Makefile	Sun Jun 19 19:45:15 2005
@@ -20,7 +20,6 @@ PROVIDER_MODULES := \
         dapl_cr                  	\
         dapl_ep                         \
         dapl_evd                        \
-        dapl_hca_util                 	\
         dapl_ia                  	\
         dapl_lmr                 	\
         dapl_provider                 	\
diff -Nurp -X dontdiff dat-provider_link_ia/dapl_hca_util.c dat-provider/dapl_hca_util.c
--- dat-provider_link_ia/dapl_hca_util.c	Sun Jun 19 18:43:16 2005
+++ dat-provider/dapl_hca_util.c	Thu Jan  1 02:00:00 1970
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
- * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
- *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- *    available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is
- *    available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- *    copy of which is available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-/*
- * $Id: dapl_hca_util.c 2640 2005-06-16 16:22:46Z jlentini $
- */
-
-#include "dapl.h"
-#include "dapl_openib_util.h"
-#include "dapl_provider.h"
-#include "dapl_hca_util.h"
-
-/*
- * dapl_hca_alloc
- *
- * alloc and initialize an HCA struct
- *
- * Input:
- * 	name
- *      port
- *
- * Output:
- * 	hca
- *
- * Returns:
- * 	none
- *
- */
-struct dapl_hca *dapl_hca_alloc(char *name, struct ib_device *device, u8 port)
-{
-	struct dapl_hca *hca;
-	int malloc_size = sizeof *hca + strlen(name) + 1;
-		 
-	hca = kmalloc(malloc_size, GFP_ATOMIC);
-	if (hca) {
-		memset(hca, 0, malloc_size);
-		spin_lock_init(&hca->lock);
-		INIT_LIST_HEAD(&hca->ia_list);
-		hca->name = (char *)hca + sizeof *hca;
-		strcpy(hca->name, name);
-		hca->ib_hca_handle = device;
-		hca->port_num = port;
-	}
-	return hca;
-}
-
-/*
- * dapl_hca_free
- *
- * free an IA INFO struct
- *
- * Input:
- * 	hca
- *
- * Output:
- * 	none
- *
- * Returns:
- * 	none
- *
- */
-void dapl_hca_free(struct dapl_hca *hca)
-{
-	kfree(hca);
-}
diff -Nurp -X dontdiff dat-provider_link_ia/dapl_hca_util.h dat-provider/dapl_hca_util.h
--- dat-provider_link_ia/dapl_hca_util.h	Sun Jun 19 18:43:16 2005
+++ dat-provider/dapl_hca_util.h	Thu Jan  1 02:00:00 1970
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
- * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
- *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- *    available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is
- *    available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- *    copy of which is available from the Open Source Initiative, see
- *    http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-/*
- * $Id: dapl_hca_util.h 2640 2005-06-16 16:22:46Z jlentini $
- */
-
-#ifndef DAPL_HCA_UTIL_H
-#define DAPL_HCA_UTIL_H
-
-#include "dapl.h"
-
-struct dapl_hca *dapl_hca_alloc(char *name, struct ib_device *device, u8 port);
-
-void dapl_hca_free(struct dapl_hca *hca);
-
-#endif
diff -Nurp -X dontdiff dat-provider_link_ia/dapl_provider.c dat-provider/dapl_provider.c
--- dat-provider_link_ia/dapl_provider.c	Sun Jun 19 18:43:16 2005
+++ dat-provider/dapl_provider.c	Sun Jun 19 19:47:16 2005
@@ -35,7 +35,6 @@
 #include <dat.h>
 
 #include "dapl.h"
-#include "dapl_hca_util.h"
 #include "dapl_provider.h"
 #include "dapl_util.h"
 #include "dapl_openib_util.h"
@@ -246,6 +245,24 @@ static void dapl_provider_info_init(stru
 	provider_info->ia_name[i+1] = '\0';
 }
 
+static struct dapl_hca *dapl_hca_alloc(char *name, struct ib_device *device, u8 port)
+{
+	struct dapl_hca *hca;
+	int malloc_size = sizeof *hca + strlen(name) + 1;
+		 
+	hca = kmalloc(malloc_size, GFP_ATOMIC);
+	if (hca) {
+		memset(hca, 0, malloc_size);
+		spin_lock_init(&hca->lock);
+		INIT_LIST_HEAD(&hca->ia_list);
+		hca->name = (char *)hca + sizeof *hca;
+		strcpy(hca->name, name);
+		hca->ib_hca_handle = device;
+		hca->port_num = port;
+	}
+	return hca;
+}
+
 static void dapl_add_port(struct ib_device *device, u8 port)
 {
 	struct dat_provider_info provider_info;
@@ -305,7 +322,7 @@ error:
 			(void)dapl_provider_list_remove(provider_info.ia_name);
 
 		if (NULL != hca)
-			dapl_hca_free(hca);
+			kfree(hca);
 	}
 }
 
@@ -338,7 +355,7 @@ static void dapl_remove_port(struct ib_d
 			     provider_info.ia_name);
 	}
 
-	dapl_hca_free(provider->extension);
+	kfree(provider->extension);
 
 	dapl_provider_list_remove(provider_info.ia_name);
 }
-- 
Itamar



More information about the general mailing list