mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 06:31:52 +00:00
vduse: Use memcpy_{to,from}_page() in do_bounce()
kmap_atomic() is being deprecated in favor of kmap_local_page(). The use of kmap_atomic() in do_bounce() is all thread local therefore kmap_local_page() is a sufficient replacement. Convert to kmap_local_page() but, instead of open coding it, use the helpers memcpy_to_page() and memcpy_from_page(). Signed-off-by: Xie Yongji <xieyongji@bytedance.com> Acked-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Muchun Song <songmuchun@bytedance.com> Message-Id: <20220803045523.23851-3-xieyongji@bytedance.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
c32ee69312
commit
82eb46f94a
@ -138,18 +138,17 @@ static void do_bounce(phys_addr_t orig, void *addr, size_t size,
|
||||
{
|
||||
unsigned long pfn = PFN_DOWN(orig);
|
||||
unsigned int offset = offset_in_page(orig);
|
||||
char *buffer;
|
||||
struct page *page;
|
||||
unsigned int sz = 0;
|
||||
|
||||
while (size) {
|
||||
sz = min_t(size_t, PAGE_SIZE - offset, size);
|
||||
|
||||
buffer = kmap_atomic(pfn_to_page(pfn));
|
||||
page = pfn_to_page(pfn);
|
||||
if (dir == DMA_TO_DEVICE)
|
||||
memcpy(addr, buffer + offset, sz);
|
||||
memcpy_from_page(addr, page, offset, sz);
|
||||
else
|
||||
memcpy(buffer + offset, addr, sz);
|
||||
kunmap_atomic(buffer);
|
||||
memcpy_to_page(page, offset, addr, sz);
|
||||
|
||||
size -= sz;
|
||||
pfn++;
|
||||
|
Loading…
Reference in New Issue
Block a user