]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
staging: vchiq_core: introduce SLOT_QUEUE_INDEX_FROM_POS_MASKED
authorStefan Wahren <stefan.wahren@i2se.com>
Sun, 11 Apr 2021 18:11:38 +0000 (20:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 12 Apr 2021 09:41:22 +0000 (11:41 +0200)
Define a macro which already masked the result of SLOT_QUEUE_INDEX_FROM_POS.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1618164700-21150-9-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c

index 2db2332f80decc220d5ae50acd6cd6ca478b7584..5eab351eb0dca15af97b21c48a9b03195c7fe29c 100644 (file)
@@ -28,6 +28,8 @@
        ((unsigned int)(info - state->slot_info))
 #define SLOT_QUEUE_INDEX_FROM_POS(pos) \
        ((int)((unsigned int)(pos) / VCHIQ_SLOT_SIZE))
+#define SLOT_QUEUE_INDEX_FROM_POS_MASKED(pos) \
+       (SLOT_QUEUE_INDEX_FROM_POS(pos) & VCHIQ_SLOT_QUEUE_MASK)
 
 #define BULK_INDEX(x) (x & (VCHIQ_NUM_SERVICE_BULKS - 1))
 
@@ -613,8 +615,7 @@ reserve_space(struct vchiq_state *state, size_t space, int is_blocking)
                }
 
                slot_index = local->slot_queue[
-                       SLOT_QUEUE_INDEX_FROM_POS(tx_pos) &
-                       VCHIQ_SLOT_QUEUE_MASK];
+                       SLOT_QUEUE_INDEX_FROM_POS_MASKED(tx_pos)];
                state->tx_data =
                        (char *)SLOT_DATA_FROM_INDEX(state, slot_index);
        }
@@ -1567,8 +1568,7 @@ parse_rx_slots(struct vchiq_state *state)
 
                        WARN_ON(!((state->rx_pos & VCHIQ_SLOT_MASK) == 0));
                        rx_index = remote->slot_queue[
-                               SLOT_QUEUE_INDEX_FROM_POS(state->rx_pos) &
-                               VCHIQ_SLOT_QUEUE_MASK];
+                               SLOT_QUEUE_INDEX_FROM_POS_MASKED(state->rx_pos)];
                        state->rx_data = (char *)SLOT_DATA_FROM_INDEX(state,
                                rx_index);
                        state->rx_info = SLOT_INFO_FROM_INDEX(state, rx_index);