All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>
Cc: linux-staging@lists.linux.dev, Stefan Wahren <stefan.wahren@i2se.com>
Subject: [PATCH 06/10] staging: vchiq_core: improve readability of request_poll
Date: Sun, 11 Apr 2021 20:11:36 +0200	[thread overview]
Message-ID: <1618164700-21150-7-git-send-email-stefan.wahren@i2se.com> (raw)
In-Reply-To: <1618164700-21150-1-git-send-email-stefan.wahren@i2se.com>

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: Stefan Wahren <stefan.wahren@i2se.com>
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index be0ea1e..22989866 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -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;
-- 
2.7.4


  parent reply	other threads:[~2021-04-11 18:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-11 18:11 [PATCH 00/10] staging: vchiq_core: improve code readability Stefan Wahren
2021-04-11 18:11 ` [PATCH 01/10] staging: vchiq_core: Simplify vchiq_send_remote_use* Stefan Wahren
2021-04-11 18:11 ` [PATCH 02/10] staging: vchiq_core: Shorten var name for service quota Stefan Wahren
2021-04-11 18:11 ` [PATCH 03/10] staging: vchiq_core: Get the rid off curly braces around cases Stefan Wahren
2021-04-11 18:11 ` [PATCH 04/10] staging: vchiq_core: Exit early in 2 functions Stefan Wahren
2021-04-11 18:11 ` [PATCH 05/10] staging: vchiq_core: introduce service skip Stefan Wahren
2021-04-11 18:11 ` Stefan Wahren [this message]
2021-04-11 18:11 ` [PATCH 07/10] staging: vchiq_core: use BITSET_WORD macro Stefan Wahren
2021-04-11 18:11 ` [PATCH 08/10] staging: vchiq_core: introduce SLOT_QUEUE_INDEX_FROM_POS_MASKED Stefan Wahren
2021-04-11 18:11 ` [PATCH 09/10] staging: vchiq_core: fix if alignments Stefan Wahren
2021-04-11 18:11 ` [PATCH 10/10] staging: vchiq_core: split exit conditions Stefan Wahren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1618164700-21150-7-git-send-email-stefan.wahren@i2se.com \
    --to=stefan.wahren@i2se.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=nsaenz@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.