From patchwork Thu Oct 17 13:36:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13840076 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 9B405D37495 for ; Thu, 17 Oct 2024 13:50:13 +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=kyKigKtFFo2NdsD2vPmK7zQacvtE+E5LdT1/3rMzAsQ=; b=zO3AK5OCrFmiDc3K0ukdJWht6X j1H8IRTXu/IcWLbU0ko4jkYijj+p5YGu5fU5pMs0UmpqCyWVprU1LiCv5U8TrXFM2ShM5G3yrYLSC z4xWMN5pqdMTSZULnc5wbIhuHMGGFGvoBJuRhA3lyuEweIrl0sDks9ZmSMsU3upL7fndVSaGP283s S6Cpqnc+4Ry5/ITKQLOeWSn2Pb+EKo0GeDbeDmu1d7WsOfkBPyFlv0We8gDtbzvQmRjAiXsPecAOY 23V2EyMMoE/ROVWdGu5npq4PEeYAXg61dTbN1csyElozeY+CkaR5VRvSnUZ10Ol9ZVnz5lcH6+ApK ea/1LNcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1Qt5-0000000F0E2-38WZ; Thu, 17 Oct 2024 13:49:59 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1QgL-0000000ExNp-34an; Thu, 17 Oct 2024 13:36:55 +0000 Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 363641014; Thu, 17 Oct 2024 15:35:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1729172105; bh=EqLwRX+3J2XHSyc5StHZnS7+pkIcemBGni0Mlp9KqUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jeVauZPE3eVeXIH3E0eI+TpcpsbCnzB72b+bMD5lG3s8JKvW+NFxFD7NOb6CvqCZj YkVm14DFh6GBWwD/oCRc90N+tVzXn6gWCMUoSEfY5UiEgrkB/rE2wwNQy1dqNgS0Tv ZcizDZSdluNmSidsz4BtIIBNPeOC5HAMk6rt7zPw= 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 2/6] staging: vchiq_core: Simplify bulk data preparatory functions Date: Thu, 17 Oct 2024 19:06:25 +0530 Message-ID: <20241017133629.216672-3-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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_063649_932925_A3DFA7DE X-CRM114-Status: UNSURE ( 9.15 ) 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 Two functions create_pagelist() and vchiq_prepare_bulk_data() open code bulk data arguments ('size' and 'dir') in their function signatures which can easily be obtained by struct vchiq_bulk pointer. Retrieve the arguments from vchiq_bulk pointer instead and reduce the number of arguments passed in create_pagelist() and vchiq_bulk_prepare_data(). No functional changes intended in this patch. Signed-off-by: Umang Jain --- .../interface/vchiq_arm/vchiq_core.c | 16 +++++++--------- 1 file changed, 7 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 7c6f09a9d917..62356a165696 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1482,8 +1482,7 @@ is_adjacent_block(u32 *addrs, dma_addr_t addr, unsigned int k) * cached area. */ static struct vchiq_pagelist_info * -create_pagelist(struct vchiq_instance *instance, struct vchiq_bulk *bulk, - size_t count, unsigned short type) +create_pagelist(struct vchiq_instance *instance, struct vchiq_bulk *bulk) { struct vchiq_drv_mgmt *drv_mgmt; struct pagelist *pagelist; @@ -1497,6 +1496,9 @@ create_pagelist(struct vchiq_instance *instance, struct vchiq_bulk *bulk, int dma_buffers; unsigned int cache_line_size; dma_addr_t dma_addr; + size_t count = bulk->size; + unsigned short type = (bulk->dir == VCHIQ_BULK_RECEIVE) + ? PAGELIST_READ : PAGELIST_WRITE; if (count >= INT_MAX - PAGE_SIZE) return NULL; @@ -1740,15 +1742,11 @@ 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, - int size, int dir) +vchiq_prepare_bulk_data(struct vchiq_instance *instance, struct vchiq_bulk *bulk) { struct vchiq_pagelist_info *pagelistinfo; - pagelistinfo = create_pagelist(instance, bulk, size, - (dir == VCHIQ_BULK_RECEIVE) - ? PAGELIST_READ - : PAGELIST_WRITE); + pagelistinfo = create_pagelist(instance, bulk); if (!pagelistinfo) return -ENOMEM; @@ -3074,7 +3072,7 @@ vchiq_bulk_xfer_queue_msg_killable(struct vchiq_service *service, bulk->offset = offset; bulk->uoffset = uoffset; - if (vchiq_prepare_bulk_data(service->instance, bulk, size, dir)) + if (vchiq_prepare_bulk_data(service->instance, bulk)) goto unlock_error_exit; /*