Commit 0e345d97 authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman
Browse files

staging: vchiq_core: improve readability of request_poll



Storing the index for poll services in a local var will increase the
readability of the second loop. Also we get the rid off the checkpatch
issue about the line ending with a square bracket.

Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1618164700-21150-7-git-send-email-stefan.wahren@i2se.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 63276d45
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -537,6 +537,7 @@ request_poll(struct vchiq_state *state, struct vchiq_service *service,
	     int poll_type)
{
	u32 value;
	int index;

	if (!service)
		goto skip_service;
@@ -546,12 +547,11 @@ request_poll(struct vchiq_state *state, struct vchiq_service *service,
	} while (atomic_cmpxchg(&service->poll_flags, value,
		 value | BIT(poll_type)) != value);

	index = service->localport >> 5;
	do {
		value = atomic_read(&state->poll_services[
			service->localport>>5]);
	} while (atomic_cmpxchg(
		 &state->poll_services[service->localport>>5], value,
		 value | BIT(service->localport & 0x1f)) != value);
		value = atomic_read(&state->poll_services[index]);
	} while (atomic_cmpxchg(&state->poll_services[index],
		 value, value | BIT(service->localport & 0x1f)) != value);

skip_service:
	state->poll_needed = 1;