Re: sis190 driver

From: Alexey Dobriyan
Date: Fri Jul 22 2005 - 00:06:02 EST


On Fri, Jul 22, 2005 at 01:09:50AM +0200, Francois Romieu wrote:
> No major change from previous version. I'm quietly merging bits from
> the SiS driver that Lars kindly pointed out. The detection of the
> mac address is done differently.
>
> I'll welcome feedback related to regressions and/or netconsole testing.
>
> Single file patch:
> http://www.zoreil.com/~romieu/sis190/20050722-2.6.13-rc2-sis190-test.patch

MAINTAINERS chunk isn't -p1 applicable. ;-)

sparse asks whether you have endianness bugs here:
----------------------------------------------------------------------------
450 static inline void sis190_make_unusable_by_asic(struct RxDesc *desc)
451 {
452 desc->PSize = 0x0;
453 ===> desc->addr = 0xdeadbeef; <===
454 desc->size &= cpu_to_le32(RingEnd);
455 wmb();
456 desc->status = 0x0;
457 }

drivers/net/sis190.c:453:13: warning: incorrect type in assignment (different base types)
drivers/net/sis190.c:453:13: expected restricted unsigned int [assigned] [usertype] addr
drivers/net/sis190.c:453:13: got unsigned int
----------------------------------------------------------------------------
544 static int sis190_rx_interrupt(struct net_device *dev,
545 struct sis190_private *tp, void __iomem *ioaddr)
546 {

554 for (; rx_left > 0; rx_left--, cur_rx++) {
555 unsigned int entry = cur_rx % NUM_RX_DESC;
556 struct RxDesc *desc = tp->RxDescRing + entry;
557 u32 status;
558
559 ===> if (desc->status & OWNbit) <===
560 break;

drivers/net/sis190.c:559:20: warning: incompatible types for operation (&)
drivers/net/sis190.c:559:20: left side has type restricted unsigned int [assigned] [usertype] status
drivers/net/sis190.c:559:20: right side has type unsigned int [unsigned] enum _DescStatusBit [unsigned] [toplevel] OWNbit
----------------------------------------------------------------------------
Add endian annotations.

Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>

Index: linux-sis190/drivers/net/sis190.c
===================================================================
--- linux-sis190.orig/drivers/net/sis190.c 2005-07-22 07:56:37.000000000 +0400
+++ linux-sis190/drivers/net/sis190.c 2005-07-22 08:03:47.000000000 +0400
@@ -191,17 +191,17 @@ enum sis190_register_content {
};

struct TxDesc {
- u32 PSize;
- u32 status;
- u32 addr;
- u32 size;
+ __le32 PSize;
+ __le32 status;
+ __le32 addr;
+ __le32 size;
};

struct RxDesc {
- u32 PSize;
- u32 status;
- u32 addr;
- u32 size;
+ __le32 PSize;
+ __le32 status;
+ __le32 addr;
+ __le32 size;
};

enum _DescStatusBit {
@@ -1322,7 +1322,7 @@ static int __devinit sis190_get_mac_addr

/* Get MAC address from EEPROM */
for (i = 0; i < MAC_ADDR_LEN / 2; i++) {
- u16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i);
+ __le16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i);

((u16 *)dev->dev_addr)[0] = le16_to_cpu(w);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/