From: Umang Jain <umang.jain@ideasonboard.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>
Cc: linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
kernel-list@raspberrypi.com, Stefan Wahren <wahrenst@gmx.net>,
Umang Jain <umang.jain@ideasonboard.com>
Subject: [PATCH v2 5/6] staging: vchiq_core: Lower indentation in parse_open()
Date: Fri, 11 Oct 2024 17:39:09 +0530 [thread overview]
Message-ID: <20241011120910.74045-6-umang.jain@ideasonboard.com> (raw)
In-Reply-To: <20241011120910.74045-1-umang.jain@ideasonboard.com>
If the service is not in VCHIQ_SRVSTATE_LISTENING state, it is
implied that the message is dealt with and parse_open() should return.
If this is the case, simply jump the code flow to return site using
'goto done;' statement.
This helps to lower the indentation of
if (service->srvstate == VCHIQ_SRVSTATE_LISTENING)
conditional branch.
No functional changes intended in this patch.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Stefan Wahren <wahrenst@gmx.net>
---
.../interface/vchiq_arm/vchiq_core.c | 48 ++++++++++---------
1 file changed, 26 insertions(+), 22 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 5509f8b1061a..135b7b9b01ee 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -1829,8 +1829,10 @@ static int
parse_open(struct vchiq_state *state, struct vchiq_header *header)
{
const struct vchiq_open_payload *payload;
+ struct vchiq_openack_payload ack_payload;
struct vchiq_service *service = NULL;
int msgid, size;
+ int openack_id;
unsigned int localport, remoteport, fourcc;
short version, version_min;
@@ -1865,34 +1867,36 @@ parse_open(struct vchiq_state *state, struct vchiq_header *header)
}
service->peer_version = version;
- if (service->srvstate == VCHIQ_SRVSTATE_LISTENING) {
- struct vchiq_openack_payload ack_payload = {
- service->version
- };
- int openack_id = MAKE_OPENACK(service->localport, remoteport);
+ if (service->srvstate != VCHIQ_SRVSTATE_LISTENING)
+ goto done;
- if (state->version_common <
- VCHIQ_VERSION_SYNCHRONOUS_MODE)
- service->sync = 0;
+ ack_payload.version = service->version;
+ openack_id = MAKE_OPENACK(service->localport, remoteport);
- /* Acknowledge the OPEN */
- if (service->sync) {
- if (queue_message_sync(state, NULL, openack_id, memcpy_copy_callback,
- &ack_payload, sizeof(ack_payload)) == -EAGAIN)
- goto bail_not_ready;
+ if (state->version_common < VCHIQ_VERSION_SYNCHRONOUS_MODE)
+ service->sync = 0;
- /* The service is now open */
- set_service_state(service, VCHIQ_SRVSTATE_OPENSYNC);
- } else {
- if (queue_message(state, NULL, openack_id, memcpy_copy_callback,
- &ack_payload, sizeof(ack_payload), 0) == -EINTR)
- goto bail_not_ready;
+ /* Acknowledge the OPEN */
+ if (service->sync) {
+ if (queue_message_sync(state, NULL, openack_id,
+ memcpy_copy_callback,
+ &ack_payload,
+ sizeof(ack_payload)) == -EAGAIN)
+ goto bail_not_ready;
- /* The service is now open */
- set_service_state(service, VCHIQ_SRVSTATE_OPEN);
- }
+ /* The service is now open */
+ set_service_state(service, VCHIQ_SRVSTATE_OPENSYNC);
+ } else {
+ if (queue_message(state, NULL, openack_id,
+ memcpy_copy_callback, &ack_payload,
+ sizeof(ack_payload), 0) == -EINTR)
+ goto bail_not_ready;
+
+ /* The service is now open */
+ set_service_state(service, VCHIQ_SRVSTATE_OPEN);
}
+done:
/* Success - the message has been dealt with */
vchiq_service_put(service);
return 1;
--
2.45.2
next prev parent reply other threads:[~2024-10-11 12:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 12:09 [PATCH v2 0/6] staging: vchiq: Lower indentation at various places Umang Jain
2024-10-11 12:09 ` [PATCH v2 1/6] staging: vchiq_core: Locally cache cache_line_size information Umang Jain
2024-10-11 12:09 ` [PATCH v2 2/6] staging: vchiq_core: Do not log debug in a separate scope Umang Jain
2024-10-11 12:09 ` [PATCH v2 3/6] staging: vchiq_core: Indent copy_message_data() on a single line Umang Jain
2024-10-11 12:09 ` [PATCH v2 4/6] staging: vchiq_core: Refactor notify_bulks() Umang Jain
2024-10-11 14:53 ` Dan Carpenter
2024-10-11 12:09 ` Umang Jain [this message]
2024-10-11 12:09 ` [PATCH v2 6/6] staging: vchiq_core: Lower indentation in vchiq_close_service_internal Umang Jain
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=20241011120910.74045-6-umang.jain@ideasonboard.com \
--to=umang.jain@ideasonboard.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-list@raspberrypi.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-staging@lists.linux.dev \
--cc=wahrenst@gmx.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox