From 0cbb613fa82fb09b6ef914ab0aaa92091f367bb6 Mon Sep 17 00:00:00 2001
From: Seth Jennings <sjenning@linux.vnet.ibm.com>
Date: Mon, 13 Feb 2012 08:47:49 -0600
Subject: [PATCH] staging: fix powerpc linux-next break on zsmalloc

linux/vmalloc.h added to zsmalloc-main.c to resolve implicit
declaration errors.

X86 dependency added to zsmalloc and dependent drivers zcache and zram.

This X86 only requirement is not ideal.  Working to find portable
functions for __flush_tlb_one and set_pte.

Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/zcache/Kconfig           | 4 +++-
 drivers/staging/zram/Kconfig             | 4 +++-
 drivers/staging/zsmalloc/Kconfig         | 5 ++++-
 drivers/staging/zsmalloc/zsmalloc-main.c | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/zcache/Kconfig b/drivers/staging/zcache/Kconfig
index 94e48aa9f36b..5a36fcfd87c0 100644
--- a/drivers/staging/zcache/Kconfig
+++ b/drivers/staging/zcache/Kconfig
@@ -1,6 +1,8 @@
 config ZCACHE
 	tristate "Dynamic compression of swap pages and clean pagecache pages"
-	depends on (CLEANCACHE || FRONTSWAP) && CRYPTO
+	# X86 dependency is because zsmalloc uses non-portable pte/tlb
+	# functions
+	depends on (CLEANCACHE || FRONTSWAP) && CRYPTO && X86
 	select ZSMALLOC
 	select CRYPTO_LZO
 	default n
diff --git a/drivers/staging/zram/Kconfig b/drivers/staging/zram/Kconfig
index ee23a86ea7d5..9d11a4cb99b7 100644
--- a/drivers/staging/zram/Kconfig
+++ b/drivers/staging/zram/Kconfig
@@ -1,6 +1,8 @@
 config ZRAM
 	tristate "Compressed RAM block device support"
-	depends on BLOCK && SYSFS
+	# X86 dependency is because zsmalloc uses non-portable pte/tlb
+	# functions
+	depends on BLOCK && SYSFS && X86
 	select ZSMALLOC
 	select LZO_COMPRESS
 	select LZO_DECOMPRESS
diff --git a/drivers/staging/zsmalloc/Kconfig b/drivers/staging/zsmalloc/Kconfig
index 3e7a8d4d2172..8e2c6a05a178 100644
--- a/drivers/staging/zsmalloc/Kconfig
+++ b/drivers/staging/zsmalloc/Kconfig
@@ -1,6 +1,9 @@
 config ZSMALLOC
 	tristate "Memory allocator for compressed pages"
-	depends on SPARSEMEM
+	# X86 dependency is because of the use of __flush_tlb_one and set_pte
+	# in zsmalloc-main.c.
+	# TODO: convert these to portable functions
+	depends on SPARSEMEM && X86
 	default n
 	help
 	  zsmalloc is a slab-based memory allocator designed to store
diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
index 189fb42313bb..455fc2f97246 100644
--- a/drivers/staging/zsmalloc/zsmalloc-main.c
+++ b/drivers/staging/zsmalloc/zsmalloc-main.c
@@ -26,6 +26,7 @@
 #include <asm/pgtable.h>
 #include <linux/cpumask.h>
 #include <linux/cpu.h>
+#include <linux/vmalloc.h>
 
 #include "zsmalloc.h"
 #include "zsmalloc_int.h"
-- 
2.30.9