From patchwork Fri Oct 11 12:09:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13832498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64461CFD37C for ; Fri, 11 Oct 2024 12:22:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=44jssfXZ/WTAkkoex/znAd6XSViCr1ZuuJOFaN4Biqk=; b=3t//uVEeih4lz7na0pR3wbSZ8k nPzF0wosyiIF9fmZnUoQSkCpCdo7hmbOk118ic8TSp1XfnjAwEaxAAmnYBbolZocwgLZZW7sHmcHu tANZ9b315oejzfBgSpyw4kggFosZkR6rEwIMVHdhpj8m0HUXsxtu5Mq6GgDq5YnNiy9IHDzNwVLvF KoI+VsFDCwHKyiFIP99WWiEb9GNV/racZCpIu+mtOHSw9Q3oBDWNGjwrZYNlslcHICMT6ewfrEp+j EyO6P03LjvUGXXWcUYNIuddARQmi7JNCA/ZHscOveJshwt8HuuXHmK8ZR11jpnbL71eqqriflJnAD uJnMgL7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1szEem-0000000GHY9-1Xy2; Fri, 11 Oct 2024 12:22:08 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1szETY-0000000GExo-3MW9; Fri, 11 Oct 2024 12:10:34 +0000 Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1E74ECDB; Fri, 11 Oct 2024 14:08:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728648533; bh=K8/PYdHZ3L7Li1BEbSRjHfmt4+8f7SQOKzrR14S2wCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vWFb19TGiDy+x4oPopwjeNyVebQ2cGv2ywUZlGnVpiK7gAqa8iPFT7TmrXxmrV7V7 v8tAFb58YCbeNkxYfb3KNf8YCdmUq1xUAwU1V/oGj3StjSz0HlvkHK1kT6KPVzjxr0 3bEqFMPYr47qdjlvma0iMhSB6krTpJrXc1tEE0eE= From: Umang Jain To: Greg Kroah-Hartman , Broadcom internal kernel review list 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 , Dan Carpenter , Laurent Pinchart , kernel-list@raspberrypi.com, Stefan Wahren , Umang Jain Subject: [PATCH v2 5/6] staging: vchiq_core: Lower indentation in parse_open() Date: Fri, 11 Oct 2024 17:39:09 +0530 Message-ID: <20241011120910.74045-6-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241011120910.74045-1-umang.jain@ideasonboard.com> References: <20241011120910.74045-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241011_051033_007882_D7E24291 X-CRM114-Status: GOOD ( 16.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Stefan Wahren --- .../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;