Skip to content

Commit 8970d5c

Browse files
groeckrichardweinberger
authored andcommitted
um: Replace to_phys() and to_virt() with less generic function names
to_virt() and to_phys() are very generic and may be defined by drivers. As it turns out, commit 9409c9b ("pmem: refactor pmem_clear_poison()") did exactly that. This results in build errors such as the following when trying to build um:allmodconfig. drivers/nvdimm/pmem.c: In function ‘pmem_dax_zero_page_range’: ./arch/um/include/asm/page.h:105:20: error: too few arguments to function ‘to_phys’ 105 | #define __pa(virt) to_phys((void *) (unsigned long) (virt)) | ^~~~~~~ Use less generic function names for the um specific to_phys() and to_virt() functions to fix the problem and to avoid similar problems in the future. Fixes: 9409c9b ("pmem: refactor pmem_clear_poison()") Cc: Dan Williams <dan.j.williams@intel.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com> Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 637285e commit 8970d5c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

arch/um/include/asm/page.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ extern unsigned long uml_physmem;
102102
* casting is the right thing, but 32-bit UML can't have 64-bit virtual
103103
* addresses
104104
*/
105-
#define __pa(virt) to_phys((void *) (unsigned long) (virt))
106-
#define __va(phys) to_virt((unsigned long) (phys))
105+
#define __pa(virt) uml_to_phys((void *) (unsigned long) (virt))
106+
#define __va(phys) uml_to_virt((unsigned long) (phys))
107107

108108
#define phys_to_pfn(p) ((p) >> PAGE_SHIFT)
109109
#define pfn_to_phys(pfn) PFN_PHYS(pfn)

arch/um/include/shared/mem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
extern int phys_mapping(unsigned long phys, unsigned long long *offset_out);
1010

1111
extern unsigned long uml_physmem;
12-
static inline unsigned long to_phys(void *virt)
12+
static inline unsigned long uml_to_phys(void *virt)
1313
{
1414
return(((unsigned long) virt) - uml_physmem);
1515
}
1616

17-
static inline void *to_virt(unsigned long phys)
17+
static inline void *uml_to_virt(unsigned long phys)
1818
{
1919
return((void *) uml_physmem + phys);
2020
}

arch/um/os-Linux/skas/process.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static int userspace_tramp(void *stack)
252252
signal(SIGTERM, SIG_DFL);
253253
signal(SIGWINCH, SIG_IGN);
254254

255-
fd = phys_mapping(to_phys(__syscall_stub_start), &offset);
255+
fd = phys_mapping(uml_to_phys(__syscall_stub_start), &offset);
256256
addr = mmap64((void *) STUB_CODE, UM_KERN_PAGE_SIZE,
257257
PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset);
258258
if (addr == MAP_FAILED) {
@@ -262,7 +262,7 @@ static int userspace_tramp(void *stack)
262262
}
263263

264264
if (stack != NULL) {
265-
fd = phys_mapping(to_phys(stack), &offset);
265+
fd = phys_mapping(uml_to_phys(stack), &offset);
266266
addr = mmap((void *) STUB_DATA,
267267
UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE,
268268
MAP_FIXED | MAP_SHARED, fd, offset);
@@ -535,7 +535,7 @@ int copy_context_skas0(unsigned long new_stack, int pid)
535535
struct stub_data *data = (struct stub_data *) current_stack;
536536
struct stub_data *child_data = (struct stub_data *) new_stack;
537537
unsigned long long new_offset;
538-
int new_fd = phys_mapping(to_phys((void *)new_stack), &new_offset);
538+
int new_fd = phys_mapping(uml_to_phys((void *)new_stack), &new_offset);
539539

540540
/*
541541
* prepare offset and fd of child's stack as argument for parent's

0 commit comments

Comments
 (0)