From nobody Tue Nov 26 15:33:31 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 48BE91DE4DC for ; Thu, 17 Oct 2024 13:37:05 +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=1729172231; cv=none; b=vECEoDcKkjW1atfe4yQW/+bHRF7Ghk0B7h6yh8bGjU533jrFfqRv3hf63Gu3TJeCUIflPKVdCjRntFCVEk+dDQhZckemJyF89DU/wno5lE1a/alq9ryh3H7sNHnqR6GVNxg/4KKmZwcflAYmD4pUdjibyMyiuA5Rgaq+Ew6nAzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729172231; c=relaxed/simple; bh=Zu496OQEDTWTNvz56oSeQb4zdJxLuEzbNXwR6ZUzPSo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pljcaTwlDUhgol9veUQdrC2JbFsBABedDeitSJpIzgIMM1BaCjcNO0OFIdXRMz1v4Xfsyiu86vEcONxBhSgSWp3/nP0LLd/FKXdSdmkYLB0bX4W2JdETI/vR5MmkCLA5z2207JzR5BQBT4bg3jo6Wxbz6L25ySF7oGHgXh0xh9I= 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=Onb+sOEv; 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="Onb+sOEv" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 19128173E; Thu, 17 Oct 2024 15:35:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1729172112; bh=Zu496OQEDTWTNvz56oSeQb4zdJxLuEzbNXwR6ZUzPSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Onb+sOEvIR7BLeu7MPWWIbk8SMQeFMv7jCTh0zfpimKnRO82aiWiyzQBkhf8O7+KZ kX28kSUbZnTJArTRhpzCneVphJd0gMUvu2u8tvdhmGQRK53LtU/culAIf6fu426jy8 oMleqOzDzbMzC31svm9rFXpfWEkatoOZ4++13+7s= 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, Dan Carpenter , Kieran Bingham , Laurent Pinchart , Stefan Wahren , kernel-list@raspberrypi.com, Umang Jain Subject: [PATCH 5/6] staging: vchiq_core: Simplify bulk transfer queue message function Date: Thu, 17 Oct 2024 19:06:28 +0530 Message-ID: <20241017133629.216672-6-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241017133629.216672-1-umang.jain@ideasonboard.com> References: <20241017133629.216672-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" vchiq_bulk_xfer_queue_msg_killable() is a common function between various bulk transfer code paths (blocking, callback and no-callback). These code paths were simplified earlier by passing a populated struct vchiq_bulk pointer in order to avoid open-coding the parameters required to initiate a bulk transfer. Now simplify the vchiq_bulk_xfer_queue_msg_killable() in a similar way i.e. avoid open-coding the function parameters and pass the struct vchiq_bulk pointer directly, coming from the various bulk transfer code paths. Signed-off-by: Umang Jain --- .../interface/vchiq_arm/vchiq_core.c | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 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 bb46aa20bdb4..9e56e34ca4d9 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3022,29 +3022,26 @@ close_service_complete(struct vchiq_service *servic= e, int failstate) */ static int vchiq_bulk_xfer_queue_msg_killable(struct vchiq_service *service, - void *offset, void __user *uoffset, - int size, void *userdata, - enum vchiq_bulk_mode mode, - enum vchiq_bulk_dir dir) + struct vchiq_bulk *bulk_params) { struct vchiq_bulk_queue *queue; struct bulk_waiter *bulk_waiter =3D NULL; struct vchiq_bulk *bulk; struct vchiq_state *state =3D service->state; - const char dir_char =3D (dir =3D=3D VCHIQ_BULK_TRANSMIT) ? 't' : 'r'; - const int dir_msgtype =3D (dir =3D=3D VCHIQ_BULK_TRANSMIT) ? + const char dir_char =3D (bulk_params->dir =3D=3D VCHIQ_BULK_TRANSMIT) ? '= t' : 'r'; + const int dir_msgtype =3D (bulk_params->dir =3D=3D VCHIQ_BULK_TRANSMIT) ? VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX; int status =3D -EINVAL; int payload[2]; =20 - if (mode =3D=3D VCHIQ_BULK_MODE_BLOCKING) { - bulk_waiter =3D userdata; + if (bulk_params->mode =3D=3D VCHIQ_BULK_MODE_BLOCKING) { + bulk_waiter =3D bulk_params->userdata; init_completion(&bulk_waiter->event); bulk_waiter->actual =3D 0; bulk_waiter->bulk =3D NULL; } =20 - queue =3D (dir =3D=3D VCHIQ_BULK_TRANSMIT) ? + queue =3D (bulk_params->dir =3D=3D VCHIQ_BULK_TRANSMIT) ? &service->bulk_tx : &service->bulk_rx; =20 if (mutex_lock_killable(&service->bulk_mutex)) @@ -3064,13 +3061,14 @@ vchiq_bulk_xfer_queue_msg_killable(struct vchiq_ser= vice *service, =20 bulk =3D &queue->bulks[BULK_INDEX(queue->local_insert)]; =20 - bulk->mode =3D mode; - bulk->dir =3D dir; - bulk->userdata =3D userdata; - bulk->size =3D size; + /* Initiliaze the 'bulk' slot with bulk parameters passed in. */ + bulk->mode =3D bulk_params->mode; + bulk->dir =3D bulk_params->dir; + bulk->userdata =3D bulk_params->userdata; + bulk->size =3D bulk_params->size; + bulk->offset =3D bulk_params->offset; + bulk->uoffset =3D bulk_params->uoffset; bulk->actual =3D VCHIQ_BULK_ACTUAL_ABORTED; - bulk->offset =3D offset; - bulk->uoffset =3D uoffset; =20 if (vchiq_prepare_bulk_data(service->instance, bulk)) goto unlock_error_exit; @@ -3083,7 +3081,7 @@ vchiq_bulk_xfer_queue_msg_killable(struct vchiq_servi= ce *service, =20 dev_dbg(state->dev, "core: %d: bt (%d->%d) %cx %x@%pad %pK\n", state->id, service->localport, service->remoteport, - dir_char, size, &bulk->data, userdata); + dir_char, bulk->size, &bulk->data, bulk->userdata); =20 /* * The slot mutex must be held when the service is being closed, so @@ -3489,10 +3487,7 @@ vchiq_bulk_xfer_blocking(struct vchiq_instance *inst= ance, unsigned int handle, goto error_exit; =20 =20 - status =3D vchiq_bulk_xfer_queue_msg_killable(service, bulk_params->offse= t, - bulk_params->uoffset, bulk_params->size, - bulk_params->userdata, bulk_params->mode, - bulk_params->dir); + status =3D vchiq_bulk_xfer_queue_msg_killable(service, bulk_params); =20 error_exit: vchiq_service_put(service); @@ -3523,9 +3518,7 @@ vchiq_bulk_xfer_callback(struct vchiq_instance *insta= nce, unsigned int handle, if (vchiq_check_service(service)) goto error_exit; =20 - status =3D vchiq_bulk_xfer_queue_msg_killable(service, bulk_params->offse= t, bulk_params->uoffset, - bulk_params->size, bulk_params->userdata, - bulk_params->mode, bulk_params->dir); + status =3D vchiq_bulk_xfer_queue_msg_killable(service, bulk_params); =20 error_exit: vchiq_service_put(service); --=20 2.45.2