diff --git a/Documentation/libtracefs-hist-cont.txt b/Documentation/libtracefs-hist-cont.txt
index 1b0153c..d584b46 100644
--- a/Documentation/libtracefs-hist-cont.txt
+++ b/Documentation/libtracefs-hist-cont.txt
@@ -82,15 +82,15 @@ int main (int argc, char **argv, char **env)
 		exit(-1);
 	}
 
-	hist = tracefs_hist_alloc(instance, "kmem", "kmalloc",
-				  "call_site", TRACEFS_HIST_KEY_SYM);
+	hist = tracefs_hist2d_alloc(instance, "kmem", "kmalloc",
+				    "call_site", TRACEFS_HIST_KEY_SYM,
+				    "bytes_req", 0);
 	if (!hist) {
 		fprintf(stderr, "Failed hist create\n");
 		exit(-1);
 	}
 
-	ret = tracefs_hist_add_key(hist, "bytes_req", 0);
-	ret |= tracefs_hist_add_value(hist, "bytes_alloc");
+	ret = tracefs_hist_add_value(hist, "bytes_alloc");
 	ret |= tracefs_hist_add_sort_key(hist, "bytes_req", "bytes_alloc", NULL);
 
 	ret |= tracefs_hist_sort_key_direction(hist, "bytes_alloc",
diff --git a/Documentation/libtracefs-hist.txt b/Documentation/libtracefs-hist.txt
index 0254c5f..692f488 100644
--- a/Documentation/libtracefs-hist.txt
+++ b/Documentation/libtracefs-hist.txt
@@ -186,15 +186,15 @@ int main (int argc, char **argv, char **env)
 		exit(-1);
 	}
 
-	hist = tracefs_hist_alloc(instance, "kmem", "kmalloc",
-				  "call_site", TRACEFS_HIST_KEY_SYM);
+	hist = tracefs_hist2d_alloc(instance, "kmem", "kmalloc",
+				    "call_site", TRACEFS_HIST_KEY_SYM,
+				    "bytes_req", 0);
 	if (!hist) {
 		fprintf(stderr, "Failed hist create\n");
 		exit(-1);
 	}
 
