Several min-heap operations such as min_heapify_all(), min_heap_pop(), min_heap_pop_push(), and min_heap_del() use min_heap_sift_down() internally. With the addition of the equal-elements-aware variant min_heap_sift_down_eqaware(), these functions now need to choose between multiple sift_down implementations.
Introduce a siftdown_fn_t typedef to represent the function pointer type for sift_down routines. This avoids repeating verbose function pointer declarations and simplifies code that dynamically selects the appropriate implementation based on heap characteristics.
Cc: stable@vger.kernel.org # 6.11+ Signed-off-by: Kuan-Wei Chiu visitorckw@gmail.com --- include/linux/min_heap.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/linux/min_heap.h b/include/linux/min_heap.h index b0d603fe5379..4cd8fd9db259 100644 --- a/include/linux/min_heap.h +++ b/include/linux/min_heap.h @@ -49,6 +49,9 @@ struct min_heap_callbacks { void (*swp)(void *lhs, void *rhs, void *args); };
+typedef void (*siftdown_fn_t)(min_heap_char *heap, size_t pos, size_t elem_size, + const struct min_heap_callbacks *func, void *args); + /** * is_aligned - is this pointer & size okay for word-wide copying? * @base: pointer to data