diff options
author | 2023-11-03 21:57:42 +0000 | |
---|---|---|
committer | 2023-11-03 22:56:29 +0000 | |
commit | 7f75e80f087d3ff1f5ebcb9eb6a117115baee011 (patch) | |
tree | a05daac2f541cf9cca7cb3350206c4b65cea2603 /src/vppinfra/test_interrupt.c | |
parent | 236fae462a4ee799b3f05d4b2aff641d5c9486a6 (diff) |
vppinfra: refactor interrupt code
Type: improvement
Change-Id: Ie6987736faf7d8a641762e276775da8ee0c03ea4
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/test_interrupt.c')
-rw-r--r-- | src/vppinfra/test_interrupt.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/vppinfra/test_interrupt.c b/src/vppinfra/test_interrupt.c index 519805edc89..133692d1bd0 100644 --- a/src/vppinfra/test_interrupt.c +++ b/src/vppinfra/test_interrupt.c @@ -33,10 +33,7 @@ int debug = 0; void set_and_check_bits (void *interrupts, int num_ints) { - - int step; - - for (step = 1; step < num_ints; step++) + for (int step = 1; step < num_ints; step++) { int int_num = -1; int expected = 0; @@ -48,13 +45,15 @@ set_and_check_bits (void *interrupts, int num_ints) clib_interrupt_set (interrupts, i); } - while ((int_num = clib_interrupt_get_next (interrupts, int_num)) != -1) + while ((int_num = + clib_interrupt_get_next_and_clear (interrupts, int_num)) != -1) { debug (" Got %d, expecting %d\n", int_num, expected); ASSERT (int_num == expected); expected += step; - clib_interrupt_clear (interrupts, int_num); } + int_num = clib_interrupt_get_next_and_clear (interrupts, -1); + ASSERT (int_num == -1); } } |