purge linux/gfp.h usage

Inline or drop usage of this header so we can drop it.

BUG=chromium:878440
TEST=build works

Change-Id: I86ef7e7c9059f518c84aa900e53e091160776f7f
Reviewed-on: https://chromium-review.googlesource.com/1194902
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
diff --git a/dm-bht-userspace.c b/dm-bht-userspace.c
index c17a6bf..457ff83 100644
--- a/dm-bht-userspace.c
+++ b/dm-bht-userspace.c
@@ -11,7 +11,6 @@
 
 #include <asm/page.h>
 #include <linux/device-mapper.h>
-#include <linux/gfp.h>
 #include <linux/scatterlist.h>
 
 #include "verity/dm-bht.h"
diff --git a/dm-bht.c b/dm-bht.c
index 74031be..70add0b 100644
--- a/dm-bht.c
+++ b/dm-bht.c
@@ -15,7 +15,6 @@
 /* #define CONFIG_DM_DEBUG 1 */
 #include <linux/device-mapper.h>
 #include <linux/errno.h>
-#include <linux/gfp.h>
 #include <linux/kernel.h>
 #include <linux/scatterlist.h>
 
@@ -39,6 +38,17 @@
 #define nr_cpu_ids 1
 #define smp_processor_id(_x) 0
 
+static inline struct page *alloc_page(void)
+{
+	struct page *memptr;
+
+	if (posix_memalign((void **)&memptr,
+			   sizeof(struct page),
+			   sizeof(struct page)))
+	    return NULL;
+	return memptr;
+}
+
 static u8 from_hex(u8 ch)
 {
 	if ((ch >= '0') && (ch <= '9'))
@@ -496,7 +506,7 @@
 			continue;
 
 		/* Current entry is claimed for allocation and loading */
-		pg = alloc_page(GFP_NOIO);
+		pg = alloc_page();
 		if (!pg)
 			goto nomem;
 
@@ -569,7 +579,7 @@
 				continue;
 			default:
 				BUG_ON(!entry->nodes);
-				__free_page(virt_to_page(entry->nodes));
+				free(virt_to_page(entry->nodes));
 				break;
 			}
 		}
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
deleted file mode 100644
index ba70cb4..0000000
--- a/include/linux/gfp.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 2012 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by the GPL v2 license that can
- * be found in the LICENSE file.
- *
- * Parts of this file are derived from the Linux kernel from the file with
- * the same name and path under include/.
- */
-#ifndef VERITY_INCLUDE_LINUX_GFP_H_
-#define VERITY_INCLUDE_LINUX_GFP_H_
-
-#include <stdlib.h>
-
-#define GFP_KERNEL 0
-#define GFP_NOIO 1
-
-static inline struct page *alloc_page(int flags)
-{
-	struct page *memptr;
-
-	if (posix_memalign((void **)&memptr,
-			   sizeof(struct page),
-			   sizeof(struct page)))
-	    return NULL;
-	return memptr;
-}
-
-static inline void __free_page(struct page *page)
-{
-	free(page);
-}
-
-#endif  /* VERITY_INCLUDE_LINUX_GFP_H_ */