Skip to contentSkip to conversation

drivers: mmc: omap_hsmmc: Fix conversion of address to a pointer

PATCH In review Mugunthan V N 2 participants 3 messages Apr 4, 2016 – Apr 21, 2016 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: mmc: omap_hsmmc: Fix conversion of address to a pointer

omap_hsmmc driver directly typecasts fdt_addr_t to a pointer. This is not strictly correct, as it gives a build warning when fdt_addr_t is u64. So, use map_physmem for a proper typecasts.

This is inspired by commit 167efe01bc5a9 ("dm: ns16550: Use an address instead of a pointer for the uart base")

drivers/mmc/omap_hsmmc.c: In function ?omap_hsmmc_ofdata_to_platdata?:
drivers/mmc/omap_hsmmc.c:776:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

  priv->base_addr = (struct hsmmc *)dev_get_addr(dev);
                      ^
---
 drivers/mmc/omap_hsmmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/omap_hsmmc.c +2 -1
index d191736..85a832b 100644
@@ -773,7 +773,8 @@ static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)
 	struct mmc_config *cfg;
 	int val;
 
-	priv->base_addr = (struct hsmmc *)dev_get_addr(dev);
+	priv->base_addr = map_physmem(dev_get_addr(dev), sizeof(struct hsmmc *),
+				      MAP_NOCACHE);
 	cfg = &priv->cfg;
 
 	cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
Signature · 1 line
2.8.0.rc3.9.g44915db
#1 lore raw

PATCH 1/1 drivers: mmc: omap_hsmmc: Fix conversion of address to a pointer

Quoted 7 lines · Mugunthan V N

omap_hsmmc driver directly typecasts fdt_addr_t to a pointer. This is not strictly correct, as it gives a build warning when fdt_addr_t is u64. So, use map_physmem for a proper typecasts.

This is inspired by commit 167efe01bc5a9 ("dm: ns16550: Use an address instead of a pointer for the uart base")

Quoted 6 lines

drivers/mmc/omap_hsmmc.c: In function ?omap_hsmmc_ofdata_to_platdata?:
drivers/mmc/omap_hsmmc.c:776:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

  priv->base_addr = (struct hsmmc *)dev_get_addr(dev);
                      ^
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160408/e162815d/attachment.sig>
#2 lore raw
In reply to Mugunthan V N
Quoted 7 lines · Mugunthan V N

omap_hsmmc driver directly typecasts fdt_addr_t to a pointer. This is not strictly correct, as it gives a build warning when fdt_addr_t is u64. So, use map_physmem for a proper typecasts.

This is inspired by commit 167efe01bc5a9 ("dm: ns16550: Use an address instead of a pointer for the uart base")

Quoted 7 lines

drivers/mmc/omap_hsmmc.c: In function ?omap_hsmmc_ofdata_to_platdata?:
drivers/mmc/omap_hsmmc.c:776:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

  priv->base_addr = (struct hsmmc *)dev_get_addr(dev);
                      ^

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160421/e8bc9f40/attachment.sig>