[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH] Fix warnings in e1000, pcnet, sis900



Hi,

This patch merely fixes warnings in the e1000, pcnet, and sis900 drivers.

Cheers,
Matt

Signed-off-by: Matthew Iselin <matthew@xxxxxxxxxxxxxx>
---
 e1000/device.c   |    7 ++++---
 e1000/e1000_io.h |    4 ++--
 pcnet/pcnet.c    |    9 +++++----
 sis900/device.c  |    1 +
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/e1000/device.c b/e1000/device.c
index dd37510..e0f3768 100644
--- a/e1000/device.c
+++ b/e1000/device.c
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <string.h>
+#include <stdlib.h>
 
 #include "cdi.h"
 #include "cdi/misc.h"
@@ -209,7 +210,7 @@ void e1000_send_packet(struct cdi_net_device* device, void* data, size_t size)
 
     // Head auslesen
     head = reg_inl(netcard, REG_TXDESC_HEAD);
-    if (netcard->tx_cur_buffer == head) {
+    if (netcard->tx_cur_buffer == (int) head) {
         printf("e1000: Kein Platz in der Sendewarteschlange!\n");
         return;
     }
@@ -246,7 +247,7 @@ static void e1000_handle_interrupt(struct cdi_device* device)
 
         uint32_t head = reg_inl(netcard, REG_RXDESC_HEAD);
 
-        while (netcard->rx_cur_buffer != head) {
+        while (netcard->rx_cur_buffer != (int) head) {
 
             size_t size = netcard->rx_desc[netcard->rx_cur_buffer].length;
             uint8_t status = netcard->rx_desc[netcard->rx_cur_buffer].status;
@@ -284,7 +285,7 @@ static void e1000_handle_interrupt(struct cdi_device* device)
             netcard->rx_cur_buffer %= RX_BUFFER_NUM;
         }
 
-        if (netcard->rx_cur_buffer == head) {
+        if (netcard->rx_cur_buffer == (int) head) {
             reg_outl(netcard, REG_RXDESC_TAIL,
                 (head + RX_BUFFER_NUM - 1) % RX_BUFFER_NUM);
         } else {
diff --git a/e1000/e1000_io.h b/e1000/e1000_io.h
index 2ae9fdc..68937a9 100644
--- a/e1000/e1000_io.h
+++ b/e1000/e1000_io.h
@@ -51,7 +51,7 @@ static inline void reg_outw
 static inline void reg_outl
     (struct e1000_device* netcard, uint16_t reg, uint32_t value)
 {
-    volatile uint32_t* mmio = netcard->mem_base + reg;
+    volatile uint32_t* mmio = (uint32_t*) (((char*)netcard->mem_base) + reg);
     *mmio = value;
 }
 
@@ -70,7 +70,7 @@ static inline uint16_t reg_inw(struct e1000_device* netcard, uint16_t reg)
 
 static inline uint32_t reg_inl(struct e1000_device* netcard, uint16_t reg)
 {
-    volatile uint32_t* mmio = netcard->mem_base + reg;
+    volatile uint32_t* mmio = (uint32_t*) (((char*)netcard->mem_base) + reg);
     return *mmio;
 }
 
diff --git a/pcnet/pcnet.c b/pcnet/pcnet.c
index 27d364c..dc671e7 100644
--- a/pcnet/pcnet.c
+++ b/pcnet/pcnet.c
@@ -31,6 +31,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 
 static void pcnet_handle_interrupt(struct cdi_device* device);
 static void pcnet_reset(struct pcnet_device *netcard);
@@ -238,9 +239,9 @@ void pcnet_dev_init(struct pcnet_device *netcard, int promiscuous)
         printf("pcnet: descriptor region at 0x%p virtual and 0x%p physical\n", virt_desc_region, phys_desc_region);
     #endif
     netcard->receive_descriptor = virt_desc_region;
-    netcard->transmit_descriptor = virt_desc_region + 2 * 1024;
+    netcard->transmit_descriptor = (struct transmit_descriptor*) (((char*)virt_desc_region) + 2 * 1024);
     netcard->phys_receive_descriptor = phys_desc_region;
-    netcard->phys_transmit_descriptor = phys_desc_region + 2 * 1024;
+    netcard->phys_transmit_descriptor = (void*) (((char*)phys_desc_region) + 2 * 1024);
 
     // Fill the initialization block
     // NOTE: Transmit and receive buffer contain 8 entries
@@ -274,7 +275,7 @@ void pcnet_dev_init(struct pcnet_device *netcard, int promiscuous)
             return;
         }
         netcard->receive_buffer[2 * i] = virt_buffer;
-        netcard->receive_buffer[2 * i + 1] = virt_buffer + 2048;
+        netcard->receive_buffer[2 * i + 1] = ((char*)virt_buffer) + 2048;
         netcard->receive_descriptor[2 * i].address = (uint32_t) phys_buffer;
         netcard->receive_descriptor[2 * i].flags = DESCRIPTOR_OWN | 0xF7FF;
         netcard->receive_descriptor[2 * i].flags2 = 0;
@@ -290,7 +291,7 @@ void pcnet_dev_init(struct pcnet_device *netcard, int promiscuous)
             return;
         }
         netcard->transmit_buffer[2 * i] = virt_buffer;
-        netcard->transmit_buffer[2 * i + 1] = virt_buffer + 2048;
+        netcard->transmit_buffer[2 * i + 1] = ((char*)virt_buffer) + 2048;
         netcard->transmit_descriptor[2 * i].address = (uint32_t) phys_buffer;
         netcard->transmit_descriptor[2 * i + 1].address = (uint32_t) phys_buffer + 2048;
     }
diff --git a/sis900/device.c b/sis900/device.c
index ab0479a..0c95055 100644
--- a/sis900/device.c
+++ b/sis900/device.c
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <string.h>
+#include <stdlib.h>
 
 #include "cdi.h"
 #include "cdi/misc.h"
-- 
1.6.4.msysgit.0