Skip to contentSkip to conversation

openrisc: Fix a few type cast related warnings

PATCH In review Vasili Galka 2 participants 2 messages Aug 26, 2014 – Sep 17, 2014 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openrisc: Fix a few type cast related warnings

Use size_t type for positive offsets instead of the loff_t type. The later is defined as long long, which is larger than the pointer type on OpenRISC architecture and therefore the following warning was generated:

"warning: cast to pointer from integer of different size"

---
 drivers/net/ethoc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethoc.c +4 -4
index af06d4f..46c82bb 100644
@@ -189,12 +189,12 @@ struct ethoc_bd {
 	u32 addr;
 };
 
-static inline u32 ethoc_read(struct eth_device *dev, loff_t offset)
+static inline u32 ethoc_read(struct eth_device *dev, size_t offset)
 {
 	return readl(dev->iobase + offset);
 }
 
-static inline void ethoc_write(struct eth_device *dev, loff_t offset, u32 data)
+static inline void ethoc_write(struct eth_device *dev, size_t offset, u32 data)
 {
 	writel(data, dev->iobase + offset);
 }
@@ -202,7 +202,7 @@ static inline void ethoc_write(struct eth_device *dev, loff_t offset, u32 data)
 static inline void ethoc_read_bd(struct eth_device *dev, int index,
 				 struct ethoc_bd *bd)
 {
-	loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd));
+	size_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd));
 	bd->stat = ethoc_read(dev, offset + 0);
 	bd->addr = ethoc_read(dev, offset + 4);
 }
@@ -210,7 +210,7 @@ static inline void ethoc_read_bd(struct eth_device *dev, int index,
 static inline void ethoc_write_bd(struct eth_device *dev, int index,
 				  const struct ethoc_bd *bd)
 {
-	loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd));
+	size_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd));
 	ethoc_write(dev, offset + 0, bd->stat);
 	ethoc_write(dev, offset + 4, bd->addr);
 }
Signature · 1 line
1.7.9
#1 lore raw
Quoted 8 lines · Vasili Galka

Use size_t type for positive offsets instead of the loff_t type. The later is defined as long long, which is larger than the pointer type on OpenRISC architecture and therefore the following warning was generated:

"warning: cast to pointer from integer of different size"

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140916/8b49ec5a/attachment.pgp>