diff --git a/include/keystone/keystone.h b/include/keystone/keystone.h
index 002c03da82e3f462701136e5609426f9ae2d1185..07078ff9947598e61e95d33785544620f08cb325 100644
--- a/include/keystone/keystone.h
+++ b/include/keystone/keystone.h
@@ -196,7 +196,7 @@ bool ks_arch_supported(ks_arch arch);
    for detailed error).
 */
 KEYSTONE_EXPORT
-ks_err ks_open(ks_arch arch, ks_mode mode, ks_engine **ks);
+ks_err ks_open(ks_arch arch, int mode, ks_engine **ks);
 
 
 /*
diff --git a/llvm/keystone/ks.cpp b/llvm/keystone/ks.cpp
index eabd4e10bda137858db7fb6c2312d98b8395a9c7..0c8d14448d0a4ad448258ae2ab832dba0981e2b8 100644
--- a/llvm/keystone/ks.cpp
+++ b/llvm/keystone/ks.cpp
@@ -167,7 +167,7 @@ static ks_err InitKs(ks_engine *ks, std::string TripleName)
 
 
 KEYSTONE_EXPORT
-ks_err ks_open(ks_arch arch, ks_mode mode, ks_engine **result)
+ks_err ks_open(ks_arch arch, int mode, ks_engine **result)
 {
     struct ks_struct *ks;
     std::string TripleName = "";
diff --git a/llvm/keystone/ks_priv.h b/llvm/keystone/ks_priv.h
index 56ba7c45819e56e6dcd679c9165495a4d091a40b..c236286e220d6f0c5ddb20bc0582211c895e0781 100644
--- a/llvm/keystone/ks_priv.h
+++ b/llvm/keystone/ks_priv.h
@@ -38,7 +38,7 @@ typedef void (*ks_args_ks_t)(struct ks_struct*);
 
 struct ks_struct {
     ks_arch arch;
-    ks_mode mode;
+    int mode;
     unsigned int errnum;
     ks_opt_value syntax;