UPSTREAM: mmc: dw_mmc: use resource_size_t to store physical address
authorArnd Bergmann <arnd@arndb.de>
Thu, 12 Nov 2015 14:14:23 +0000 (15:14 +0100)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 4 Jul 2016 04:01:36 +0000 (12:01 +0800)
commit7b5585cd22de53d5961c2baaf05634d923a21795
tree0cda5726b4879968920c805680342b744a742854
parent1ce7fa58a32252399050bcc2643ef08f45d03dbc
UPSTREAM: mmc: dw_mmc: use resource_size_t to store physical address

The dw_mmc driver stores the physical address of the MMIO registers
in a pointer, which requires the use of type casts, and is actually
broken if anyone ever has this device on a 32-bit SoC in registers
above 4GB. Gcc warns about this possibility when the driver is built
with ARM LPAE enabled:

mmc/host/dw_mmc.c: In function 'dw_mci_edmac_start_dma':
mmc/host/dw_mmc.c:702:17: warning: cast from pointer to integer of different size
  cfg.dst_addr = (dma_addr_t)(host->phy_regs + fifo_offset);
                 ^
mmc/host/dw_mmc-pltfm.c: In function 'dw_mci_pltfm_register':
mmc/host/dw_mmc-pltfm.c:63:19: warning: cast to pointer from integer of different size
  host->phy_regs = (void *)(regs->start);

This changes the code to use resource_size_t, which gets rid of the
warning, the bug and the useless casts.

Change-Id: I894c49cede8f0626efb80a9a3181a5385bbb2bcd
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
(cherry picked from commit 260b31643691e8a58683a4ccc3bdf7abfd86f54a)
drivers/mmc/host/dw_mmc-pltfm.c
drivers/mmc/host/dw_mmc.c
include/linux/mmc/dw_mmc.h