* cached area.
*/
static struct vchiq_pagelist_info *
-create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf,
+create_pagelist(struct vchiq_instance *instance, struct vchiq_bulk *bulk,
size_t count, unsigned short type)
{
struct vchiq_drv_mgmt *drv_mgmt;
drv_mgmt = dev_get_drvdata(instance->state->dev);
- if (buf)
- offset = (uintptr_t)buf & (PAGE_SIZE - 1);
+ if (bulk->offset)
+ offset = (uintptr_t)bulk->offset & (PAGE_SIZE - 1);
else
- offset = (uintptr_t)ubuf & (PAGE_SIZE - 1);
+ offset = (uintptr_t)bulk->uoffset & (PAGE_SIZE - 1);
num_pages = DIV_ROUND_UP(count + offset, PAGE_SIZE);
if ((size_t)num_pages > (SIZE_MAX - sizeof(struct pagelist) -
pagelistinfo->scatterlist = scatterlist;
pagelistinfo->scatterlist_mapped = 0;
- if (buf) {
+ if (bulk->offset) {
unsigned long length = count;
unsigned int off = offset;
for (actual_pages = 0; actual_pages < num_pages;
actual_pages++) {
struct page *pg =
- vmalloc_to_page((buf +
+ vmalloc_to_page(((unsigned int *)bulk->offset +
(actual_pages * PAGE_SIZE)));
size_t bytes = PAGE_SIZE - off;
}
/* 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)bulk->uoffset & 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",
}
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,
+ int size, int dir)
{
struct vchiq_pagelist_info *pagelistinfo;
- pagelistinfo = create_pagelist(instance, offset, uoffset, size,
+ pagelistinfo = create_pagelist(instance, bulk, size,
(dir == VCHIQ_BULK_RECEIVE)
? PAGELIST_READ
: PAGELIST_WRITE);
bulk->userdata = userdata;
bulk->size = size;
bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED;
+ bulk->offset = offset;
+ bulk->uoffset = uoffset;
- if (vchiq_prepare_bulk_data(service->instance, bulk, offset, uoffset, size, dir))
+ if (vchiq_prepare_bulk_data(service->instance, bulk, size, dir))
goto unlock_error_exit;
/*