From nobody Wed Nov 27 10:31:11 2024 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20EA0207217 for ; Fri, 11 Oct 2024 07:30:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631824; cv=none; b=Y/9JzDruaCaK1wgOOVBeW8jjz0XyWMsxPfxNYw9ITHcUIAz2R7CEVKZBVNfNl/wUq5+sVMcGIbe7R1k1x2tYd1rEEARomqwZyU12W0AJkXLAPTQnif7986PU4F32xo1wbZXfsjpI7KN2C/SViPXIDJb00hG959ImDRLNblAavuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631824; c=relaxed/simple; bh=HPzlE9sh1djReKfpWW1YtSaIElNq0n+B+WspYQFZr6Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mBwAKcAZI1tIb3XuGeXvdH45df0EzFC+wZE5EQ7xeXEMEKdAuv+MGHW1wj6DzWi+ByBAGRqu0C4xMEwfdBslxXQelqX5O22AIDhcoCHiJ1n29IfMpgNl6NFcEsZD3W2lMOZeGFPEITBahYiRR9CgFfqAmSTQkk8ZEdqOKjwqAa8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=klixmQzz; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="klixmQzz" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 06579229; Fri, 11 Oct 2024 09:20:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728631261; bh=HPzlE9sh1djReKfpWW1YtSaIElNq0n+B+WspYQFZr6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=klixmQzzl9HPXqPwQIprJNgmnwZ64HPpgEmp43Uk+l4IuZkFRaIWlgh7rv0TJoNWo Tv+t6Jju1NVBQRdeq6O0TJroMeiu0C3jlc608DL9wl1spH425UGr5IXB5dfmRPdwqy 8xtNDXfIaAWWoVxTsDYC99Qwf49UoqY2YmfiqQpQ= 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 1/8] staging: vchiq_core: Locally cache cache_line_size information Date: Fri, 11 Oct 2024 12:52:03 +0530 Message-ID: <20241011072210.494672-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241011072210.494672-1-umang.jain@ideasonboard.com> References: <20241011072210.494672-1-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 1e4b2978c186..e9b60dd8d419 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1490,6 +1490,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; =20 if (count >=3D INT_MAX - PAGE_SIZE) @@ -1638,10 +1639,10 @@ create_pagelist(struct vchiq_instance *instance, ch= ar *buf, char __user *ubuf, } =20 /* Partial cache lines (fragments) require special measures */ + cache_line_size =3D drv_mgmt->info->cache_line_size; if ((type =3D=3D 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; =20 if (down_interruptible(&drv_mgmt->free_fragments_sema)) { @@ -1671,6 +1672,7 @@ free_pagelist(struct vchiq_instance *instance, struct= vchiq_pagelist_info *pagel struct pagelist *pagelist =3D pagelistinfo->pagelist; struct page **pages =3D pagelistinfo->pages; unsigned int num_pages =3D pagelistinfo->num_pages; + unsigned int cache_line_size; =20 dev_dbg(instance->state->dev, "arm: %pK, %d\n", pagelistinfo->pagelist, a= ctual); =20 @@ -1685,16 +1687,17 @@ free_pagelist(struct vchiq_instance *instance, stru= ct vchiq_pagelist_info *pagel pagelistinfo->scatterlist_mapped =3D 0; =20 /* Deal with any partial cache lines (fragments) */ + cache_line_size =3D drv_mgmt->info->cache_line_size; if (pagelist->type >=3D PAGELIST_READ_WITH_FRAGMENTS && drv_mgmt->fragmen= ts_base) { char *fragments =3D drv_mgmt->fragments_base + (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * drv_mgmt->fragments_size; int head_bytes, tail_bytes; =20 - head_bytes =3D (drv_mgmt->info->cache_line_size - pagelist->offset) & - (drv_mgmt->info->cache_line_size - 1); + head_bytes =3D (cache_line_size - pagelist->offset) & + (cache_line_size - 1); tail_bytes =3D (pagelist->offset + actual) & - (drv_mgmt->info->cache_line_size - 1); + (cache_line_size - 1); =20 if ((actual >=3D 0) && (head_bytes !=3D 0)) { if (head_bytes > actual) @@ -1707,8 +1710,8 @@ free_pagelist(struct vchiq_instance *instance, struct= vchiq_pagelist_info *pagel (tail_bytes !=3D 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); =20 down(&drv_mgmt->free_fragments_mutex); --=20 2.45.2 From nobody Wed Nov 27 10:31:11 2024 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CA67209F28 for ; Fri, 11 Oct 2024 07:22:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631366; cv=none; b=GglGPAYsLe+RbZ6PKYBpdqpFsZO1muaWFgxYJ5WXrJLxEp4udvbwBm8mHM6DmIBWf7jWVaz+MAF25w+m75Ttnz9ezOC8720EOdbCgGQhjcn5HibXJ/5JZl8a10395Hyx/By9cCW5ocSFP14x0IMwq+jkOm6INX8VBp3Y1fE/kb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631366; c=relaxed/simple; bh=xD3T27aSbZGVWM3LeK6ZydUsioF47rQqpXbA99qZANY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VQOUdFh+tEDBM+XWbxWc9IxJTrtbWX3oZdX5eBUWO4Uvj5sjjyQHVsAUXBGSE2GtZnI1j24wUlHaivMqxiOBQayYDD/4C/KHC593wqcGaV8W7AJj9a/JRRnnfv/IkIX6FbzSY/2+ZC/5Ph5TssQFjMJ+yURbOUohSktRFoULClo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=sk8bw1jm; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="sk8bw1jm" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1E0CAD8B; Fri, 11 Oct 2024 09:21:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728631263; bh=xD3T27aSbZGVWM3LeK6ZydUsioF47rQqpXbA99qZANY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sk8bw1jmvxjhrc5iEPBuJhwkTPZOY32VV1NqZUihD47hreLaGLG48vSNWpVoBoz0u Kh6a7b9erjNZn8+N6WUvblXBXdOxiLezxeZdJZTzny7pvY050GL5GCdKFaVe6vaUpa S8ajAIaNM11ixccxHb0ItwHYWmXW+slhjyPxtCec= 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/8] staging: vchiq_core: Properly log dev_err() Date: Fri, 11 Oct 2024 12:52:04 +0530 Message-ID: <20241011072210.494672-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241011072210.494672-1-umang.jain@ideasonboard.com> References: <20241011072210.494672-1-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Properly log a dev_err() message when the msgid is not of VCHIQ_MSG_PADDING type. Drop 'oldmsgid' scoped variable and improve on the error string as well. Signed-off-by: Umang Jain --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 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 e9b60dd8d419..1dca676186b6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1188,13 +1188,10 @@ queue_message_sync(struct vchiq_state *state, struc= t vchiq_service *service, header =3D (struct vchiq_header *)SLOT_DATA_FROM_INDEX(state, local->slot_sync); =20 - { - int oldmsgid =3D header->msgid; - - if (oldmsgid !=3D VCHIQ_MSGID_PADDING) - dev_err(state->dev, "core: %d: qms - msgid %x, not PADDING\n", - state->id, oldmsgid); - } + if (header->msgid !=3D VCHIQ_MSGID_PADDING) + dev_err(state->dev, + "core: %d: qms - msgid %x, is not a PADDING message\n", + state->id, header->msgid); =20 dev_dbg(state->dev, "sync: %d: qms %s@%pK,%x (%d->%d)\n", state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), header, size, --=20 2.45.2 From nobody Wed Nov 27 10:31:11 2024 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EC68209686 for ; Fri, 11 Oct 2024 07:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631368; cv=none; b=HB3JE8ZwOSDr0Ymq4avUId7MJWH2QHOdsXVMW7Wx+dA5+eqcz3Yx+pXMiQiFq4boghYHhcmBcnX51mbs2aHTlUehkZwBieFPSkx0ZiwDiu6MvW0XKvFD4Hia3DwzEw4a/vHAC2afclXwfpSCnCifMbSYWft5chB3ZmzFQ1Ubq7I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631368; c=relaxed/simple; bh=2r8iDPbU33zt3eyRnDjAEsNRDwFTo3MDsTAsUAMhUPk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ALWcpyp0k4w2k2JwQ7MScbpy2Vk2lYK072b7RDkTg9OQ8kgJP7G+bcoL1KJM8xiuFXAuTQOGCdCJNwffI2l6TD4SmkxlA/SXRSt4S4XpBCG2d069MxW2xvohp1/ov8xJlIHYPIkv0THLgarBYSaU2LFUMZKOr+lWMshueySEaBg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=hwZeJGMN; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hwZeJGMN" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 379931659; Fri, 11 Oct 2024 09:21:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728631266; bh=2r8iDPbU33zt3eyRnDjAEsNRDwFTo3MDsTAsUAMhUPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hwZeJGMNYQeb58MTevyGN9pnCW3RkDcTGvRNQ2CXVRbFU4+oNqk1PCIxed2v0S4Pe 2K28W2ikC29pWZd5vNenvXN4uPgzJgsLnky+0B8/FuyiTRBJfyBOGnwf/tB/mEV4Bq V49E4eIkxw/iqNC1rDXspc6dNUfJu8b9xSagFoo4= 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/8] staging: vchiq_core: Do not log debug in a separate scope Date: Fri, 11 Oct 2024 12:52:05 +0530 Message-ID: <20241011072210.494672-4-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241011072210.494672-1-umang.jain@ideasonboard.com> References: <20241011072210.494672-1-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Do not log a dev_dbg() with a separate scope. Drop the {..} scope and align the dev_dbg() to make it more readable. No functional changes intended in this patch. Signed-off-by: Umang Jain Reviewed-by: Stefan Wahren --- .../interface/vchiq_arm/vchiq_core.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 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 1dca676186b6..15257cf66fa4 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -936,6 +936,7 @@ queue_message(struct vchiq_state *state, struct vchiq_s= ervice *service, struct vchiq_service_quota *quota =3D NULL; struct vchiq_header *header; int type =3D VCHIQ_MSG_TYPE(msgid); + int svc_fourcc; =20 size_t stride; =20 @@ -1128,17 +1129,13 @@ queue_message(struct vchiq_state *state, struct vch= iq_service *service, header->msgid =3D msgid; header->size =3D size; =20 - { - int svc_fourcc; - - svc_fourcc =3D service - ? service->base.fourcc - : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); + svc_fourcc =3D service ? service->base.fourcc + : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); =20 - dev_dbg(state->dev, "core_msg: Sent Msg %s(%u) to %p4cc s:%u d:%d len:%z= u\n", - msg_type_str(VCHIQ_MSG_TYPE(msgid)), VCHIQ_MSG_TYPE(msgid), - &svc_fourcc, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid), size); - } + 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); =20 /* Make sure the new header is visible to the peer. */ wmb(); --=20 2.45.2 From nobody Wed Nov 27 10:31:11 2024 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D01B1209F2D for ; Fri, 11 Oct 2024 07:22:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631369; cv=none; b=MWznEYvUetFDdPh1vWUh+K6WdwHhFu03MDv7Q8Jo9iEeM22rXEg+ipJl2jNQ259dHGARqI7TSZ+P/EDEJyau3pkmqGYxGQ8zEVegP8cOc26zbrfMjJWO+vPj57chIMgi/NumHA1TfU5Ucz7LBpBKGTpCjhxZ/q+jnWsL1mhcm+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631369; c=relaxed/simple; bh=aq1G9v7QkkDHMgWxaXZsBIyzSkrAQpuXZGFVJXUhnZ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GlYPi9njfqyg81ko0M4eliIKkr2QhfUlGqsnlW8cFbq6KlZE7l266hmKhqm/9Pb7U7hU+bgYeB7wm8izk9ehSOvpSexLG2W3lou+9TuT2ekt4/eSpFHZdz2LqMLBz82yU/6sGwD7Xv7t3+dvmwpRjqNxWdF/esMopqZ3YsJPyf4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=XwXRAuV9; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="XwXRAuV9" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5570F1A6F; Fri, 11 Oct 2024 09:21:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728631268; bh=aq1G9v7QkkDHMgWxaXZsBIyzSkrAQpuXZGFVJXUhnZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XwXRAuV9zzPqheho81zUAQd38jqjNnPHHbjzJZuIGPaHphGqb38tGrF58x9GhT+EE qTThT8jl21AWqwjdbh/vTjjcGSoy+9t3N8A2gp9UrJMEDUQ/Km9zboFQ467jVudzjb HW6gquQKG9/++2QWBGPnJaEYH9jJdlHMEEKg3KS4= 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/8] staging: vchiq_core: Lower indentation of a conditional block Date: Fri, 11 Oct 2024 12:52:06 +0530 Message-ID: <20241011072210.494672-5-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241011072210.494672-1-umang.jain@ideasonboard.com> References: <20241011072210.494672-1-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- .../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 =3D &queue->bulks[BULK_INDEX(queue->remove)]; =20 + 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 !=3D VCHIQ_BULK_ACTUAL_ABORTED) { - if (bulk->dir =3D=3D 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 !=3D VCHIQ_BULK_ACTUAL_ABORTED) { + if (bulk->dir =3D=3D 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 =3D=3D VCHIQ_BULK_MODE_BLOCKING) { - struct bulk_waiter *waiter; - - spin_lock(&service->state->bulk_waiter_spinlock); - waiter =3D bulk->userdata; - if (waiter) { - waiter->actual =3D bulk->actual; - complete(&waiter->event); - } - spin_unlock(&service->state->bulk_waiter_spinlock); - } else if (bulk->mode =3D=3D VCHIQ_BULK_MODE_CALLBACK) { - enum vchiq_reason reason =3D - get_bulk_reason(bulk); - status =3D make_service_callback(service, reason, NULL, - bulk->userdata); - if (status =3D=3D -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 =3D=3D VCHIQ_BULK_MODE_BLOCKING) { + struct bulk_waiter *waiter; =20 + spin_lock(&service->state->bulk_waiter_spinlock); + waiter =3D bulk->userdata; + if (waiter) { + waiter->actual =3D bulk->actual; + complete(&waiter->event); + } + spin_unlock(&service->state->bulk_waiter_spinlock); + } else if (bulk->mode =3D=3D VCHIQ_BULK_MODE_CALLBACK) { + enum vchiq_reason reason =3D + get_bulk_reason(bulk); + status =3D make_service_callback(service, reason, NULL, + bulk->userdata); + if (status =3D=3D -EAGAIN) + break; + } +complete: queue->remove++; complete(&service->bulk_remove_event); } --=20 2.45.2 From nobody Wed Nov 27 10:31:11 2024 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA07220A5E1 for ; Fri, 11 Oct 2024 07:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631371; cv=none; b=WaFjH4oPT80bvA5NN3vr4tpA3VS0vc6RzMrXJo3JydIHj1giTgUifvkc6V9yaGjcrcI57HEMBNjZncPM9HL29YnyAcaVVnvH8582Il2w4cJAs/gSF36Cn+Ll2L+VB2PcsnqdtyVDvNTvcm1pYZ7yvI/FqYpUvVvPAIonbmyrDt8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631371; c=relaxed/simple; bh=whVPtN8m5r3DzuuuWAl7siTfoBgaFyvL0UZeWgrArA4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mXs+u/V2qEusvzqCNducigybd0tu9aKRjCBBCYUdUrQe/4MFZn+C0xcgzpUQ0xBbUQU1W1i5NCi0nbig/e5DwPbYvtTg46mTOyCjbSJ5D4WuzP0R0TyqtmxwgIxVk0M/kdw+jp+DSeu1wHYgrxFB4MDnZDz/xDo0mJZYfw1o4FE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=wNUmBlLs; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="wNUmBlLs" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6F4D0D8B; Fri, 11 Oct 2024 09:21:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728631270; bh=whVPtN8m5r3DzuuuWAl7siTfoBgaFyvL0UZeWgrArA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wNUmBlLsnebbbAP8tyHbVdk7FkwpCzJ2K98UOzkgZxQ0yRVTbEpzJxBf1lQjgzpNI /0Y4LEo5Gm0/ZfdYV5YvPYoBRaxZ7WhPUgKGtuNB2Aifdc1SnpoVAeiODuIWFv39V3 mliPhShQEXPwaDXbMVaTRHQ83cGfE8qyJRrzuI20= 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/8] staging: vchiq_core: Indent copy_message_data() on a single line Date: Fri, 11 Oct 2024 12:52:07 +0530 Message-ID: <20241011072210.494672-6-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241011072210.494672-1-umang.jain@ideasonboard.com> References: <20241011072210.494672-1-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Fix the copy_message_data() indentation in queue_message_sync(). Signed-off-by: Umang Jain Reviewed-by: Stefan Wahren --- .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 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 b95443043c27..3ed949343608 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1194,9 +1194,8 @@ queue_message_sync(struct vchiq_state *state, struct = vchiq_service *service, state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), header, size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); =20 - callback_result =3D - copy_message_data(copy_callback, context, - header->data, size); + callback_result =3D copy_message_data(copy_callback, context, + header->data, size); =20 if (callback_result < 0) { mutex_unlock(&state->slot_mutex); --=20 2.45.2 From nobody Wed Nov 27 10:31:11 2024 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D170820ADCD for ; Fri, 11 Oct 2024 07:22:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631373; cv=none; b=QjG3XTY+NgyD1SW9c2mON8aYiwE2wlwZU3kgsmt4zsK/IxZ/SQAr3M8wV/0UPqapM7JUkGp9FmKZwVgVzRt8FMzrrVEZBB559yGRYKo6b84AVqD1WANGT+rR7MoHofeBEymyshsbtE+1dgwCV1GEo25ScfnBWukG/QFzHgF3d88= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631373; c=relaxed/simple; bh=2YLGkeJa2U+BvKGXmrgkaFnPqLRL5Gan4oQ6Tqqvyg4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oDPZHMX6hKG4I/YoU3R1+1zXrhcOuzX1MiJ3P+p7rky2mLF6Jjf2d7vsBE4cQRUjRxxiVYmcYCk1r/T1aMD5/cToPkGGEbVVK4ZhHrofEaVU/h8abFCL10vYXJUyqS2XLrFwdL4VyR9zQ0BAf/cNWq25Q3IVz8WvYU/Mu+NIJ6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=QmijJ7CX; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="QmijJ7CX" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 882321659; Fri, 11 Oct 2024 09:21:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728631272; bh=2YLGkeJa2U+BvKGXmrgkaFnPqLRL5Gan4oQ6Tqqvyg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QmijJ7CX+GKIGq4NTZG0+Aw6T50tZcIZnzMjXxSMJFNPVTuJmC1txtpruSvJKW1ij PfNdAkuUS9Va6Thq2sNs9/vQUQD5X+P1R2b4tqCiWtCBCxPgJBq7ETIV1LyA94r2oJ v06Epa97HMOV/J8V1PVHHpIl69I14L1J8cL97UwE= 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 6/8] staging: vchiq_arm: Lower indentation of a conditional block Date: Fri, 11 Oct 2024 12:52:08 +0530 Message-ID: <20241011072210.494672-7-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241011072210.494672-1-umang.jain@ideasonboard.com> References: <20241011072210.494672-1-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Check early if we need to allocate the bulk waiter. This helps to improve readability and reduces the indentation of the 'if (waiter)' conditional block. No functional changes intended in this patch. Signed-off-by: Umang Jain --- .../interface/vchiq_arm/vchiq_arm.c | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c = b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 27ceaac8f6cc..a4a7f31b124a 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -564,28 +564,28 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *i= nstance, unsigned int handl } mutex_unlock(&instance->bulk_waiter_list_mutex); =20 - if (waiter) { - struct vchiq_bulk *bulk =3D waiter->bulk_waiter.bulk; - - if (bulk) { - /* This thread has an outstanding bulk transfer. */ - /* FIXME: why compare a dma address to a pointer? */ - if ((bulk->data !=3D (dma_addr_t)(uintptr_t)data) || (bulk->size !=3D s= ize)) { - /* - * This is not a retry of the previous one. - * Cancel the signal when the transfer completes. - */ - spin_lock(&service->state->bulk_waiter_spinlock); - bulk->userdata =3D NULL; - spin_unlock(&service->state->bulk_waiter_spinlock); - } - } - } else { + if (!waiter) { waiter =3D kzalloc(sizeof(*waiter), GFP_KERNEL); if (!waiter) return -ENOMEM; } =20 + struct vchiq_bulk *bulk =3D waiter->bulk_waiter.bulk; + + if (bulk) { + /* This thread has an outstanding bulk transfer. */ + /* FIXME: why compare a dma address to a pointer? */ + if ((bulk->data !=3D (dma_addr_t)(uintptr_t)data) || (bulk->size !=3D si= ze)) { + /* + * This is not a retry of the previous one. + * Cancel the signal when the transfer completes. + */ + spin_lock(&service->state->bulk_waiter_spinlock); + bulk->userdata =3D NULL; + spin_unlock(&service->state->bulk_waiter_spinlock); + } + } + ret =3D vchiq_bulk_xfer_blocking(instance, handle, data, NULL, size, &waiter->bulk_waiter, dir); if ((ret !=3D -EAGAIN) || fatal_signal_pending(current) || !waiter->bulk_= waiter.bulk) { --=20 2.45.2 From nobody Wed Nov 27 10:31:11 2024 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0672120ADF0 for ; Fri, 11 Oct 2024 07:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631375; cv=none; b=WFRIt+YMapNyY2zKantg1RIFv15XFmCWopRbjpoDQKEQ+8yb49mfCqi5cxbR+/YCMS2AmwlCh2x4skFUAr101WuBxdFE6KGz17h2Fm6y+dvsBiZ+cgRd73Y+LP4wapAyA70mtJJV2q187MLlhzZ8TbfDV2itUHH5ZKx8Bu05aPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631375; c=relaxed/simple; bh=ju7Tgv1YIpsQRNU04x/igU8G/YOvFQuWc2cpRl91hM0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G65Nv2dNIZUvWaWSBpjGMTwZ/Tc204q3PMet+IH7hWcLoHp3OZIQlsVgGRaYw7uhq8RXTVB3/cSvLRtg0KJkMQ1RcBSF6igiQ5gSzkLoXbBu4OcYNlrIRED9GWawmTylf9QEaMM60b7nQ87LEczasTlrGj+jJt0AnVnVFaKbGo8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=irtUpP2P; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="irtUpP2P" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9F763CDB; Fri, 11 Oct 2024 09:21:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728631274; bh=ju7Tgv1YIpsQRNU04x/igU8G/YOvFQuWc2cpRl91hM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=irtUpP2PuYNSI1tv5aqDf9S05AVEBS2DZBhO9fpr6HvbF2GPEEFl5g6bymAN/TfkL T5QBe9CGzTvtMZhsNurO1V0p0bP1rVu1TqssW+SVZM3KnzjBaLD2uN9nafFPxuJTU6 AL4/JN1ENUJ3RYR/lHo0n2XJa3osZ4vsqeQzNWak= 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 7/8] staging: vchiq_core: Lower indentation in parse_open() Date: Fri, 11 Oct 2024 12:52:09 +0530 Message-ID: <20241011072210.494672-8-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241011072210.494672-1-umang.jain@ideasonboard.com> References: <20241011072210.494672-1-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D=3D 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 3ed949343608..04401baee9a6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1813,8 +1813,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 =3D NULL; int msgid, size; + int openack_id; unsigned int localport, remoteport, fourcc; short version, version_min; =20 @@ -1849,34 +1851,36 @@ parse_open(struct vchiq_state *state, struct vchiq_= header *header) } service->peer_version =3D version; =20 - if (service->srvstate =3D=3D VCHIQ_SRVSTATE_LISTENING) { - struct vchiq_openack_payload ack_payload =3D { - service->version - }; - int openack_id =3D MAKE_OPENACK(service->localport, remoteport); + if (service->srvstate !=3D VCHIQ_SRVSTATE_LISTENING) + goto done; =20 - if (state->version_common < - VCHIQ_VERSION_SYNCHRONOUS_MODE) - service->sync =3D 0; + ack_payload.version =3D service->version; + openack_id =3D MAKE_OPENACK(service->localport, remoteport); =20 - /* Acknowledge the OPEN */ - if (service->sync) { - if (queue_message_sync(state, NULL, openack_id, memcpy_copy_callback, - &ack_payload, sizeof(ack_payload)) =3D=3D -EAGAIN) - goto bail_not_ready; + if (state->version_common < VCHIQ_VERSION_SYNCHRONOUS_MODE) + service->sync =3D 0; =20 - /* 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) =3D=3D -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)) =3D=3D -EAGAIN) + goto bail_not_ready; =20 - /* 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) =3D=3D -EINTR) + goto bail_not_ready; + + /* The service is now open */ + set_service_state(service, VCHIQ_SRVSTATE_OPEN); } =20 +done: /* Success - the message has been dealt with */ vchiq_service_put(service); return 1; --=20 2.45.2 From nobody Wed Nov 27 10:31:11 2024 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1863820B1EB for ; Fri, 11 Oct 2024 07:22:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631377; cv=none; b=OWz52qJxinBytiZtj3K/wGM6oBSdIkmSRj06l2BernakD5/b1YT09+SGRMobEx8lGlEo4zMQIfersxzbf6s4iySZ9jTdvxItAGjSN+rO0nOlUftGEzvFrfN04z5QJMCaOqGOoptZ5zucC/aOgqJdB/p6fXRftCm0uE910eEs8gk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631377; c=relaxed/simple; bh=csyxQoNQ7+mcBisJn+zgfV6Hd6DlNjHmaj2xueLISA8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GV8mmiGUBlBhx1Bka3cXF/k42wXUW3kcn9QWGxOrNeGw7hd18V8cjBE7/LnxVnZAXFvnBleZEGA5cDn3WICh5Xatsd6Qe+6/7dyr6BBdLmzkBhxycvGlU1YjnHsDTZ6cIFEGpS0EAkHsaif9I+aEGFKDIWiTbDtAj4CyMrlFOOM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=QB+0yjaJ; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="QB+0yjaJ" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B9A25D8B; Fri, 11 Oct 2024 09:21:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728631276; bh=csyxQoNQ7+mcBisJn+zgfV6Hd6DlNjHmaj2xueLISA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QB+0yjaJGoVmccHL2cyKLdAx/mNCkmh57XSSS559Lg8tLrlcOu+P6tsk54Y/jqYDH 4WJ1gVu3jGZJMVhn/gcuPfn2kGJQYWsXCh76RE4E+YAQSBgAU+uzTyzpZBJnT5/whI jsVqZEHgcRyVMpKF6KpuxrXvIlZ9vdWH8zSLPOzo= 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 8/8] staging: vchiq_core: Lower indentation in vchiq_close_service_internal Date: Fri, 11 Oct 2024 12:52:10 +0530 Message-ID: <20241011072210.494672-9-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241011072210.494672-1-umang.jain@ideasonboard.com> References: <20241011072210.494672-1-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reduce indentation of the conditional nesting in vchiq_close_service_internal() switch case by checking the error paths first and break early. This helps to reduce conditional branching and reduce indentation levels. Signed-off-by: Umang Jain --- .../interface/vchiq_arm/vchiq_core.c | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 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 04401baee9a6..204d73f4e904 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3152,19 +3152,21 @@ vchiq_close_service_internal(struct vchiq_service *= service, int close_recvd) if (close_recvd) { dev_err(state->dev, "core: (1) called in state %s\n", srvstate_names[service->srvstate]); - } else if (is_server) { - if (service->srvstate =3D=3D VCHIQ_SRVSTATE_LISTENING) { - status =3D -EINVAL; - } else { - service->client_id =3D 0; - service->remoteport =3D VCHIQ_PORT_FREE; - if (service->srvstate =3D=3D VCHIQ_SRVSTATE_CLOSEWAIT) - set_service_state(service, VCHIQ_SRVSTATE_LISTENING); - } - complete(&service->remove_event); - } else { + break; + } else if (!is_server) { vchiq_free_service_internal(service); + break; + } + + if (service->srvstate =3D=3D VCHIQ_SRVSTATE_LISTENING) { + status =3D -EINVAL; + } else { + service->client_id =3D 0; + service->remoteport =3D VCHIQ_PORT_FREE; + if (service->srvstate =3D=3D VCHIQ_SRVSTATE_CLOSEWAIT) + set_service_state(service, VCHIQ_SRVSTATE_LISTENING); } + complete(&service->remove_event); break; case VCHIQ_SRVSTATE_OPENING: if (close_recvd) { --=20 2.45.2