[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241011072210.494672-5-umang.jain@ideasonboard.com>
Date: Fri, 11 Oct 2024 12:52:06 +0530
From: Umang Jain <umang.jain@...asonboard.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>
Cc: linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Kieran Bingham <kieran.bingham@...asonboard.com>,
Dan Carpenter <dan.carpenter@...aro.org>,
Stefan Wahren <wahrenst@....net>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Umang Jain <umang.jain@...asonboard.com>
Subject: [PATCH 4/8] staging: vchiq_core: Lower indentation of a conditional block
Lower indentation of 'if (bulk->data && service->instance)'
conditional block. This is achieved introducing a early check for
(!bulk->data || !service->instance) and using a goto label 'complete'
if it evaluates to true.
No functional changes intended in this patch.
Signed-off-by: Umang Jain <umang.jain@...asonboard.com>
---
.../interface/vchiq_arm/vchiq_core.c | 61 ++++++++++---------
1 file changed, 31 insertions(+), 30 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 15257cf66fa4..b95443043c27 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -1326,44 +1326,45 @@ notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue,
struct vchiq_bulk *bulk =
&queue->bulks[BULK_INDEX(queue->remove)];
+ if (!bulk->data || !service->instance)
+ goto complete;
+
/*
* Only generate callbacks for non-dummy bulk
* requests, and non-terminated services
*/
- if (bulk->data && service->instance) {
- if (bulk->actual != VCHIQ_BULK_ACTUAL_ABORTED) {
- if (bulk->dir == VCHIQ_BULK_TRANSMIT) {
- VCHIQ_SERVICE_STATS_INC(service, bulk_tx_count);
- VCHIQ_SERVICE_STATS_ADD(service, bulk_tx_bytes,
- bulk->actual);
- } else {
- VCHIQ_SERVICE_STATS_INC(service, bulk_rx_count);
- VCHIQ_SERVICE_STATS_ADD(service, bulk_rx_bytes,
- bulk->actual);
- }
+ if (bulk->actual != VCHIQ_BULK_ACTUAL_ABORTED) {
+ if (bulk->dir == VCHIQ_BULK_TRANSMIT) {
+ VCHIQ_SERVICE_STATS_INC(service, bulk_tx_count);
+ VCHIQ_SERVICE_STATS_ADD(service, bulk_tx_bytes,
+ bulk->actual);
} else {
- VCHIQ_SERVICE_STATS_INC(service, bulk_aborted_count);
- }
- if (bulk->mode == VCHIQ_BULK_MODE_BLOCKING) {
- struct bulk_waiter *waiter;
-
- spin_lock(&service->state->bulk_waiter_spinlock);
- waiter = bulk->userdata;
- if (waiter) {
- waiter->actual = bulk->actual;
- complete(&waiter->event);
- }
- spin_unlock(&service->state->bulk_waiter_spinlock);
- } else if (bulk->mode == VCHIQ_BULK_MODE_CALLBACK) {
- enum vchiq_reason reason =
- get_bulk_reason(bulk);
- status = make_service_callback(service, reason, NULL,
- bulk->userdata);
- if (status == -EAGAIN)
- break;
+ VCHIQ_SERVICE_STATS_INC(service, bulk_rx_count);
+ VCHIQ_SERVICE_STATS_ADD(service, bulk_rx_bytes,
+ bulk->actual);
}
+ } else {
+ VCHIQ_SERVICE_STATS_INC(service, bulk_aborted_count);
}
+ if (bulk->mode == VCHIQ_BULK_MODE_BLOCKING) {
+ struct bulk_waiter *waiter;
+ spin_lock(&service->state->bulk_waiter_spinlock);
+ waiter = bulk->userdata;
+ if (waiter) {
+ waiter->actual = bulk->actual;
+ complete(&waiter->event);
+ }
+ spin_unlock(&service->state->bulk_waiter_spinlock);
+ } else if (bulk->mode == VCHIQ_BULK_MODE_CALLBACK) {
+ enum vchiq_reason reason =
+ get_bulk_reason(bulk);
+ status = make_service_callback(service, reason, NULL,
+ bulk->userdata);
+ if (status == -EAGAIN)
+ break;
+ }
+complete:
queue->remove++;
complete(&service->bulk_remove_event);
}
--
2.45.2
Powered by blists - more mailing lists