-	ret = tracefs_hist_add_key(hist, "bytes_req", 0);
-	ret |= tracefs_hist_add_value(hist, "bytes_alloc");
+	ret = tracefs_hist_add_value(hist, "bytes_alloc");
 	ret |= tracefs_hist_add_sort_key(hist, "bytes_req", "bytes_alloc", NULL);
 
 	ret |= tracefs_hist_sort_key_direction(hist, "bytes_alloc",
diff --git a/include/tracefs.h b/include/tracefs.h
index 255be9b..5c193a2 100644
--- a/include/tracefs.h
+++ b/include/tracefs.h
@@ -303,8 +303,6 @@ const char *tracefs_get_hist_name(struct tracefs_hist *hist);
 const char *tracefs_get_hist_event(struct tracefs_hist *hist);
 const char *tracefs_get_hist_system(struct tracefs_hist *hist);
 struct tracefs_instance *tracefs_get_hist_instance(struct tracefs_hist *hist);
-int tracefs_hist_add_key(struct tracefs_hist *hist, const char *key,
-			 enum tracefs_hist_key_type type);
 int tracefs_hist_add_value(struct tracefs_hist *hist, const char *value);
 int tracefs_hist_add_sort_key(struct tracefs_hist *hist,
 			      char *sort_key);
diff --git a/src/tracefs-hist.c b/src/tracefs-hist.c
index 175b627..b71b0e3 100644
--- a/src/tracefs-hist.c
+++ b/src/tracefs-hist.c
@@ -217,6 +217,55 @@ tracefs_hist2d_alloc(struct tracefs_instance * instance,
 	return tracefs_hist_alloc(instance, system, event, axis);
 }
 
+static int add_hist_key(struct tracefs_hist *hist, const char *key,
+			 enum tracefs_hist_key_type type)
+{
+	bool use_key = false;
+	char *key_type = NULL;
+	char **new_list;
+	int ret;
+
+	switch (type) {
+	case TRACEFS_HIST_KEY_NORMAL:
+		use_key = true;
+		ret = 0;
+		break;
+	case TRACEFS_HIST_KEY_HEX:
+		ret = asprintf(&key_type, "%s.hex", key);
+		break;
+	case TRACEFS_HIST_KEY_SYM:
+		ret = asprintf(&key_type, "%s.sym", key);
+		break;
+	case TRACEFS_HIST_KEY_SYM_OFFSET:
+		ret = asprintf(&key_type, "%s.sym-offset", key);
+		break;
+	case TRACEFS_HIST_KEY_SYSCALL:
+		ret = asprintf(&key_type, "%s.syscall", key);
+		break;
+	case TRACEFS_HIST_KEY_EXECNAME:
+		ret = asprintf(&key_type, "%s.execname", key);
+		break;
+	case TRACEFS_HIST_KEY_LOG:
+		ret = asprintf(&key_type, "%s.log2", key);
+		break;
+	case TRACEFS_HIST_KEY_USECS:
+		ret = asprintf(&key_type, "%s.usecs", key);
+		break;
+	}
+
+	if (ret < 0)
+		return -1;
+
+	new_list = tracefs_list_add(hist->keys, use_key ? key : key_type);
+	free(key_type);
+	if (!new_list)
+		return -1;
+
+	hist->keys = new_list;
+
+	return 0;
+}
+
 /**
  * tracefs_hist_alloc - Initialize N-dimensional histogram
  * @instance: The instance the histogram will be in (NULL for toplevel)
@@ -262,7 +311,7 @@ tracefs_hist_alloc(struct tracefs_instance * instance,
 		goto fail;
 
 	for (; axes && axes->key; axes++)
-		if (tracefs_hist_add_key(hist, axes->key, axes->type) < 0)
+		if (add_hist_key(hist, axes->key, axes->type) < 0)
 			goto fail;
 
 	return hist;
@@ -272,65 +321,6 @@ tracefs_hist_alloc(struct tracefs_instance * instance,
 	return NULL;
 }
 
-/**
- * tracefs_hist_add_key - add to a key to a histogram
- * @hist: The histogram to add the key to.
- * @key: The name of the key field.
- * @type: The type of the key format.
- *
- * This adds a secondary or tertiary key to the histogram.
- *
- * Returns 0 on success, -1 on error.
- */
-int tracefs_hist_add_key(struct tracefs_hist *hist, const char *key,
-			 enum tracefs_hist_key_type type)
-{
-	bool use_key = false;
-	char *key_type = NULL;
-	char **new_list;
-	int ret;
-
-	switch (type) {
-	case TRACEFS_HIST_KEY_NORMAL:
-		use_key = true;
-		ret = 0;
-		break;
-	case TRACEFS_HIST_KEY_HEX:
-		ret = asprintf(&key_type, "%s.hex", key);
-		break;
-	case TRACEFS_HIST_KEY_SYM:
-		ret = asprintf(&key_type, "%s.sym", key);
-		break;
-	case TRACEFS_HIST_KEY_SYM_OFFSET:
-		ret = asprintf(&key_type, "%s.sym-offset", key);
-		break;
-	case TRACEFS_HIST_KEY_SYSCALL:
-		ret = asprintf(&key_type, "%s.syscall", key);
-		break;
-	case TRACEFS_HIST_KEY_EXECNAME:
-		ret = asprintf(&key_type, "%s.execname", key);
-		break;
-	case TRACEFS_HIST_KEY_LOG:
-		ret = asprintf(&key_type, "%s.log2", key);
-		break;
-	case TRACEFS_HIST_KEY_USECS:
-		ret = asprintf(&key_type, "%s.usecs", key);
-		break;
-	}
-
-	if (ret < 0)
-		return -1;
-
-	new_list = tracefs_list_add(hist->keys, use_key ? key : key_type);
-	free(key_type);
-	if (!new_list)
-		return -1;
-
-	hist->keys = new_list;
-
-	return 0;
-}
-
 /**
  * tracefs_hist_add_value - add to a value to a histogram
  * @hist: The histogram to add the value to.
