mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-06 06:10:45 -04:00
staging: vchiq_core: Locally cache cache_line_size information
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 <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241013112128.397249-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2bf280c30e
commit
5fa110249b
@@ -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;
|
||||
|
||||
if (count >= INT_MAX - PAGE_SIZE)
|
||||
@@ -1638,10 +1639,10 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf,
|
||||
}
|
||||
|
||||
/* Partial cache lines (fragments) require special measures */
|
||||
cache_line_size = drv_mgmt->info->cache_line_size;
|
||||
if ((type == 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;
|
||||
|
||||
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 = pagelistinfo->pagelist;
|
||||
struct page **pages = pagelistinfo->pages;
|
||||
unsigned int num_pages = pagelistinfo->num_pages;
|
||||
unsigned int cache_line_size;
|
||||
|
||||
dev_dbg(instance->state->dev, "arm: %pK, %d\n", pagelistinfo->pagelist, actual);
|
||||
|
||||
@@ -1685,16 +1687,17 @@ free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagel
|
||||
pagelistinfo->scatterlist_mapped = 0;
|
||||
|
||||
/* Deal with any partial cache lines (fragments) */
|
||||
cache_line_size = drv_mgmt->info->cache_line_size;
|
||||
if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS && drv_mgmt->fragments_base) {
|
||||
char *fragments = drv_mgmt->fragments_base +
|
||||
(pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) *
|
||||
drv_mgmt->fragments_size;
|
||||
int head_bytes, tail_bytes;
|
||||
|
||||
head_bytes = (drv_mgmt->info->cache_line_size - pagelist->offset) &
|
||||
(drv_mgmt->info->cache_line_size - 1);
|
||||
head_bytes = (cache_line_size - pagelist->offset) &
|
||||
(cache_line_size - 1);
|
||||
tail_bytes = (pagelist->offset + actual) &
|
||||
(drv_mgmt->info->cache_line_size - 1);
|
||||
(cache_line_size - 1);
|
||||
|
||||
if ((actual >= 0) && (head_bytes != 0)) {
|
||||
if (head_bytes > actual)
|
||||
@@ -1707,8 +1710,8 @@ free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagel
|
||||
(tail_bytes != 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);
|
||||
|
||||
down(&drv_mgmt->free_fragments_mutex);
|
||||
|
||||
Reference in New Issue
Block a user