aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/3c505.c
diff options
context:
space:
mode:
authorRichard Knutsson <ricknu-0@student.ltu.se>2007-08-13 19:49:40 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:50:29 -0400
commitdf570f93337ddb46f1e30dd167c27b5fdcec637b (patch)
tree1ce5418234d463b81322464c8d0c47a0caf37178 /drivers/net/3c505.c
parent2d6d749d124d93bd03982467f515b1b88f4c1e44 (diff)
drivers/net/3c505: Convert to generic boolean
Convert to generic boolean Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/3c505.c')
-rw-r--r--drivers/net/3c505.c67
1 files changed, 26 insertions, 41 deletions
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c
index e985a85a5623..acede307c05d 100644
--- a/drivers/net/3c505.c
+++ b/drivers/net/3c505.c
@@ -169,21 +169,6 @@ static int elp_debug;
169 169
170/***************************************************************** 170/*****************************************************************
171 * 171 *
172 * useful macros
173 *
174 *****************************************************************/
175
176#ifndef TRUE
177#define TRUE 1
178#endif
179
180#ifndef FALSE
181#define FALSE 0
182#endif
183
184
185/*****************************************************************
186 *
187 * List of I/O-addresses we try to auto-sense 172 * List of I/O-addresses we try to auto-sense
188 * Last element MUST BE 0! 173 * Last element MUST BE 0!
189 *****************************************************************/ 174 *****************************************************************/
@@ -270,7 +255,7 @@ static inline void set_hsf(struct net_device *dev, int hsf)
270 spin_unlock_irqrestore(&adapter->lock, flags); 255 spin_unlock_irqrestore(&adapter->lock, flags);
271} 256}
272 257
273static int start_receive(struct net_device *, pcb_struct *); 258static bool start_receive(struct net_device *, pcb_struct *);
274 259
275static inline void adapter_reset(struct net_device *dev) 260static inline void adapter_reset(struct net_device *dev)
276{ 261{
@@ -328,28 +313,28 @@ static inline void check_3c505_dma(struct net_device *dev)
328} 313}
329 314
330/* Primitive functions used by send_pcb() */ 315/* Primitive functions used by send_pcb() */
331static inline unsigned int send_pcb_slow(unsigned int base_addr, unsigned char byte) 316static inline bool send_pcb_slow(unsigned int base_addr, unsigned char byte)
332{ 317{
333 unsigned long timeout; 318 unsigned long timeout;
334 outb_command(byte, base_addr); 319 outb_command(byte, base_addr);
335 for (timeout = jiffies + 5*HZ/100; time_before(jiffies, timeout);) { 320 for (timeout = jiffies + 5*HZ/100; time_before(jiffies, timeout);) {
336 if (inb_status(base_addr) & HCRE) 321 if (inb_status(base_addr) & HCRE)
337 return FALSE; 322 return false;
338 } 323 }
339 printk(KERN_WARNING "3c505: send_pcb_slow timed out\n"); 324 printk(KERN_WARNING "3c505: send_pcb_slow timed out\n");
340 return TRUE; 325 return true;
341} 326}
342 327
343static inline unsigned int send_pcb_fast(unsigned int base_addr, unsigned char byte) 328static inline bool send_pcb_fast(unsigned int base_addr, unsigned char byte)
344{ 329{
345 unsigned int timeout; 330 unsigned int timeout;
346 outb_command(byte, base_addr); 331 outb_command(byte, base_addr);
347 for (timeout = 0; timeout < 40000; timeout++) { 332 for (timeout = 0; timeout < 40000; timeout++) {
348 if (inb_status(base_addr) & HCRE) 333 if (inb_status(base_addr) & HCRE)
349 return FALSE; 334 return false;
350 } 335 }
351 printk(KERN_WARNING "3c505: send_pcb_fast timed out\n"); 336 printk(KERN_WARNING "3c505: send_pcb_fast timed out\n");
352 return TRUE; 337 return true;
353} 338}
354 339
355/* Check to see if the receiver needs restarting, and kick it if so */ 340/* Check to see if the receiver needs restarting, and kick it if so */
@@ -386,7 +371,7 @@ static inline void prime_rx(struct net_device *dev)
386 * timeout is reduced to 500us). 371 * timeout is reduced to 500us).
387 */ 372 */
388 373
389static int send_pcb(struct net_device *dev, pcb_struct * pcb) 374static bool send_pcb(struct net_device *dev, pcb_struct * pcb)
390{ 375{
391 int i; 376 int i;
392 unsigned long timeout; 377 unsigned long timeout;
@@ -396,14 +381,14 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
396 check_3c505_dma(dev); 381 check_3c505_dma(dev);
397 382
398 if (adapter->dmaing && adapter->current_dma.direction == 0) 383 if (adapter->dmaing && adapter->current_dma.direction == 0)
399 return FALSE; 384 return false;
400 385
401 /* Avoid contention */ 386 /* Avoid contention */
402 if (test_and_set_bit(1, &adapter->send_pcb_semaphore)) { 387 if (test_and_set_bit(1, &adapter->send_pcb_semaphore)) {
403 if (elp_debug >= 3) { 388 if (elp_debug >= 3) {
404 printk(KERN_DEBUG "%s: send_pcb entered while threaded\n", dev->name); 389 printk(KERN_DEBUG "%s: send_pcb entered while threaded\n", dev->name);
405 } 390 }
406 return FALSE; 391 return false;
407 } 392 }
408 /* 393 /*
409 * load each byte into the command register and 394 * load each byte into the command register and
@@ -435,7 +420,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
435 switch (GET_ASF(dev->base_addr)) { 420 switch (GET_ASF(dev->base_addr)) {
436 case ASF_PCB_ACK: 421 case ASF_PCB_ACK:
437 adapter->send_pcb_semaphore = 0; 422 adapter->send_pcb_semaphore = 0;
438 return TRUE; 423 return true;
439 424
440 case ASF_PCB_NAK: 425 case ASF_PCB_NAK:
441#ifdef ELP_DEBUG 426#ifdef ELP_DEBUG
@@ -453,7 +438,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
453 spin_unlock_irqrestore(&adapter->lock, flags); 438 spin_unlock_irqrestore(&adapter->lock, flags);
454 abort: 439 abort:
455 adapter->send_pcb_semaphore = 0; 440 adapter->send_pcb_semaphore = 0;
456 return FALSE; 441 return false;
457} 442}
458 443
459 444
@@ -470,7 +455,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
470 * 455 *
471 *****************************************************************/ 456 *****************************************************************/
472 457
473static int receive_pcb(struct net_device *dev, pcb_struct * pcb) 458static bool receive_pcb(struct net_device *dev, pcb_struct * pcb)
474{ 459{
475 int i, j; 460 int i, j;
476 int total_length; 461 int total_length;
@@ -487,7 +472,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
487 while (((stat = get_status(dev->base_addr)) & ACRF) == 0 && time_before(jiffies, timeout)); 472 while (((stat = get_status(dev->base_addr)) & ACRF) == 0 && time_before(jiffies, timeout));
488 if (time_after_eq(jiffies, timeout)) { 473 if (time_after_eq(jiffies, timeout)) {
489 TIMEOUT_MSG(__LINE__); 474 TIMEOUT_MSG(__LINE__);
490 return FALSE; 475 return false;
491 } 476 }
492 pcb->command = inb_command(dev->base_addr); 477 pcb->command = inb_command(dev->base_addr);
493 478
@@ -497,14 +482,14 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
497 if (time_after_eq(jiffies, timeout)) { 482 if (time_after_eq(jiffies, timeout)) {
498 TIMEOUT_MSG(__LINE__); 483 TIMEOUT_MSG(__LINE__);
499 printk(KERN_INFO "%s: status %02x\n", dev->name, stat); 484 printk(KERN_INFO "%s: status %02x\n", dev->name, stat);
500 return FALSE; 485 return false;
501 } 486 }
502 pcb->length = inb_command(dev->base_addr); 487 pcb->length = inb_command(dev->base_addr);
503 488
504 if (pcb->length > MAX_PCB_DATA) { 489 if (pcb->length > MAX_PCB_DATA) {
505 INVALID_PCB_MSG(pcb->length); 490 INVALID_PCB_MSG(pcb->length);
506 adapter_reset(dev); 491 adapter_reset(dev);
507 return FALSE; 492 return false;
508 } 493 }
509 /* read the data */ 494 /* read the data */
510 spin_lock_irqsave(&adapter->lock, flags); 495 spin_lock_irqsave(&adapter->lock, flags);
@@ -519,7 +504,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
519 spin_unlock_irqrestore(&adapter->lock, flags); 504 spin_unlock_irqrestore(&adapter->lock, flags);
520 if (j >= 20000) { 505 if (j >= 20000) {
521 TIMEOUT_MSG(__LINE__); 506 TIMEOUT_MSG(__LINE__);
522 return FALSE; 507 return false;
523 } 508 }
524 /* woops, the last "data" byte was really the length! */ 509 /* woops, the last "data" byte was really the length! */
525 total_length = pcb->data.raw[--i]; 510 total_length = pcb->data.raw[--i];
@@ -529,7 +514,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
529 if (elp_debug >= 2) 514 if (elp_debug >= 2)
530 printk(KERN_WARNING "%s: mangled PCB received\n", dev->name); 515 printk(KERN_WARNING "%s: mangled PCB received\n", dev->name);
531 set_hsf(dev, HSF_PCB_NAK); 516 set_hsf(dev, HSF_PCB_NAK);
532 return FALSE; 517 return false;
533 } 518 }
534 519
535 if (pcb->command == CMD_RECEIVE_PACKET_COMPLETE) { 520 if (pcb->command == CMD_RECEIVE_PACKET_COMPLETE) {
@@ -538,14 +523,14 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
538 set_hsf(dev, HSF_PCB_NAK); 523 set_hsf(dev, HSF_PCB_NAK);
539 printk(KERN_WARNING "%s: PCB rejected, transfer in progress and backlog full\n", dev->name); 524 printk(KERN_WARNING "%s: PCB rejected, transfer in progress and backlog full\n", dev->name);
540 pcb->command = 0; 525 pcb->command = 0;
541 return TRUE; 526 return true;
542 } else { 527 } else {
543 pcb->command = 0xff; 528 pcb->command = 0xff;
544 } 529 }
545 } 530 }
546 } 531 }
547 set_hsf(dev, HSF_PCB_ACK); 532 set_hsf(dev, HSF_PCB_ACK);
548 return TRUE; 533 return true;
549} 534}
550 535
551/****************************************************** 536/******************************************************
@@ -555,9 +540,9 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
555 * 540 *
556 ******************************************************/ 541 ******************************************************/
557 542
558static int start_receive(struct net_device *dev, pcb_struct * tx_pcb) 543static bool start_receive(struct net_device *dev, pcb_struct * tx_pcb)
559{ 544{
560 int status; 545 bool status;
561 elp_device *adapter = dev->priv; 546 elp_device *adapter = dev->priv;
562 547
563 if (elp_debug >= 3) 548 if (elp_debug >= 3)
@@ -984,7 +969,7 @@ static int elp_open(struct net_device *dev)
984 * 969 *
985 ******************************************************/ 970 ******************************************************/
986 971
987static int send_packet(struct net_device *dev, struct sk_buff *skb) 972static bool send_packet(struct net_device *dev, struct sk_buff *skb)
988{ 973{
989 elp_device *adapter = dev->priv; 974 elp_device *adapter = dev->priv;
990 unsigned long target; 975 unsigned long target;
@@ -998,7 +983,7 @@ static int send_packet(struct net_device *dev, struct sk_buff *skb)
998 if (test_and_set_bit(0, (void *) &adapter->busy)) { 983 if (test_and_set_bit(0, (void *) &adapter->busy)) {
999 if (elp_debug >= 2) 984 if (elp_debug >= 2)
1000 printk(KERN_DEBUG "%s: transmit blocked\n", dev->name); 985 printk(KERN_DEBUG "%s: transmit blocked\n", dev->name);
1001 return FALSE; 986 return false;
1002 } 987 }
1003 988
1004 adapter->stats.tx_bytes += nlen; 989 adapter->stats.tx_bytes += nlen;
@@ -1015,7 +1000,7 @@ static int send_packet(struct net_device *dev, struct sk_buff *skb)
1015 1000
1016 if (!send_pcb(dev, &adapter->tx_pcb)) { 1001 if (!send_pcb(dev, &adapter->tx_pcb)) {
1017 adapter->busy = 0; 1002 adapter->busy = 0;
1018 return FALSE; 1003 return false;
1019 } 1004 }
1020 /* if this happens, we die */ 1005 /* if this happens, we die */
1021 if (test_and_set_bit(0, (void *) &adapter->dmaing)) 1006 if (test_and_set_bit(0, (void *) &adapter->dmaing))
@@ -1047,7 +1032,7 @@ static int send_packet(struct net_device *dev, struct sk_buff *skb)
1047 if (elp_debug >= 3) 1032 if (elp_debug >= 3)
1048 printk(KERN_DEBUG "%s: DMA transfer started\n", dev->name); 1033 printk(KERN_DEBUG "%s: DMA transfer started\n", dev->name);
1049 1034
1050 return TRUE; 1035 return true;
1051} 1036}
1052 1037
1053/* 1038/*