[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241017133629.216672-3-umang.jain@ideasonboard.com>
Date: Thu, 17 Oct 2024 19:06:25 +0530
From: Umang Jain <umang.jain@...asonboard.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>
Cc: linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Dan Carpenter <dan.carpenter@...aro.org>,
Kieran Bingham <kieran.bingham@...asonboard.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Stefan Wahren <wahrenst@....net>,
kernel-list@...pberrypi.com,
Umang Jain <umang.jain@...asonboard.com>
Subject: [PATCH 2/6] staging: vchiq_core: Simplify bulk data preparatory functions
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 <umang.jain@...asonboard.com>
---
.../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;
/*
--
2.45.2
Powered by blists - more mailing lists