Commit 21711c7e authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

staging: vchiq_core: separate postfix increment

Postfix increment within a complexer statement doesn't improve readability.
So separate them.
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1621105859-30215-4-git-send-email-stefan.wahren@i2se.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 63e24ae2
...@@ -243,7 +243,8 @@ __next_service_by_instance(struct vchiq_state *state, ...@@ -243,7 +243,8 @@ __next_service_by_instance(struct vchiq_state *state,
while (idx < state->unused_service) { while (idx < state->unused_service) {
struct vchiq_service *srv; struct vchiq_service *srv;
srv = rcu_dereference(state->services[idx++]); srv = rcu_dereference(state->services[idx]);
idx++;
if (srv && srv->srvstate != VCHIQ_SRVSTATE_FREE && if (srv && srv->srvstate != VCHIQ_SRVSTATE_FREE &&
srv->instance == instance) { srv->instance == instance) {
service = srv; service = srv;
...@@ -649,11 +650,12 @@ process_free_queue(struct vchiq_state *state, BITSET_T *service_found, ...@@ -649,11 +650,12 @@ process_free_queue(struct vchiq_state *state, BITSET_T *service_found,
while (slot_queue_available != local->slot_queue_recycle) { while (slot_queue_available != local->slot_queue_recycle) {
unsigned int pos; unsigned int pos;
int slot_index = local->slot_queue[slot_queue_available++ & int slot_index = local->slot_queue[slot_queue_available &
VCHIQ_SLOT_QUEUE_MASK]; VCHIQ_SLOT_QUEUE_MASK];
char *data = (char *)SLOT_DATA_FROM_INDEX(state, slot_index); char *data = (char *)SLOT_DATA_FROM_INDEX(state, slot_index);
int data_found = 0; int data_found = 0;
slot_queue_available++;
/* /*
* Beware of the address dependency - data is calculated * Beware of the address dependency - data is calculated
* using an index written by the other side. * using an index written by the other side.
...@@ -1175,7 +1177,6 @@ static void ...@@ -1175,7 +1177,6 @@ static void
release_slot(struct vchiq_state *state, struct vchiq_slot_info *slot_info, release_slot(struct vchiq_state *state, struct vchiq_slot_info *slot_info,
struct vchiq_header *header, struct vchiq_service *service) struct vchiq_header *header, struct vchiq_service *service)
{ {
mutex_lock(&state->recycle_mutex); mutex_lock(&state->recycle_mutex);
if (header) { if (header) {
...@@ -2215,7 +2216,8 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) ...@@ -2215,7 +2216,8 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero)
} }
for (i = local->slot_first; i <= local->slot_last; i++) { for (i = local->slot_first; i <= local->slot_last; i++) {
local->slot_queue[state->slot_queue_available++] = i; local->slot_queue[state->slot_queue_available] = i;
state->slot_queue_available++;
complete(&state->slot_available_event); complete(&state->slot_available_event);
} }
...@@ -2319,7 +2321,8 @@ void vchiq_msg_queue_push(unsigned int handle, struct vchiq_header *header) ...@@ -2319,7 +2321,8 @@ void vchiq_msg_queue_push(unsigned int handle, struct vchiq_header *header)
flush_signals(current); flush_signals(current);
} }
pos = service->msg_queue_write++ & (VCHIQ_MAX_SLOTS - 1); pos = service->msg_queue_write & (VCHIQ_MAX_SLOTS - 1);
service->msg_queue_write++;
service->msg_queue[pos] = header; service->msg_queue[pos] = header;
complete(&service->msg_queue_push); complete(&service->msg_queue_push);
...@@ -2340,7 +2343,8 @@ struct vchiq_header *vchiq_msg_hold(unsigned int handle) ...@@ -2340,7 +2343,8 @@ struct vchiq_header *vchiq_msg_hold(unsigned int handle)
flush_signals(current); flush_signals(current);
} }
pos = service->msg_queue_read++ & (VCHIQ_MAX_SLOTS - 1); pos = service->msg_queue_read & (VCHIQ_MAX_SLOTS - 1);
service->msg_queue_read++;
header = service->msg_queue[pos]; header = service->msg_queue[pos];
complete(&service->msg_queue_pop); complete(&service->msg_queue_pop);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment