[openib-general] [PATCH] kDAPL: remove dat_os_realloc()

Tom Duffy tduffy at sun.com
Thu Jun 23 16:14:36 PDT 2005


There was only one user of the dat_os_realloc() function.  Roll it into
the base function.

Signed-off-by: Tom Duffy <tduffy at sun.com>

Index: linux-kernel/dat-provider/dapl_evd.c
===================================================================
--- linux-kernel/dat-provider/dapl_evd.c	(revision 2704)
+++ linux-kernel/dat-provider/dapl_evd.c	(working copy)
@@ -191,13 +191,15 @@ bail:
 static u32 dapl_evd_event_realloc(struct dapl_evd *evd, int qlen)
 {
 	struct dat_event *events;
-	int i, old_qlen, diff;
+	int i, old_qlen, diff, size;
 	u32 status;
 
-	/* Allocate EVENTs */
-	events = (struct dat_event *)dapl_os_realloc(evd->events,
-						     qlen * sizeof *events);
-	if (!events) {
+	size = qlen * sizeof *events;
+	events = kmalloc(size, GFP_ATOMIC);
+	if (events) {
+		memcpy(events, evd->events, size);
+		kfree(evd->events);
+	} else {
 		status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES,
 				   DAT_RESOURCE_MEMORY);
 		goto bail;
Index: linux-kernel/dat-provider/dapl_util.h
===================================================================
--- linux-kernel/dat-provider/dapl_util.h	(revision 2704)
+++ linux-kernel/dat-provider/dapl_util.h	(working copy)
@@ -89,23 +89,6 @@ static inline int dapl_os_atomic_assign(
 }
 
 /*
- * Memory Functions
- */
-
-static inline void *dapl_os_realloc(void *ptr, int size)
-{
-	void *newptr;
-
-	newptr = kmalloc(size, GFP_ATOMIC);
-	if (newptr) {
-		/* copy the mem array to the new */
-		memcpy(newptr, ptr, size);
-		kfree(ptr);
-	}
-	return newptr;
-}
-
-/*
  * *printf format helper. We use the C string constant concatenation
  * ability to define 64 bit formats, which unfortunatly are non standard
  * in the C compiler world. 




More information about the general mailing list