[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cdi-devel] [PATCH v2] Fix warnings in e1000, sis900, pcnet
Hi,
This is version 2 of the warning fix patch, which implements a better solution
for the e1000 driver's signed/unsigned comparison warning.
Cheers,
Matt
Signed-off-by: Matthew Iselin <matthew@xxxxxxxxxxxxxx>
---
e1000/device.c | 1 +
e1000/device.h | 2 +-
e1000/e1000_io.h | 4 ++--
pcnet/pcnet.c | 9 +++++----
sis900/device.c | 1 +
5 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/e1000/device.c b/e1000/device.c
index dd37510..4e5a62e 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"
diff --git a/e1000/device.h b/e1000/device.h
index 0327132..899a06d 100644
--- a/e1000/device.h
+++ b/e1000/device.h
@@ -153,7 +153,7 @@ struct e1000_device {
struct e1000_rx_descriptor rx_desc[RX_BUFFER_NUM];
uint8_t rx_buffer[RX_BUFFER_NUM * RX_BUFFER_SIZE];
- int rx_cur_buffer;
+ uint32_t rx_cur_buffer;
void* mem_base;
uint8_t revision;
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