From patchwork Thu Oct 10 10:22:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13829996 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 633C8CF11D2 for ; Thu, 10 Oct 2024 11:46:17 +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=5yKRwCDNhO94HEHlsq0VPrqkPetWRkjhO9lXtldMI90=; b=PAXj+M63rs9qS//WCDeNmb+K15 G2fmGJlVeWHoKqCMJaJoxJEQs2twlNjP1q1Pg2xuzOtuZKXgzJAVBjvkcIgMKZSQV8en8PN4KlrUS iqIDmEc/Ozk6NuyaP6JAsdDKLvZr9lYB8Z7EN017eA9w7YCkgKcZGN2R7RSw/yfZU5gFR66KD/0XW b931tx4NtwyHz43l+4SJWolPI8pMX5EWiGZzY6IHcS8slocYBpkDjJVhkKNHEahAAbKLO1ywtJTRE B6mu1Ik6PYW12Hgiz2u4Z0pZAqXVoq4xoo8L0R6Y8b26kwy2XKOk5d7JEmo1gvj5I3NG7knPIi6sM hLpyaBnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syrcQ-0000000Cb4W-12vI; Thu, 10 Oct 2024 11:46:10 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syqKH-0000000CNLN-2IKo; Thu, 10 Oct 2024 10:23:23 +0000 Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 90C9F5B2; Thu, 10 Oct 2024 12:21:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728555700; bh=Xk26YmG8YZvKNYWqttFrrO9FHmUMrgYYlfGadiP9nis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JXxZANZck0sii3z5UxIULCQ4nNvtVIVKg1CCcQDIxLvMP3kJF1sDtUUEDaXTmOxoy VIqYy1kq7k8vJgnDxqMPH/Z2A4OjvgkZU20f/I/EnqtKdfRC5J0g09GtEVBNz9Z4Kw wiOCIENlSbeOFcIhpIAv7wDEBcplsWnqbMik8K+w= 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 , Stefan Wahren , Laurent Pinchart , Hridesh MG , Umang Jain Subject: [PATCH 1/5] staging: vchiq_core: Fix white space indentation error Date: Thu, 10 Oct 2024 15:52:45 +0530 Message-ID: <20241010102250.236545-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241010102250.236545-1-umang.jain@ideasonboard.com> References: <20241010102250.236545-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-20241010_032321_792714_0FC9452A X-CRM114-Status: UNSURE ( 9.82 ) X-CRM114-Notice: Please train this message. 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 From: Hridesh MG Replace spaces with tabs to adhere to kernel coding style. No functional changes intended in this patch. Signed-off-by: Hridesh MG Signed-off-by: Umang Jain Reviewed-by: Stefan Wahren --- .../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 1281f3bc5548..dfd68d853214 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3111,13 +3111,13 @@ vchiq_bulk_xfer_queue_msg_killable(struct vchiq_service *service, state->id, service->localport, dir_char, queue->local_insert, queue->remote_insert, queue->process); - if (bulk_waiter) { - bulk_waiter->bulk = bulk; + if (bulk_waiter) { + bulk_waiter->bulk = bulk; if (wait_for_completion_killable(&bulk_waiter->event)) status = -EINTR; - else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) - status = -EINVAL; - } + else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) + status = -EINVAL; + } return status; From patchwork Thu Oct 10 10:22:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13829932 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 D03DBCF11C6 for ; Thu, 10 Oct 2024 10:42:26 +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=Ilp6axwFMYgdpKwgiP6qfGohzW8gTSodLKyL/FOO/kM=; b=j32ZrOKBdErVGeuO1mxFB9gu60 a9ZiyaVXDfMdsRno92dMT7Uj4Fs4bkL8PfivqiLpzeaA1xaa8sRCC9A7uInYAVAW+wjJ9Jik0CfsK 00m8Qdxi4dqPwkyVhl7OlaFeGL3PTVi2EcO5SYI+v1n5vLqVroXhMS45O3FBoY9CNjXmJ2i78rQip 0uUxbJwYeG6Jn3hT4CVolQXPEeV8gh8iXIGBIVUQNJE+5ksa5aQSTYR47caifbFFm3lrikmUccyIp +bSa4vACi1RcPngEWx/mQYIh2oBdxLxykZXvbRfVvsvfBwvVbigEbUmTZYdBV4JRluRDWXp8Z/CYU ZgnfXoCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syqcQ-0000000CR2q-0r9Y; Thu, 10 Oct 2024 10:42:06 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syqKH-0000000CNLZ-3b9X; Thu, 10 Oct 2024 10:23:23 +0000 Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D13419CA; Thu, 10 Oct 2024 12:21:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728555702; bh=4qm2O/FvqUhv43GxGytOJmIEyUznWr9x7uzfJeQeBL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qtnIIL7a8yAcyXXOmAc8zcyCWaTbF2H7q6WIfcBQAlAUj9YSlJcQqAvDjlo7LLOGQ 0npD4eLwE3TWDVlTVZS8dwqpWViDSxaW1ViHO1k8eZeu09T3vGLn0Egc3jyoDmaAAO 2nKNJl7yAcuAuGrMiiGTse9K7rSBnkPUwANefjco= 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 , Stefan Wahren , Laurent Pinchart , Umang Jain Subject: [PATCH 2/5] staging: vchiq_core: Indent static_assert on single line Date: Thu, 10 Oct 2024 15:52:46 +0530 Message-ID: <20241010102250.236545-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241010102250.236545-1-umang.jain@ideasonboard.com> References: <20241010102250.236545-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-20241010_032322_277885_8CEB180C X-CRM114-Status: UNSURE ( 7.34 ) X-CRM114-Notice: Please train this message. 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 The two static asserts are under 80 columns width, hence indent them on the same line. Signed-off-by: Umang Jain Reviewed-by: Stefan Wahren --- .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 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 dfd68d853214..1e4b2978c186 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -70,11 +70,9 @@ #define BELL2 0x08 /* Ensure the fields are wide enough */ -static_assert(VCHIQ_MSG_SRCPORT(VCHIQ_MAKE_MSG(0, 0, VCHIQ_PORT_MAX)) - == 0); +static_assert(VCHIQ_MSG_SRCPORT(VCHIQ_MAKE_MSG(0, 0, VCHIQ_PORT_MAX)) == 0); static_assert(VCHIQ_MSG_TYPE(VCHIQ_MAKE_MSG(0, VCHIQ_PORT_MAX, 0)) == 0); -static_assert((unsigned int)VCHIQ_PORT_MAX < - (unsigned int)VCHIQ_PORT_FREE); +static_assert((unsigned int)VCHIQ_PORT_MAX < (unsigned int)VCHIQ_PORT_FREE); #define VCHIQ_MSGID_PADDING VCHIQ_MAKE_MSG(VCHIQ_MSG_PADDING, 0, 0) #define VCHIQ_MSGID_CLAIMED 0x40000000 From patchwork Thu Oct 10 10:22:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13829933 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 3455FCF11CD for ; Thu, 10 Oct 2024 10:43:42 +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=FMvnTnp49bTCZbmGSgCt/a7wpRwjAu9+xJaSdB47Dro=; b=JtOh8J9FAFJisorAWaAmorvDi0 cen18v5Y1XFtpG2MCGv+xYQ2KLzTsfhuOC9SVVLW/VV3vxiVj9jSuNi44LsTYxI8K1W3C/Dr3tGTc YP3iW3jb1bukSKACG/Qazo/oCMt3Fg5PIqMFKAMax6yQswodyMIUlV/CZDwjTSDilSUo113Bdfv8e nKYwdl6N3Mv9291clE3iMEz0UBJDoTq8TnSWY3sTRGKiuukd5VHyrBuVPfCcZkLQjeJfPHFT67PZn 1S5j8q7F9S1426qt3R0l0+kspnBI0J085TpiQ2kbD+HYYlPhxmqB6VydPdUTo/n8msQCBtRQlijPj NyLTL50w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syqdl-0000000CREt-1s71; Thu, 10 Oct 2024 10:43:29 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syqKK-0000000CNME-0VLC; Thu, 10 Oct 2024 10:23:27 +0000 Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 00B66A8F; Thu, 10 Oct 2024 12:21:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728555704; bh=/EcI/XV+/Sh4a+TZw9I3cKKIBdcOZg82XQwjyZRX5mA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k8KZvuPcEqXxicFmFSSrNdXn3qw67Ie2tet7dugHqXFWsAUim6shmuqhkNgWhWX4P 5IVK0MXrRQGADytBm0fkzlRCLzfKjmkRfMLuHdl4kRmwyno7WS0xOBsxam5hiec8Ty hCU37mHlbWuUWk7OBjFGR8CALxGuiG1zJHnDWrNA= 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 , Stefan Wahren , Laurent Pinchart , Umang Jain Subject: [PATCH 3/5] staging: vchiq_core: Reflow long lines to 80 columns Date: Thu, 10 Oct 2024 15:52:47 +0530 Message-ID: <20241010102250.236545-4-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241010102250.236545-1-umang.jain@ideasonboard.com> References: <20241010102250.236545-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-20241010_032324_488063_D698B73A X-CRM114-Status: GOOD ( 17.50 ) 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 In order to respect the coding style, wrap long lines in vchiq_core.c to fit in 80 columns. No functional changes intended in this patch. Signed-off-by: Umang Jain --- .../interface/vchiq_arm/vchiq_core.c | 267 +++++++++++------- 1 file changed, 168 insertions(+), 99 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 1e4b2978c186..8be2dcf3658c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -227,7 +227,8 @@ set_service_state(struct vchiq_service *service, int newstate) service->srvstate = newstate; } -struct vchiq_service *handle_to_service(struct vchiq_instance *instance, unsigned int handle) +struct vchiq_service *handle_to_service(struct vchiq_instance *instance, + unsigned int handle) { int idx = handle & (VCHIQ_MAX_SERVICES - 1); @@ -249,7 +250,8 @@ find_service_by_handle(struct vchiq_instance *instance, unsigned int handle) return service; } rcu_read_unlock(); - dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", handle); + dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", + handle); return NULL; } @@ -289,12 +291,15 @@ find_service_for_instance(struct vchiq_instance *instance, unsigned int handle) return service; } rcu_read_unlock(); - dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", handle); + dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", + handle); + return NULL; } struct vchiq_service * -find_closed_service_for_instance(struct vchiq_instance *instance, unsigned int handle) +find_closed_service_for_instance(struct vchiq_instance *instance, + unsigned int handle) { struct vchiq_service *service; @@ -311,7 +316,9 @@ find_closed_service_for_instance(struct vchiq_instance *instance, unsigned int h return service; } rcu_read_unlock(); - dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", handle); + dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", + handle); + return service; } @@ -462,8 +469,8 @@ make_service_callback(struct vchiq_service *service, enum vchiq_reason reason, dev_dbg(service->state->dev, "core: %d: callback:%d (%s, %pK, %pK)\n", service->state->id, service->localport, reason_names[reason], header, bulk_userdata); - status = service->base.callback(service->instance, reason, header, service->handle, - bulk_userdata); + status = service->base.callback(service->instance, reason, header, + service->handle, bulk_userdata); if (status && (status != -EAGAIN)) { dev_warn(service->state->dev, "core: %d: ignoring ERROR from callback to service %x\n", @@ -483,7 +490,9 @@ vchiq_set_conn_state(struct vchiq_state *state, enum vchiq_connstate newstate) enum vchiq_connstate oldstate = state->conn_state; dev_dbg(state->dev, "core: %d: %s->%s\n", - state->id, conn_state_names[oldstate], conn_state_names[newstate]); + state->id, conn_state_names[oldstate], + conn_state_names[newstate]); + state->conn_state = newstate; vchiq_platform_conn_state_changed(state, oldstate, newstate); } @@ -524,7 +533,10 @@ remote_event_wait(wait_queue_head_t *wq, struct remote_event *event) return ret; } event->armed = 0; - /* Ensure that the peer sees that we are not waiting (armed == 0). */ + /* + * Ensure that the peer sees that we are not waiting + * (armed == 0). + */ wmb(); } @@ -578,8 +590,10 @@ remote_event_poll(wait_queue_head_t *wq, struct remote_event *event) void remote_event_pollall(struct vchiq_state *state) { - remote_event_poll(&state->sync_trigger_event, &state->local->sync_trigger); - remote_event_poll(&state->sync_release_event, &state->local->sync_release); + remote_event_poll(&state->sync_trigger_event, + &state->local->sync_trigger); + remote_event_poll(&state->sync_release_event, + &state->local->sync_release); remote_event_poll(&state->trigger_event, &state->local->trigger); remote_event_poll(&state->recycle_event, &state->local->recycle); } @@ -614,8 +628,7 @@ get_listening_service(struct vchiq_state *state, int fourcc) struct vchiq_service *service; service = rcu_dereference(state->services[i]); - if (service && - service->public_fourcc == fourcc && + if (service && service->public_fourcc == fourcc && (service->srvstate == VCHIQ_SRVSTATE_LISTENING || (service->srvstate == VCHIQ_SRVSTATE_OPEN && service->remoteport == VCHIQ_PORT_FREE)) && @@ -679,7 +692,8 @@ request_poll(struct vchiq_state *state, struct vchiq_service *service, wmb(); /* ... and ensure the slot handler runs. */ - remote_event_signal_local(&state->trigger_event, &state->local->trigger); + remote_event_signal_local(&state->trigger_event, + &state->local->trigger); } /* @@ -789,11 +803,13 @@ process_free_data_message(struct vchiq_state *state, u32 *service_found, */ complete("a->quota_event); dev_dbg(state->dev, "core: %d: pfq:%d %x@%pK - slot_use->%d\n", - state->id, port, header->size, header, count - 1); + state->id, port, header->size, + header, count - 1); } else { dev_err(state->dev, "core: service %d slot_use_count=%d (header %pK, msgid %x, header->msgid %x, header->size %x)\n", - port, count, header, msgid, header->msgid, header->size); + port, count, header, msgid, + header->msgid, header->size); WARN(1, "bad slot use count\n"); } } @@ -858,7 +874,8 @@ process_free_queue(struct vchiq_state *state, u32 *service_found, if (pos > VCHIQ_SLOT_SIZE) { dev_err(state->dev, "core: pfq - pos %x: header %pK, msgid %x, header->msgid %x, header->size %x\n", - pos, header, msgid, header->msgid, header->size); + pos, header, msgid, + header->msgid, header->size); WARN(1, "invalid slot position\n"); } } @@ -894,8 +911,8 @@ memcpy_copy_callback(void *context, void *dest, size_t offset, size_t maxsize) } static ssize_t -copy_message_data(ssize_t (*copy_callback)(void *context, void *dest, size_t offset, - size_t maxsize), +copy_message_data(ssize_t (*copy_callback)(void *context, void *dest, + size_t offset, size_t maxsize), void *context, void *dest, size_t size) @@ -1049,8 +1066,8 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, int slot_use_count; dev_dbg(state->dev, "core: %d: qm %s@%pK,%zx (%d->%d)\n", - state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), header, size, - VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); + state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), header, + size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK | QMFLAGS_NO_MUTEX_UNLOCK)); @@ -1099,15 +1116,16 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, if (slot_use_count) dev_dbg(state->dev, "core: %d: qm:%d %s,%zx - slot_use->%d (hdr %p)\n", - state->id, service->localport, msg_type_str(VCHIQ_MSG_TYPE(msgid)), - size, slot_use_count, header); + state->id, service->localport, + msg_type_str(VCHIQ_MSG_TYPE(msgid)), size, + slot_use_count, header); VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); } else { dev_dbg(state->dev, "core: %d: qm %s@%pK,%zx (%d->%d)\n", - state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), header, size, - VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); + state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), header, + size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); if (size != 0) { /* * It is assumed for now that this code path @@ -1136,8 +1154,10 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); dev_dbg(state->dev, "core_msg: Sent Msg %s(%u) to %p4cc s:%u d:%d len:%zu\n", - msg_type_str(VCHIQ_MSG_TYPE(msgid)), VCHIQ_MSG_TYPE(msgid), - &svc_fourcc, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid), size); + msg_type_str(VCHIQ_MSG_TYPE(msgid)), + VCHIQ_MSG_TYPE(msgid), &svc_fourcc, + VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid), + size); } /* Make sure the new header is visible to the peer. */ @@ -1256,7 +1276,8 @@ release_slot(struct vchiq_state *state, struct vchiq_slot_info *slot_info, if (header) { int msgid = header->msgid; - if (((msgid & VCHIQ_MSGID_CLAIMED) == 0) || (service && service->closing)) { + if (((msgid & VCHIQ_MSGID_CLAIMED) == 0) || + (service && service->closing)) { mutex_unlock(&state->recycle_mutex); return; } @@ -1377,8 +1398,9 @@ notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue, status = 0; if (status == -EAGAIN) - request_poll(service->state, service, (queue == &service->bulk_tx) ? - VCHIQ_POLL_TXNOTIFY : VCHIQ_POLL_RXNOTIFY); + request_poll(service->state, service, + (queue == &service->bulk_tx) ? VCHIQ_POLL_TXNOTIFY + : VCHIQ_POLL_RXNOTIFY); return status; } @@ -1405,7 +1427,8 @@ poll_services_of_group(struct vchiq_state *state, int group) service_flags = atomic_xchg(&service->poll_flags, 0); if (service_flags & BIT(VCHIQ_POLL_REMOVE)) { dev_dbg(state->dev, "core: %d: ps - remove %d<->%d\n", - state->id, service->localport, service->remoteport); + state->id, service->localport, + service->remoteport); /* * Make it look like a client, because @@ -1441,7 +1464,8 @@ poll_services(struct vchiq_state *state) } static void -cleanup_pagelistinfo(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagelistinfo) +cleanup_pagelistinfo(struct vchiq_instance *instance, + struct vchiq_pagelist_info *pagelistinfo) { if (pagelistinfo->scatterlist_mapped) { dma_unmap_sg(instance->state->dev, pagelistinfo->scatterlist, @@ -1451,7 +1475,8 @@ cleanup_pagelistinfo(struct vchiq_instance *instance, struct vchiq_pagelist_info if (pagelistinfo->pages_need_release) unpin_user_pages(pagelistinfo->pages, pagelistinfo->num_pages); - dma_free_coherent(instance->state->dev, pagelistinfo->pagelist_buffer_size, + dma_free_coherent(instance->state->dev, + pagelistinfo->pagelist_buffer_size, pagelistinfo->pagelist, pagelistinfo->dma_addr); } @@ -1518,8 +1543,8 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf, /* Allocate enough storage to hold the page pointers and the page * list */ - pagelist = dma_alloc_coherent(instance->state->dev, pagelist_size, &dma_addr, - GFP_KERNEL); + pagelist = dma_alloc_coherent(instance->state->dev, pagelist_size, + &dma_addr, GFP_KERNEL); dev_dbg(instance->state->dev, "arm: %pK\n", pagelist); @@ -1572,8 +1597,10 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf, } /* do not try and release vmalloc pages */ } else { - actual_pages = pin_user_pages_fast((unsigned long)ubuf & PAGE_MASK, num_pages, - type == PAGELIST_READ, pages); + actual_pages = + pin_user_pages_fast((unsigned long)ubuf & PAGE_MASK, + num_pages, type == PAGELIST_READ, + pages); if (actual_pages != num_pages) { dev_dbg(instance->state->dev, "arm: Only %d/%d pages locked\n", @@ -1664,15 +1691,16 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf, } static void -free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagelistinfo, - int actual) +free_pagelist(struct vchiq_instance *instance, + struct vchiq_pagelist_info *pagelistinfo, int actual) { struct vchiq_drv_mgmt *drv_mgmt; struct pagelist *pagelist = pagelistinfo->pagelist; struct page **pages = pagelistinfo->pages; unsigned int num_pages = pagelistinfo->num_pages; - dev_dbg(instance->state->dev, "arm: %pK, %d\n", pagelistinfo->pagelist, actual); + dev_dbg(instance->state->dev, "arm: %pK, %d\n", + pagelistinfo->pagelist, actual); drv_mgmt = dev_get_drvdata(instance->state->dev); @@ -1685,16 +1713,17 @@ free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagel pagelistinfo->scatterlist_mapped = 0; /* Deal with any partial cache lines (fragments) */ - if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS && drv_mgmt->fragments_base) { + if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS && + drv_mgmt->fragments_base) { char *fragments = drv_mgmt->fragments_base + (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * drv_mgmt->fragments_size; int head_bytes, tail_bytes; head_bytes = (drv_mgmt->info->cache_line_size - pagelist->offset) & - (drv_mgmt->info->cache_line_size - 1); + (drv_mgmt->info->cache_line_size - 1); tail_bytes = (pagelist->offset + actual) & - (drv_mgmt->info->cache_line_size - 1); + (drv_mgmt->info->cache_line_size - 1); if ((actual >= 0) && (head_bytes != 0)) { if (head_bytes > actual) @@ -1731,8 +1760,8 @@ free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagel } static int -vchiq_prepare_bulk_data(struct vchiq_instance *instance, struct vchiq_bulk *bulk, void *offset, - void __user *uoffset, int size, int dir) +vchiq_prepare_bulk_data(struct vchiq_instance *instance, struct vchiq_bulk *bulk, + void *offset, void __user *uoffset, int size, int dir) { struct vchiq_pagelist_info *pagelistinfo; @@ -1759,7 +1788,8 @@ static void vchiq_complete_bulk(struct vchiq_instance *instance, struct vchiq_bulk *bulk) { if (bulk && bulk->remote_data && bulk->actual) - free_pagelist(instance, (struct vchiq_pagelist_info *)bulk->remote_data, + free_pagelist(instance, + (struct vchiq_pagelist_info *)bulk->remote_data, bulk->actual); } @@ -1796,8 +1826,8 @@ abort_outstanding_bulks(struct vchiq_service *service, dev_dbg(service->state->dev, "core_msg: %s %p4cc d:%d ABORTED - tx len:%d, rx len:%d\n", is_tx ? "Send Bulk to" : "Recv Bulk from", - &service->base.fourcc, - service->remoteport, bulk->size, bulk->remote_size); + &service->base.fourcc, service->remoteport, + bulk->size, bulk->remote_size); } else { /* fabricate a matching dummy bulk */ bulk->data = 0; @@ -1845,7 +1875,8 @@ parse_open(struct vchiq_state *state, struct vchiq_header *header) /* Version mismatch */ dev_err(state->dev, "%d: service %d (%p4cc) version mismatch - local (%d, min %d) vs. remote (%d, min %d)", state->id, service->localport, &fourcc, - service->version, service->version_min, version, version_min); + service->version, service->version_min, + version, version_min); vchiq_service_put(service); service = NULL; goto fail_open; @@ -1864,15 +1895,18 @@ parse_open(struct vchiq_state *state, struct vchiq_header *header) /* Acknowledge the OPEN */ if (service->sync) { - if (queue_message_sync(state, NULL, openack_id, memcpy_copy_callback, - &ack_payload, sizeof(ack_payload)) == -EAGAIN) + 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_OPENSYNC); } else { - if (queue_message(state, NULL, openack_id, memcpy_copy_callback, - &ack_payload, sizeof(ack_payload), 0) == -EINTR) + 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 */ @@ -1957,14 +1991,15 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header) dev_warn(state->dev, "core: %d: prs %s@%pK (%d->%d) - found connected service %d\n", state->id, msg_type_str(type), header, - remoteport, localport, service->localport); + remoteport, localport, + service->localport); } if (!service) { dev_err(state->dev, "core: %d: prs %s@%pK (%d->%d) - invalid/closed service %d\n", - state->id, msg_type_str(type), header, remoteport, - localport, localport); + state->id, msg_type_str(type), header, + remoteport, localport, localport); goto skip_message; } break; @@ -1976,9 +2011,11 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header) : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); dev_dbg(state->dev, "core_msg: Rcvd Msg %s(%u) from %p4cc s:%d d:%d len:%d\n", - msg_type_str(type), type, &svc_fourcc, remoteport, localport, size); + msg_type_str(type), type, &svc_fourcc, + remoteport, localport, size); if (size > 0) - vchiq_log_dump_mem(state->dev, "Rcvd", 0, header->data, min(16, size)); + vchiq_log_dump_mem(state->dev, "Rcvd", 0, header->data, + min(16, size)); if (((unsigned long)header & VCHIQ_SLOT_MASK) + calc_stride(size) > VCHIQ_SLOT_SIZE) { @@ -2025,7 +2062,8 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header) goto bail_not_ready; dev_dbg(state->dev, "core: Close Service %p4cc s:%u d:%d\n", - &service->base.fourcc, service->localport, service->remoteport); + &service->base.fourcc, service->localport, + service->remoteport); break; case VCHIQ_MSG_DATA: dev_dbg(state->dev, "core: %d: prs DATA@%pK,%x (%d->%d)\n", @@ -2036,8 +2074,9 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header) header->msgid = msgid | VCHIQ_MSGID_CLAIMED; claim_slot(state->rx_info); DEBUG_TRACE(PARSE_LINE); - if (make_service_callback(service, VCHIQ_MESSAGE_AVAILABLE, header, - NULL) == -EAGAIN) { + if (make_service_callback(service, + VCHIQ_MESSAGE_AVAILABLE, + header, NULL) == -EAGAIN) { DEBUG_TRACE(PARSE_LINE); goto bail_not_ready; } @@ -2082,8 +2121,10 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header) queue->local_insert) >= 0) { dev_err(state->dev, "core: %d: prs %s@%pK (%d->%d) unexpected (ri=%d,li=%d)\n", - state->id, msg_type_str(type), header, remoteport, - localport, queue->remote_insert, queue->local_insert); + state->id, msg_type_str(type), header, + remoteport, localport, + queue->remote_insert, + queue->local_insert); mutex_unlock(&service->bulk_mutex); break; } @@ -2100,13 +2141,15 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header) queue->remote_insert++; dev_dbg(state->dev, "core: %d: prs %s@%pK (%d->%d) %x@%pad\n", - state->id, msg_type_str(type), header, remoteport, - localport, bulk->actual, &bulk->data); + state->id, msg_type_str(type), header, + remoteport, localport, + bulk->actual, &bulk->data); dev_dbg(state->dev, "core: %d: prs:%d %cx li=%x ri=%x p=%x\n", state->id, localport, (type == VCHIQ_MSG_BULK_RX_DONE) ? 'r' : 't', - queue->local_insert, queue->remote_insert, queue->process); + queue->local_insert, queue->remote_insert, + queue->process); DEBUG_TRACE(PARSE_LINE); WARN_ON(queue->process == queue->local_insert); @@ -2133,8 +2176,8 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header) } if (state->conn_state != VCHIQ_CONNSTATE_PAUSE_SENT) { /* Send a PAUSE in response */ - if (queue_message(state, NULL, MAKE_PAUSE, NULL, NULL, 0, - QMFLAGS_NO_MUTEX_UNLOCK) == -EINTR) + if (queue_message(state, NULL, MAKE_PAUSE, NULL, NULL, + 0, QMFLAGS_NO_MUTEX_UNLOCK) == -EINTR) goto bail_not_ready; } /* At this point slot_mutex is held */ @@ -2362,7 +2405,8 @@ sync_func(void *v) int type; unsigned int localport, remoteport; - ret = remote_event_wait(&state->sync_trigger_event, &local->sync_trigger); + ret = remote_event_wait(&state->sync_trigger_event, + &local->sync_trigger); if (ret) return ret; @@ -2380,8 +2424,8 @@ sync_func(void *v) if (!service) { dev_err(state->dev, "sync: %d: sf %s@%pK (%d->%d) - invalid/closed service %d\n", - state->id, msg_type_str(type), header, remoteport, - localport, localport); + state->id, msg_type_str(type), header, + remoteport, localport, localport); release_message_sync(state, header); continue; } @@ -2389,9 +2433,11 @@ sync_func(void *v) svc_fourcc = service->base.fourcc; dev_dbg(state->dev, "sync: Rcvd Msg %s from %p4cc s:%d d:%d len:%d\n", - msg_type_str(type), &svc_fourcc, remoteport, localport, size); + msg_type_str(type), &svc_fourcc, remoteport, localport, + size); if (size > 0) - vchiq_log_dump_mem(state->dev, "Rcvd", 0, header->data, min(16, size)); + vchiq_log_dump_mem(state->dev, "Rcvd", 0, header->data, + min(16, size)); switch (type) { case VCHIQ_MSG_OPENACK: @@ -2406,7 +2452,8 @@ sync_func(void *v) service->peer_version); if (service->srvstate == VCHIQ_SRVSTATE_OPENING) { service->remoteport = remoteport; - set_service_state(service, VCHIQ_SRVSTATE_OPENSYNC); + set_service_state(service, + VCHIQ_SRVSTATE_OPENSYNC); service->sync = 1; complete(&service->remove_event); } @@ -2419,7 +2466,9 @@ sync_func(void *v) if ((service->remoteport == remoteport) && (service->srvstate == VCHIQ_SRVSTATE_OPENSYNC)) { - if (make_service_callback(service, VCHIQ_MESSAGE_AVAILABLE, header, + if (make_service_callback(service, + VCHIQ_MESSAGE_AVAILABLE, + header, NULL) == -EAGAIN) dev_err(state->dev, "sync: error: synchronous callback to service %d returns -EAGAIN\n", @@ -2488,7 +2537,8 @@ vchiq_init_slots(struct device *dev, void *mem_base, int mem_size) } int -vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero, struct device *dev) +vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero, + struct device *dev) { struct vchiq_shared_state *local; struct vchiq_shared_state *remote; @@ -2569,7 +2619,8 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero, s ((struct vchiq_header *) SLOT_DATA_FROM_INDEX(state, local->slot_sync))->msgid = VCHIQ_MSGID_PADDING; - remote_event_signal_local(&state->sync_release_event, &local->sync_release); + remote_event_signal_local(&state->sync_release_event, + &local->sync_release); local->debug[DEBUG_ENTRIES] = DEBUG_MAX; @@ -2581,7 +2632,8 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero, s * bring up slot handler thread */ snprintf(threadname, sizeof(threadname), "vchiq-slot/%d", state->id); - state->slot_handler_thread = kthread_create(&slot_handler_func, (void *)state, threadname); + state->slot_handler_thread = kthread_create(&slot_handler_func, + (void *)state, threadname); if (IS_ERR(state->slot_handler_thread)) { dev_err(state->dev, "couldn't create thread %s\n", threadname); @@ -2590,7 +2642,8 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero, s set_user_nice(state->slot_handler_thread, -19); snprintf(threadname, sizeof(threadname), "vchiq-recy/%d", state->id); - state->recycle_thread = kthread_create(&recycle_func, (void *)state, threadname); + state->recycle_thread = kthread_create(&recycle_func, (void *)state, + threadname); if (IS_ERR(state->recycle_thread)) { dev_err(state->dev, "couldn't create thread %s\n", threadname); ret = PTR_ERR(state->recycle_thread); @@ -2599,7 +2652,8 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero, s set_user_nice(state->recycle_thread, -19); snprintf(threadname, sizeof(threadname), "vchiq-sync/%d", state->id); - state->sync_thread = kthread_create(&sync_func, (void *)state, threadname); + state->sync_thread = kthread_create(&sync_func, (void *)state, + threadname); if (IS_ERR(state->sync_thread)) { dev_err(state->dev, "couldn't create thread %s\n", threadname); ret = PTR_ERR(state->sync_thread); @@ -2647,7 +2701,8 @@ void vchiq_msg_queue_push(struct vchiq_instance *instance, unsigned int handle, } EXPORT_SYMBOL(vchiq_msg_queue_push); -struct vchiq_header *vchiq_msg_hold(struct vchiq_instance *instance, unsigned int handle) +struct vchiq_header *vchiq_msg_hold(struct vchiq_instance *instance, + unsigned int handle) { struct vchiq_service *service = find_service_by_handle(instance, handle); struct vchiq_header *header; @@ -2849,7 +2904,8 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id) if (service->srvstate != VCHIQ_SRVSTATE_CLOSEWAIT) dev_err(service->state->dev, "core: %d: osi - srvstate = %s (ref %u)\n", - service->state->id, srvstate_names[service->srvstate], + service->state->id, + srvstate_names[service->srvstate], kref_read(&service->ref_count)); status = -EINVAL; VCHIQ_SERVICE_STATS_INC(service, error_count); @@ -2904,15 +2960,18 @@ release_service_messages(struct vchiq_service *service) int msgid = header->msgid; int port = VCHIQ_MSG_DSTPORT(msgid); - if ((port == service->localport) && (msgid & VCHIQ_MSGID_CLAIMED)) { - dev_dbg(state->dev, "core: fsi - hdr %pK\n", header); + if ((port == service->localport) && + (msgid & VCHIQ_MSGID_CLAIMED)) { + dev_dbg(state->dev, "core: fsi - hdr %pK\n", + header); release_slot(state, slot_info, header, NULL); } pos += calc_stride(header->size); if (pos > VCHIQ_SLOT_SIZE) { dev_err(state->dev, "core: fsi - pos %x: header %pK, msgid %x, header->msgid %x, header->size %x\n", - pos, header, msgid, header->msgid, header->size); + pos, header, msgid, + header->msgid, header->size); WARN(1, "invalid slot position\n"); } } @@ -2972,7 +3031,8 @@ close_service_complete(struct vchiq_service *service, int failstate) return -EINVAL; } - status = make_service_callback(service, VCHIQ_SERVICE_CLOSED, NULL, NULL); + status = make_service_callback(service, VCHIQ_SERVICE_CLOSED, + NULL, NULL); if (status != -EAGAIN) { int uc = service->service_use_count; @@ -3059,7 +3119,8 @@ vchiq_bulk_xfer_queue_msg_killable(struct vchiq_service *service, bulk->size = size; bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED; - if (vchiq_prepare_bulk_data(service->instance, bulk, offset, uoffset, size, dir)) + if (vchiq_prepare_bulk_data(service->instance, bulk, + offset, uoffset, size, dir)) goto unlock_error_exit; /* @@ -3266,7 +3327,8 @@ vchiq_free_service_internal(struct vchiq_service *service) { struct vchiq_state *state = service->state; - dev_dbg(state->dev, "core: %d: fsi - (%d)\n", state->id, service->localport); + dev_dbg(state->dev, "core: %d: fsi - (%d)\n", + state->id, service->localport); switch (service->srvstate) { case VCHIQ_SRVSTATE_OPENING: @@ -3277,7 +3339,8 @@ vchiq_free_service_internal(struct vchiq_service *service) break; default: dev_err(state->dev, "core: %d: fsi - (%d) in state %s\n", - state->id, service->localport, srvstate_names[service->srvstate]); + state->id, service->localport, + srvstate_names[service->srvstate]); return; } @@ -3290,7 +3353,8 @@ vchiq_free_service_internal(struct vchiq_service *service) } int -vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instance) +vchiq_connect_internal(struct vchiq_state *state, + struct vchiq_instance *instance) { struct vchiq_service *service; int status = 0; @@ -3342,7 +3406,8 @@ int vchiq_close_service(struct vchiq_instance *instance, unsigned int handle) { /* Unregister the service */ - struct vchiq_service *service = find_service_by_handle(instance, handle); + struct vchiq_service *service = find_service_by_handle(instance, + handle); int status = 0; if (!service) @@ -3476,8 +3541,8 @@ vchiq_bulk_xfer_blocking(struct vchiq_instance *instance, unsigned int handle, goto error_exit; - status = vchiq_bulk_xfer_queue_msg_killable(service, offset, uoffset, size, - userdata, mode, dir); + status = vchiq_bulk_xfer_queue_msg_killable(service, offset, uoffset, + size, userdata, mode, dir); error_exit: vchiq_service_put(service); @@ -3614,7 +3679,8 @@ vchiq_queue_message(struct vchiq_instance *instance, unsigned int handle, return status; } -int vchiq_queue_kernel_message(struct vchiq_instance *instance, unsigned int handle, void *data, +int vchiq_queue_kernel_message(struct vchiq_instance *instance, + unsigned int handle, void *data, unsigned int size) { @@ -3666,7 +3732,8 @@ release_message_sync(struct vchiq_state *state, struct vchiq_header *header) } int -vchiq_get_peer_version(struct vchiq_instance *instance, unsigned int handle, short *peer_version) +vchiq_get_peer_version(struct vchiq_instance *instance, unsigned int handle, + short *peer_version) { int status = -EINVAL; struct vchiq_service *service = find_service_by_handle(instance, handle); @@ -3803,8 +3870,8 @@ vchiq_dump_shared_state(struct seq_file *f, struct vchiq_state *state, struct vchiq_slot_info slot_info = *SLOT_INFO_FROM_INDEX(state, i); if (slot_info.use_count != slot_info.release_count) { - seq_printf(f, " %d: %d/%d\n", i, slot_info.use_count, - slot_info.release_count); + seq_printf(f, " %d: %d/%d\n", i, + slot_info.use_count, slot_info.release_count); } } @@ -3836,7 +3903,8 @@ vchiq_dump_service_state(struct seq_file *f, struct vchiq_service *service) "%u", service->remoteport); if (service->public_fourcc != VCHIQ_FOURCC_INVALID) - scnprintf(remoteport + len2, sizeof(remoteport) - len2, + scnprintf(remoteport + len2, + sizeof(remoteport) - len2, " (client 0x%x)", service->client_id); } else { strscpy(remoteport, "n/a", sizeof(remoteport)); @@ -3909,7 +3977,8 @@ void vchiq_dump_state(struct seq_file *f, struct vchiq_state *state) if (VCHIQ_ENABLE_STATS) { seq_printf(f, " Stats: ctrl_tx_count=%d, ctrl_rx_count=%d, error_count=%d\n", - state->stats.ctrl_tx_count, state->stats.ctrl_rx_count, + state->stats.ctrl_tx_count, + state->stats.ctrl_rx_count, state->stats.error_count); } From patchwork Thu Oct 10 10:22:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13829934 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 BCD5ECF11CD for ; Thu, 10 Oct 2024 10:44:59 +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=l77SlD63YBHBkQHEtBR8+bVw8ZZwyFzVU8TRaftPh0A=; b=0jjHB+3Yx9UXcehL4i4cpLvOYx UDmDgnG9wBT+VqHtQ6FpAnO4E11DUGrsbpCzM9z9rsaq3ZHyXNOIsasi4NdgHfNVpEUQgtQdFq3/o bULh4DK+S/L4F9BEuMz7uStVTsv/wgREWhBV+nBCRy+vXf4llYdkKzzzQHhF6bRbHTr+ha9b5qg71 DXRj9cns2UfiRA5Fw/xXq4K8nfnkhj11tvPsktetyl1v0Jnrb5qPEo42MGmhj92XDrviCr8+pERPW GIAQMZCiwfrbapDB87nAhOTFeo4W8dW8hHOQCo8nhJVVh70SBX2L41EkLr61nRhTdz22zlbaqVUeQ CqNY+RWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syqf4-0000000CRSz-46dC; Thu, 10 Oct 2024 10:44:50 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syqKL-0000000CNMl-3fKL; Thu, 10 Oct 2024 10:23:27 +0000 Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 407111371; Thu, 10 Oct 2024 12:21:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728555707; bh=yR4DKd0m1IBq6/oDJ5UmIzyKp+RttK8hpY774cjmi2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MI+MInJ64sULz7zmENLmcLISqQuqvAyuoAYIYPKFz6m4VgZLq1ZL8y1pk8XvlPFZK QYgDEwM3HpvrvfxevdpTTbUEtQ5X4YiqmyuXJXOZR0HbqE+DAQduhvY8jEVy5GfJ6n DeilAqrw7eFStC3KummuSnYTaguV5t5idbkTeJek= 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 , Stefan Wahren , Laurent Pinchart , Umang Jain Subject: [PATCH 4/5] staging: vchiq_core: Macros indentation fix Date: Thu, 10 Oct 2024 15:52:48 +0530 Message-ID: <20241010102250.236545-5-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241010102250.236545-1-umang.jain@ideasonboard.com> References: <20241010102250.236545-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-20241010_032326_086564_0935227E X-CRM114-Status: UNSURE ( 6.53 ) X-CRM114-Notice: Please train this message. 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 Make sure that MAKE_* macros fit within 80 columns instead of spanning in a single line. Signed-off-by: Umang Jain --- .../interface/vchiq_arm/vchiq_core.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 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 8be2dcf3658c..d03b67f9cdb7 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -50,18 +50,19 @@ ((unsigned short)(msgid) & 0xfff) #define MAKE_CONNECT (VCHIQ_MSG_CONNECT << TYPE_SHIFT) -#define MAKE_OPEN(srcport) \ - ((VCHIQ_MSG_OPEN << TYPE_SHIFT) | ((srcport) << 12)) -#define MAKE_OPENACK(srcport, dstport) \ - ((VCHIQ_MSG_OPENACK << TYPE_SHIFT) | ((srcport) << 12) | ((dstport) << 0)) -#define MAKE_CLOSE(srcport, dstport) \ - ((VCHIQ_MSG_CLOSE << TYPE_SHIFT) | ((srcport) << 12) | ((dstport) << 0)) -#define MAKE_DATA(srcport, dstport) \ - ((VCHIQ_MSG_DATA << TYPE_SHIFT) | ((srcport) << 12) | ((dstport) << 0)) +#define MAKE_OPEN(srcport) ((VCHIQ_MSG_OPEN << TYPE_SHIFT) | \ + ((srcport) << 12)) +#define MAKE_OPENACK(srcport, dstport) ((VCHIQ_MSG_OPENACK << TYPE_SHIFT) | \ + ((srcport) << 12) | ((dstport) << 0)) +#define MAKE_CLOSE(srcport, dstport) ((VCHIQ_MSG_CLOSE << TYPE_SHIFT) | \ + ((srcport) << 12) | ((dstport) << 0)) +#define MAKE_DATA(srcport, dstport) ((VCHIQ_MSG_DATA << TYPE_SHIFT) | \ + ((srcport) << 12) | ((dstport) << 0)) #define MAKE_PAUSE (VCHIQ_MSG_PAUSE << TYPE_SHIFT) #define MAKE_RESUME (VCHIQ_MSG_RESUME << TYPE_SHIFT) #define MAKE_REMOTE_USE (VCHIQ_MSG_REMOTE_USE << TYPE_SHIFT) -#define MAKE_REMOTE_USE_ACTIVE (VCHIQ_MSG_REMOTE_USE_ACTIVE << TYPE_SHIFT) +#define MAKE_REMOTE_USE_ACTIVE (VCHIQ_MSG_REMOTE_USE_ACTIVE \ + << TYPE_SHIFT) #define PAGELIST_WRITE 0 #define PAGELIST_READ 1 From patchwork Thu Oct 10 10:22:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13829931 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 79617CF11C6 for ; Thu, 10 Oct 2024 10:38:06 +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=W7My7ZvT/BeW7Atm53LhACgql0PTtXIvtgs69HQv3HU=; b=QZYmodoIbK3Ukhc2GS7/CYzjYI EwE/qAIRtve9K0EYqV97EpyFSd8syvx+4jiHKm6pcDAgJ2gox4rMvZuRsKGgq2oC+mJgbqsARc75w Y3l8GpEcg+XG8jepi5s+hEmXDf+0ZW4NsbbCGF2hf9SNC3HeYqVUhoZQHLGp17DWZgJ1TYbf9RBP0 n+3Kh5uqdnxVssDCtwsehsE4HGEGCcVjQ/C/GghqRs3N0rIdG7QMcJZ8SddWIn0Si3v+BBOYb/ZV5 wkPWcAA2jw3p0SSVNdpk/fA9eh17CCHmX9mj5qeCbzVjCqbq7EU3vE0QZ+zJBRNKIPPugdYpPtpGR CCCVds2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syqYN-0000000CQ7T-1vSn; Thu, 10 Oct 2024 10:37:55 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syqKO-0000000CNN4-01Ka; Thu, 10 Oct 2024 10:23:29 +0000 Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5F06F1648; Thu, 10 Oct 2024 12:21:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728555709; bh=s/1gGhbnt50tcEUMLNEZ7eg+4hprLgeErANYEfXxqho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FhXyedf7uq/9gqlzV1eYj7ouAG0A7n/jKnsL2qcZJ0hTaRf7ld7GFB3P/+YjJfZYL KuN1W7kiWh5MU/eRpio4YTouFUY7nEK4I/EpAYTqoUS0NqSO0RYjyl0Cg8T/FkPc3U LJtWLgo2P4yoilFtgF1lJcF2eN0MNgxln15CPapg= 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 , Stefan Wahren , Laurent Pinchart , Umang Jain Subject: [PATCH 5/5] staging: vchiq_core: Locally cache cache_line_size information Date: Thu, 10 Oct 2024 15:52:49 +0530 Message-ID: <20241010102250.236545-6-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241010102250.236545-1-umang.jain@ideasonboard.com> References: <20241010102250.236545-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-20241010_032328_236945_D6E7B7F6 X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. 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 Locally cache 'cache_line_size' information in a variable instead of repeatedly accessing it from drv_mgmt->info. This helps to reflow lines under 80 columns. No functional change intended in this patch. Signed-off-by: Umang Jain Reviewed-by: Stefan Wahren --- .../interface/vchiq_arm/vchiq_core.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 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 d03b67f9cdb7..19c24dd9d1b3 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1516,6 +1516,7 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf, size_t pagelist_size; struct scatterlist *scatterlist, *sg; int dma_buffers; + unsigned int cache_line_size; dma_addr_t dma_addr; if (count >= INT_MAX - PAGE_SIZE) @@ -1666,10 +1667,10 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf, } /* Partial cache lines (fragments) require special measures */ + cache_line_size = drv_mgmt->info->cache_line_size; if ((type == PAGELIST_READ) && - ((pagelist->offset & (drv_mgmt->info->cache_line_size - 1)) || - ((pagelist->offset + pagelist->length) & - (drv_mgmt->info->cache_line_size - 1)))) { + ((pagelist->offset & (cache_line_size - 1)) || + ((pagelist->offset + pagelist->length) & (cache_line_size - 1)))) { char *fragments; if (down_interruptible(&drv_mgmt->free_fragments_sema)) { @@ -1699,6 +1700,7 @@ free_pagelist(struct vchiq_instance *instance, struct pagelist *pagelist = pagelistinfo->pagelist; struct page **pages = pagelistinfo->pages; unsigned int num_pages = pagelistinfo->num_pages; + unsigned int cache_line_size; dev_dbg(instance->state->dev, "arm: %pK, %d\n", pagelistinfo->pagelist, actual); @@ -1714,6 +1716,7 @@ free_pagelist(struct vchiq_instance *instance, pagelistinfo->scatterlist_mapped = 0; /* Deal with any partial cache lines (fragments) */ + cache_line_size = drv_mgmt->info->cache_line_size; if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS && drv_mgmt->fragments_base) { char *fragments = drv_mgmt->fragments_base + @@ -1721,10 +1724,10 @@ free_pagelist(struct vchiq_instance *instance, drv_mgmt->fragments_size; int head_bytes, tail_bytes; - head_bytes = (drv_mgmt->info->cache_line_size - pagelist->offset) & - (drv_mgmt->info->cache_line_size - 1); + head_bytes = (cache_line_size - pagelist->offset) & + (cache_line_size - 1); tail_bytes = (pagelist->offset + actual) & - (drv_mgmt->info->cache_line_size - 1); + (cache_line_size - 1); if ((actual >= 0) && (head_bytes != 0)) { if (head_bytes > actual) @@ -1737,8 +1740,8 @@ free_pagelist(struct vchiq_instance *instance, (tail_bytes != 0)) memcpy_to_page(pages[num_pages - 1], (pagelist->offset + actual) & - (PAGE_SIZE - 1) & ~(drv_mgmt->info->cache_line_size - 1), - fragments + drv_mgmt->info->cache_line_size, + (PAGE_SIZE - 1) & ~(cache_line_size - 1), + fragments + cache_line_size, tail_bytes); down(&drv_mgmt->free_fragments_mutex);