logging: Calculate LOG_MAX_{CTX,FILTERS} from the enum

Change-Id: I1ee1278b029e42321932b87f94aa3e0eeed4108a
Related: SYS#5232
diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 6d0d5a3..38b465c 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -11,11 +11,6 @@
 #include <osmocom/core/defs.h>
 #include <osmocom/core/linuxlist.h>
 
-/*! Maximum number of logging contexts */
-#define LOG_MAX_CTX		8
-/*! Maximum number of logging filters */
-#define LOG_MAX_FILTERS	8
-
 #ifndef DEBUG
 #define DEBUG
 #endif
@@ -162,11 +157,6 @@
 	uint8_t enabled;		/*!< is this category enabled or not */
 };
 
-/*! Log context information, passed to filter */
-struct log_context {
-	void *ctx[LOG_MAX_CTX+1];
-};
-
 /*! Indexes to indicate the object currently acted upon.
  * Array indexes for the global \a log_context array. */
 enum log_ctx_index {
@@ -191,6 +181,16 @@
 	_LOG_FLT_COUNT
 };
 
+/*! Maximum number of logging contexts */
+#define LOG_MAX_CTX	_LOG_CTX_COUNT
+/*! Maximum number of logging filters */
+#define LOG_MAX_FILTERS	_LOG_FLT_COUNT
+
+/*! Log context information, passed to filter */
+struct log_context {
+	void *ctx[LOG_MAX_CTX+1];
+};
+
 /*! Compatibility with older libosmocore versions */
 #define LOG_FILTER_ALL (1<<LOG_FLT_ALL)
 /*! Compatibility with older libosmocore versions */