Define max nesting count constant
authorFrancis Giraldeau <francis.giraldeau@gmail.com>
Wed, 3 Sep 2014 19:47:21 +0000 (15:47 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 11 Jun 2018 18:38:54 +0000 (14:38 -0400)
Extract the constant within the code as #define. The define is added to
frontend.h in order to be included in other source files.

Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/ringbuffer/frontend.h
lib/ringbuffer/frontend_api.h

index 1450cb7faf415d7e73f53b07101b534382474b53..ba96d9a6a215e09f4975e56e45500629dab48e1e 100644 (file)
@@ -51,6 +51,9 @@
 /* Internal helpers */
 #include <wrapper/ringbuffer/frontend_internal.h>
 
+/* Max ring buffer nesting count, see lib_ring_buffer_get_cpu(). */
+#define RING_BUFFER_MAX_NESTING 4
+
 /* Buffer creation/removal and setup operations */
 
 /*
index 23118c46d98d8cbfa424131e4ca9454ab2e89254..b4a8db898d75af10d829cce5378cfb74c4a34621 100644 (file)
@@ -58,7 +58,7 @@ int lib_ring_buffer_get_cpu(const struct lib_ring_buffer_config *config)
        nesting = ++per_cpu(lib_ring_buffer_nesting, cpu);
        barrier();
 
-       if (unlikely(nesting > 4)) {
+       if (unlikely(nesting > RING_BUFFER_MAX_NESTING)) {
                WARN_ON_ONCE(1);
                per_cpu(lib_ring_buffer_nesting, cpu)--;
                rcu_read_unlock_sched_notrace();
This page took 0.027779 seconds and 4 git commands to generate.