Skip to contentSkip to conversation

arm: virt_to_phys should take a volatile ptr

PATCH Applied Lucas Stach 2 participants 3 messages Feb 24, 2015 – Feb 25, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 arm: virt_to_phys should take a volatile ptr

So users can pass in device memory pointers without provoking warnings.

---
 arch/arm/cpu/mmu.c         | 2 +-
 arch/arm/include/asm/mmu.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/cpu/mmu.c +1 -1
index e733ec4..aaf66d4 100644
@@ -393,7 +393,7 @@ void *dma_alloc_coherent(size_t size)
 	return ret;
 }
 
-unsigned long virt_to_phys(void *virt)
+unsigned long virt_to_phys(volatile void *virt)
 {
 	return (unsigned long)virt;
 }
arch/arm/include/asm/mmu.h +2 -2
index 4234979..c6e425f 100644
@@ -39,7 +39,7 @@ void dma_free_coherent(void *mem, size_t size);
 void dma_clean_range(unsigned long, unsigned long);
 void dma_flush_range(unsigned long, unsigned long);
 void dma_inv_range(unsigned long, unsigned long);
-unsigned long virt_to_phys(void *virt);
+unsigned long virt_to_phys(volatile void *virt);
 void *phys_to_virt(unsigned long phys);
 void remap_range(void *_start, size_t size, uint32_t flags);
 void *map_io_sections(unsigned long physaddr, void *start, size_t size);
@@ -62,7 +62,7 @@ static inline void *phys_to_virt(unsigned long phys)
 	return (void *)phys;
 }
 
-static inline unsigned long virt_to_phys(void *mem)
+static inline unsigned long virt_to_phys(volatile void *mem)
 {
 	return (unsigned long)mem;
 }
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 2/2 net: rtl8169: silence compiler warning

Silence warning about cast from volatile to normal pointer, as this is the intended bhavior here.

---
 drivers/net/rtl8169.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/rtl8169.c +2 -2
index 19f5763..f8a6500 100644
@@ -236,8 +236,8 @@ static void rtl8169_init_ring(struct rtl8169_priv *priv)
 	dma_clean_range((unsigned long)priv->rx_buf,
 			(unsigned long)priv->rx_buf + NUM_RX_DESC * PKT_BUF_SIZE);
 
-	memset(priv->tx_desc, 0, NUM_TX_DESC * sizeof(struct bufdesc));
-	memset(priv->rx_desc, 0, NUM_RX_DESC * sizeof(struct bufdesc));
+	memset((void *)priv->tx_desc, 0, NUM_TX_DESC * sizeof(struct bufdesc));
+	memset((void *)priv->rx_desc, 0, NUM_RX_DESC * sizeof(struct bufdesc));
 
 	for (i = 0; i < NUM_RX_DESC; i++) {
 		if (i == (NUM_RX_DESC - 1))
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#2 lore raw
In reply to Lucas Stach
Quoted 8 lines · Lucas Stach

So users can pass in device memory pointers without provoking warnings.

---
 arch/arm/cpu/mmu.c         | 2 +-
 arch/arm/include/asm/mmu.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox