Skip to content

Commit

Permalink
phys_to_pfn_t: use phys_addr_t
Browse files Browse the repository at this point in the history
A dma_addr_t is potentially smaller than a phys_addr_t on some archs.
Don't truncate the address when doing the pfn conversion.

Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Reported-by: Matthew Wilcox <willy@linux.intel.com>
[willy: fix pfn_t_to_phys as well]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
Dan Williams committed Jan 31, 2016
1 parent 03fc2da commit 76e9f0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/linux/pfn_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static inline pfn_t pfn_to_pfn_t(unsigned long pfn)
return __pfn_to_pfn_t(pfn, 0);
}

extern pfn_t phys_to_pfn_t(dma_addr_t addr, unsigned long flags);
extern pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags);

static inline bool pfn_t_has_page(pfn_t pfn)
{
Expand All @@ -48,7 +48,7 @@ static inline struct page *pfn_t_to_page(pfn_t pfn)
return NULL;
}

static inline dma_addr_t pfn_t_to_phys(pfn_t pfn)
static inline phys_addr_t pfn_t_to_phys(pfn_t pfn)
{
return PFN_PHYS(pfn_t_to_pfn(pfn));
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/memremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void devm_memunmap(struct device *dev, void *addr)
}
EXPORT_SYMBOL(devm_memunmap);

pfn_t phys_to_pfn_t(dma_addr_t addr, unsigned long flags)
pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags)
{
return __pfn_to_pfn_t(addr >> PAGE_SHIFT, flags);
}
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/nvdimm/test/iomap.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void *__wrap_devm_memremap_pages(struct device *dev, struct resource *res,
}
EXPORT_SYMBOL(__wrap_devm_memremap_pages);

pfn_t __wrap_phys_to_pfn_t(dma_addr_t addr, unsigned long flags)
pfn_t __wrap_phys_to_pfn_t(phys_addr_t addr, unsigned long flags)
{
struct nfit_test_resource *nfit_res = get_nfit_res(addr);

Expand Down

0 comments on commit 76e9f0e

Please sign in to comment.