mtd: rawnand: davinci: Stop doing iomem pointer <-> u32 conversions
authorBoris Brezillon <boris.brezillon@bootlin.com>
Mon, 9 Jul 2018 20:09:28 +0000 (22:09 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 18 Jul 2018 08:10:17 +0000 (10:10 +0200)
There is no point in doing this sort of conversion since we can
replace |= by += operations which are perfectly valid on pointers.

This is done in preparation of COMPILE_TEST addition to the NAND_DAVINCI
Kconfig entry, since building for x86 generates several warnings because
of inappropriate u32 <-> void * conversions (pointers are 64-bit large
on x86_64).

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/davinci_nand.c

index cd12e5abafdefb7641d8b7f2238f2e4f41d92308..9cd36a750965add7c7787f54abb2963798b26a9a 100644 (file)
@@ -60,8 +60,7 @@ struct davinci_nand_info {
        void __iomem            *base;
        void __iomem            *vaddr;
 
-       uint32_t                ioaddr;
-       uint32_t                current_cs;
+       void __iomem            *current_cs;
 
        uint32_t                mask_chipsel;
        uint32_t                mask_ale;
@@ -102,17 +101,17 @@ static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd,
                                   unsigned int ctrl)
 {
        struct davinci_nand_info        *info = to_davinci_nand(mtd);
-       uint32_t                        addr = info->current_cs;
+       void __iomem                    *addr = info->current_cs;
        struct nand_chip                *nand = mtd_to_nand(mtd);
 
        /* Did the control lines change? */
        if (ctrl & NAND_CTRL_CHANGE) {
                if ((ctrl & NAND_CTRL_CLE) == NAND_CTRL_CLE)
-                       addr |= info->mask_cle;
+                       addr += info->mask_cle;
                else if ((ctrl & NAND_CTRL_ALE) == NAND_CTRL_ALE)
-                       addr |= info->mask_ale;
+                       addr += info->mask_ale;
 
-               nand->IO_ADDR_W = (void __iomem __force *)addr;
+               nand->IO_ADDR_W = addr;
        }
 
        if (cmd != NAND_CMD_NONE)
@@ -122,14 +121,14 @@ static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd,
 static void nand_davinci_select_chip(struct mtd_info *mtd, int chip)
 {
        struct davinci_nand_info        *info = to_davinci_nand(mtd);
-       uint32_t                        addr = info->ioaddr;
+
+       info->current_cs = info->vaddr;
 
        /* maybe kick in a second chipselect */
        if (chip > 0)
-               addr |= info->mask_chipsel;
-       info->current_cs = addr;
+               info->current_cs += info->mask_chipsel;
 
-       info->chip.IO_ADDR_W = (void __iomem __force *)addr;
+       info->chip.IO_ADDR_W = info->current_cs;
        info->chip.IO_ADDR_R = info->chip.IO_ADDR_W;
 }
 
@@ -680,9 +679,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
        info->chip.bbt_md       = pdata->bbt_md;
        info->timing            = pdata->timing;
 
-       info->ioaddr            = (uint32_t __force) vaddr;
-
-       info->current_cs        = info->ioaddr;
+       info->current_cs        = info->vaddr;
        info->core_chipsel      = pdata->core_chipsel;
        info->mask_chipsel      = pdata->mask_chipsel;