[POC][PATCH 71/83] s390_dma_alloc(): use page_address()

From: Al Viro
Date: Mon Dec 21 2015 - 18:52:48 EST


From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

... rather than open-coding it as (void *)page_to_phys() - those expand
to the same thing on s390 (no highmem and __va is an identity mapping),
but it's more readable (and less confusing) that way.

Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
---
arch/s390/pci/pci_dma.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index afa4be1..6ea4d13 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -355,7 +355,7 @@ static void *s390_dma_alloc(struct device *dev, size_t size,
{
struct zpci_dev *zdev = to_zpci(to_pci_dev(dev));
struct page *page;
- unsigned long pa;
+ void *p;
dma_addr_t map;

size = PAGE_ALIGN(size);
@@ -363,20 +363,20 @@ static void *s390_dma_alloc(struct device *dev, size_t size,
if (!page)
return NULL;

- pa = page_to_phys(page);
- memset((void *) pa, 0, size);
+ p = page_address(page);
+ memset(p, 0, size);

map = s390_dma_map_pages(dev, page, 0,
size, DMA_BIDIRECTIONAL, NULL);
if (dma_mapping_error(dev, map)) {
- free_pages((void *)pa, get_order(size));
+ free_pages(p, get_order(size));
return NULL;
}

atomic64_add(size / PAGE_SIZE, &zdev->allocated_pages);
if (dma_handle)
*dma_handle = map;
- return (void *) pa;
+ return p;
}

static void s390_dma_free(struct device *dev, size_t size,
--
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/