drm/modes: Fix drm_mode_vrefres() docs
[drm/drm-misc.git] / arch / riscv / kernel / crash_dump.c
blobea2158cee97b344c5e5a2811493a0985d4d2e56a
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * This code comes from arch/arm64/kernel/crash_dump.c
4 * Created by: AKASHI Takahiro <takahiro.akashi@linaro.org>
5 * Copyright (C) 2017 Linaro Limited
6 */
8 #include <linux/crash_dump.h>
9 #include <linux/io.h>
10 #include <linux/uio.h>
12 ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn,
13 size_t csize, unsigned long offset)
15 void *vaddr;
17 if (!csize)
18 return 0;
20 vaddr = memremap(__pfn_to_phys(pfn), PAGE_SIZE, MEMREMAP_WB);
21 if (!vaddr)
22 return -ENOMEM;
24 csize = copy_to_iter(vaddr + offset, csize, iter);
26 memunmap(vaddr);
27 return csize;