linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: cafe: clean up DMA address setup
@ 2017-12-05  8:49 Masahiro Yamada
  2017-12-07 20:17 ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2017-12-05  8:49 UTC (permalink / raw)
  To: linux-mtd, Boris Brezillon
  Cc: Masahiro Yamada, Cyrille Pitchen, linux-kernel, Marek Vasut,
	Brian Norris, Richard Weinberger, David Woodhouse

Use macros from <linux/kernel.h> to make the code readable.
The compiler warning will be kept suppressed.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/mtd/nand/cafe_nand.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index add4613..2af5e35 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -737,12 +737,8 @@ static int cafe_nand_probe(struct pci_dev *pdev,
 	}
 
 	/* Set up DMA address */
-	cafe_writel(cafe, cafe->dmaaddr & 0xffffffff, NAND_DMA_ADDR0);
-	if (sizeof(cafe->dmaaddr) > 4)
-		/* Shift in two parts to shut the compiler up */
-		cafe_writel(cafe, (cafe->dmaaddr >> 16) >> 16, NAND_DMA_ADDR1);
-	else
-		cafe_writel(cafe, 0, NAND_DMA_ADDR1);
+	cafe_writel(cafe, lower_32_bits(cafe->dmaaddr), NAND_DMA_ADDR0);
+	cafe_writel(cafe, upper_32_bits(cafe->dmaaddr), NAND_DMA_ADDR1);
 
 	cafe_dev_dbg(&cafe->pdev->dev, "Set DMA address to %x (virt %p)\n",
 		cafe_readl(cafe, NAND_DMA_ADDR0), cafe->dmabuf);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: nand: cafe: clean up DMA address setup
  2017-12-05  8:49 [PATCH] mtd: nand: cafe: clean up DMA address setup Masahiro Yamada
@ 2017-12-07 20:17 ` Boris Brezillon
  0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2017-12-07 20:17 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-mtd, Cyrille Pitchen, linux-kernel, Marek Vasut,
	Brian Norris, Richard Weinberger, David Woodhouse

On Tue,  5 Dec 2017 17:49:56 +0900
Masahiro Yamada <yamada.masahiro@socionext.com> wrote:

> Use macros from <linux/kernel.h> to make the code readable.
> The compiler warning will be kept suppressed.

Applied.

Thanks,

Boris

> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  drivers/mtd/nand/cafe_nand.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
> index add4613..2af5e35 100644
> --- a/drivers/mtd/nand/cafe_nand.c
> +++ b/drivers/mtd/nand/cafe_nand.c
> @@ -737,12 +737,8 @@ static int cafe_nand_probe(struct pci_dev *pdev,
>  	}
>  
>  	/* Set up DMA address */
> -	cafe_writel(cafe, cafe->dmaaddr & 0xffffffff, NAND_DMA_ADDR0);
> -	if (sizeof(cafe->dmaaddr) > 4)
> -		/* Shift in two parts to shut the compiler up */
> -		cafe_writel(cafe, (cafe->dmaaddr >> 16) >> 16, NAND_DMA_ADDR1);
> -	else
> -		cafe_writel(cafe, 0, NAND_DMA_ADDR1);
> +	cafe_writel(cafe, lower_32_bits(cafe->dmaaddr), NAND_DMA_ADDR0);
> +	cafe_writel(cafe, upper_32_bits(cafe->dmaaddr), NAND_DMA_ADDR1);
>  
>  	cafe_dev_dbg(&cafe->pdev->dev, "Set DMA address to %x (virt %p)\n",
>  		cafe_readl(cafe, NAND_DMA_ADDR0), cafe->dmabuf);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-07 20:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05  8:49 [PATCH] mtd: nand: cafe: clean up DMA address setup Masahiro Yamada
2017-12-07 20:17 ` Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).