This patch fixes 64-bit bugs in c7000.c so the driver will work for both 31-bit and 64-bit kernels. This is the third of three patches. Marcelo, please apply this patch.
diff -urN NEWERlinux-2.4.26/drivers/s390/net/c7000.c NEWESTlinux-2.4.26/drivers/s390/net/c7000.c --- NEWERlinux-2.4.26/drivers/s390/net/c7000.c 2004-08-03 14:43:54.000000000 -0700 +++ NEWESTlinux-2.4.26/drivers/s390/net/c7000.c 2004-08-03 14:30:20.000000000 -0700 @@ -527,7 +527,7 @@ ccw1_t ccws[5]; /* control ccws */ int devno; /* device number */ int irq; /* subchannel number */ - int IO_active; /* IO activity flag */ + unsigned long IO_active; /* IO activity flag */ int state; /* fsm state */ int retries; /* retry counter */ unsigned long flag_a; /* bh activity flag */ @@ -562,7 +562,7 @@ unsigned char version; /* version = 2 */ unsigned char linkid; /* link id */ struct c7000_unit cunits[NUNITS]; /* embedded units */ - int tbusy; + unsigned long tbusy; }; /* @@ -714,9 +714,9 @@ static int c7000_haltio(struct c7000_unit *cup) { - __u32 parm; + unsigned long parm; __u8 flags = 0x00; - __u32 saveflags; + unsigned long saveflags; DECLARE_WAITQUEUE(wait, current); int rc; @@ -747,9 +747,9 @@ static int c7000_doio(struct c7000_unit *cup) { - __u32 parm; + unsigned long parm; __u8 flags = 0x00; - __u32 saveflags; + unsigned long saveflags; DECLARE_WAITQUEUE(wait, current); int rc; @@ -985,9 +985,10 @@ bufptr = kmalloc(sizeof(struct c7000_buffer), GFP_KERNEL); data = kmalloc(C7000_BUFSIZE, GFP_KERNEL); - if (bufptr == NULL) - { - if(data) + if (bufptr == NULL || data == NULL) { + if (bufptr) + kfree(bufptr); + if (data) kfree(data); return(-1); } @@ -1286,9 +1287,9 @@ struct net_device *dev; int rc; __u16 data_length; - __u32 parm; + unsigned long parm; __u8 flags = 0x00; - __u32 saveflags; + unsigned long saveflags; ccp = cup->cntlp; dev = ccp->dev; @@ -1340,6 +1341,7 @@ skb->ip_summed = CHECKSUM_UNNECESSARY; netif_rx(skb); ccp->stats.rx_packets++; + ccp->stats.rx_bytes += skb->len; } else { CPrintk(0, "c7000: c7000_irq_bh: can not allocate a skb for unit 0x%x\n", cup->devno); ccp->stats.rx_dropped++; @@ -1378,7 +1380,7 @@ return; } - parm = (__u32)cup; + parm = (unsigned long)cup; cup->state = C7000_READ; if ((rc = do_IO(cup->irq, &cup->proc_head->ccws[0], parm, 0xff, flags)) != 0) { @@ -1953,7 +1955,7 @@ struct c7000_controller *ccp = (struct c7000_controller *)dev->priv; struct c7000_unit *cup; int rc; - __u32 parm; + unsigned long parm; __u8 flags = 0x00; c7000_set_busy(dev); @@ -2105,7 +2107,7 @@ */ cup->state = C7000_READ; - parm = (__u32) cup; + parm = (unsigned long)cup; set_bit(0, (void *)&cup->IO_active); if ((rc = do_IO(cup->irq, &cup->proc_head->ccws[0], parm, 0xff, flags)) != 0) { @@ -2193,8 +2195,8 @@ { struct c7000_controller *ccp = (struct c7000_controller *)dev->priv; struct c7000_unit *cup; - __u32 saveflags; - __u32 parm; + unsigned long saveflags; + unsigned long parm; __u8 flags = 0x00; struct c7000_buffer *buf, *pbuf; int rc; @@ -2292,7 +2294,7 @@ if (test_and_set_bit(0, (void *)&cup->IO_active) == 0) { CPrintk(1, "c7000: c7000_xmit: start IO for unit 0x%x\n", cup->devno); c7000_bld_wrt_chain(cup); - parm = (__u32) cup; + parm = (unsigned long)cup; cup->state = C7000_WRITE; if ((rc = do_IO(cup->irq, &cup->proc_head->ccws[0], parm, 0xff, flags)) != 0) { @@ -2403,7 +2405,7 @@ c7000_retry_io(struct c7000_unit *cup) { int rc; - __u32 parm; + unsigned long parm; __u8 flags = 0x00; ccw1_t *ccwp; @@ -2414,7 +2416,7 @@ } set_bit(0, (void *)&cup->IO_active); - parm = (__u32)cup; + parm = (unsigned long)cup; if (cup->state == C7000_READ || cup->state == C7000_WRITE) ccwp = &cup->proc_head->ccws[0]; @@ -2502,14 +2504,10 @@ */ buf = c7000_dequeue_buffer(cup); + ccp->stats.tx_bytes += buf->len; + ccp->stats.tx_packets++; c7000_release_buffer(cup, buf); num_write++; - - /* - Update transmitted packets statistic. - */ - - ccp->stats.tx_packets++; } CPrintk(1, "c7000: c7000_proc_wintr: %d buffers written for unit 0x%x\n", num_write, cup->devno); @@ -2527,7 +2525,7 @@ struct c7000_unit *cup = NULL; struct c7000_controller *ccp = NULL; struct net_device *dev = NULL; - __u32 parm; + unsigned long parm; __u8 flags = 0x00; int rc; @@ -2560,14 +2558,14 @@ ccp = cup->cntlp; if (ccp == NULL) { - CPrintk(0, "c7000: c7000_intr: c7000_cntlp pointer is NULL in c7000_unit structure 0x%x for unit 0x%x\n", (int)cup, cup->devno); + CPrintk(0, "c7000: c7000_intr: c7000_cntlp pointer is NULL in c7000_unit structure %p for unit 0x%x\n", cup, cup->devno); return; } dev = ccp->dev; if (dev == NULL) { - CPrintk(0, "c7000: c7000_intr: device pointer is NULL in c7000_controller structure 0x%x for unit 0x%x\n", (int)ccp, cup->devno); + CPrintk(0, "c7000: c7000_intr: device pointer is NULL in c7000_controller structure %p for unit 0x%x\n", ccp, cup->devno); return; } @@ -2719,7 +2717,7 @@ if ((devstat->flag & DEVSTAT_FINAL_STATUS) && (cup->free != NULL)) { c7000_bld_read_chain(cup); - parm = (__u32)cup; + parm = (unsigned long)cup; set_bit(0, (void *)&cup->IO_active); if ((rc = do_IO(cup->irq, &cup->proc_head->ccws[0], parm, 0xff, flags)) != 0) { @@ -2776,7 +2774,7 @@ if (cup->proc_head != NULL) { c7000_bld_wrt_chain(cup); - parm = (__u32)cup; + parm = (unsigned long)cup; set_bit(0, (void *)&cup->IO_active); if ((rc = do_IO(cup->irq, &cup->proc_head->ccws[0], parm, 0xff, flags)) != 0) { @@ -2912,7 +2910,7 @@ dev->addr_len = 0; dev->type = ARPHRD_SLIP; dev->tx_queue_len = C7000_TXQUEUE_LEN; - dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; + dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; dev->open = c7000_open; dev->stop = c7000_stop; dev->set_config = c7000_config; @@ -2929,7 +2927,7 @@ return(-ENOMEM); } - CPrintk(1, "c7000: c7000_init: allocated a c7000_controller structure at address 0x%x\n", (int)ccp); + CPrintk(1, "c7000: c7000_init: allocated a c7000_controller structure at address %p\n", ccp); memset(ccp, '\0', sizeof(struct c7000_controller)); ccp->dev = dev; ccp->base_addr = dev->base_addr; @@ -3216,7 +3214,7 @@ free_irq(ccp->cunits[j].irq, &ccp->cunits[j].devstat); } - CPrintk(1, "c7000: clean_module: free a c7000_controller structure at address 0x%x\n", (int)ccp); + CPrintk(1, "c7000: clean_module: free a c7000_controller structure at address %p\n", ccp); kfree(ccp); } ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390