Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/pmax/stand/common Misc cleanup:



details:   https://anonhg.NetBSD.org/src/rev/6d97291b435c
branches:  trunk
changeset: 760632:6d97291b435c
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Jan 09 16:55:13 2011 +0000

description:
Misc cleanup:
- use DPRINTF() style debug printf
- KNF and ANSIfy
- fix space/TAB botch
- remove extra newlines

diffstat:

 sys/arch/pmax/stand/common/if_prom.c |  67 +++++++++++++++--------------------
 1 files changed, 28 insertions(+), 39 deletions(-)

diffs (181 lines):

diff -r fcd78a6a7d8d -r 6d97291b435c sys/arch/pmax/stand/common/if_prom.c
--- a/sys/arch/pmax/stand/common/if_prom.c      Sun Jan 09 16:28:40 2011 +0000
+++ b/sys/arch/pmax/stand/common/if_prom.c      Sun Jan 09 16:55:13 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_prom.c,v 1.8 2011/01/09 16:28:40 tsutsui Exp $ */
+/*      $NetBSD: if_prom.c,v 1.9 2011/01/09 16:55:13 tsutsui Exp $ */
 
 /* Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -46,6 +46,12 @@
 #include <stand/common/common.h>
 
 #ifdef NET_DEBUG
+#define DPRINTF(x)     printf(x)
+#else
+#define DPRINTF(x)
+#endif
+
+#ifdef NET_DEBUG
 void dump_packet_info(void *, int);
 #endif
 
@@ -100,10 +106,8 @@
 prom_match(struct netif *nif, void *machdep_hint)
 {
 
-#ifdef NET_DEBUG
-       printf("prom_match: called\n");
-#endif
-       return (1);
+       DPRINTF(("prom_match: called\n"));
+       return 1;
 }
 
 
@@ -111,9 +115,7 @@
 prom_probe(struct netif *nif, void *machdep_hint)
 {
 
-#ifdef NET_DEBUG
-       printf("prom_probe: called\n");
-#endif
+       DPRINTF(("prom_probe: called\n"));
        return 0;
 }
 
@@ -121,22 +123,19 @@
 void
 prom_init(struct iodesc *desc, void *machdep_hint)
 {
-       char *device =
-               ((struct netif *)desc->io_netif)->nif_driver->netif_bname;
-       char *enet;
+       struct netif *nif;
+       char *device, *enet;
        uint8_t *cp, *dest;
        int i;
 
-#ifdef NET_DEBUG
-       printf("prom_init: called\n");
-#endif
+       DPRINTF(("prom_init: called\n"));
 
        try_bootp = 1;
 
        /*
         * Get our hardware address (this prom call is one of the rare ones
-         * which is the same for new and old proms)
-         */
+        * which is the same for new and old proms)
+        */
        enet = (*callv->_getenv)("enet");
 
        if (enet == NULL) {
@@ -170,6 +169,8 @@
 
        desc->xid = 0x66d30000;
 
+       nif = desc->io_netif;
+       device = nif->nif_driver->netif_bname;
        if (callv == &callvec)
                sc_fd = prom_open(device, 0);
        else
@@ -185,9 +186,7 @@
 {
        int s;
 
-#ifdef NET_DEBUG
-       printf("prom_put: called\n");
-#endif
+       DPRINTF(("prom_put: called\n"));
 
 #ifdef NET_DEBUG
        if (debug)
@@ -201,7 +200,7 @@
                (*callv->_wbflush)(); /* didn't really make a difference */
        }
        if (s < 0)
-               return (EIO);
+               return EIO;
        return s;
 }
 
@@ -212,9 +211,7 @@
        int s;
        satime_t t;
 
-#ifdef NET_DEBUG
-       printf("prom_get: called\n");
-#endif
+       DPRINTF(("prom_get: called\n"));
 
        t = getsecs();
        s = 0;
@@ -231,7 +228,6 @@
 #endif
 
        return s;
-
 }
 
 
@@ -239,9 +235,7 @@
 prom_end(struct netif *nif)
 {
 
-#ifdef NET_DEBUG
-       printf("prom_end: called\n");
-#endif
+       DPRINTF(("prom_end: called\n"));
 
        if (callv == &callvec)
                prom_close(sc_fd);
@@ -249,9 +243,8 @@
 
 
 #ifdef FILL_ARPCACHE
-void fill_arpcache (pkt, len)
-       void *pkt;
-       int len;
+void
+fill_arpcache(void *pkt, int len)
 {
        int i;
        struct arp_list *al;
@@ -272,21 +265,19 @@
                                return;
                        }
                }
-               if (arp_num > 7)
-                               arp_num = 1;    /* recycle */
+               if (arp_num > 7)
+                       arp_num = 1;    /* recycle */
                al->addr.s_addr = ih->ip_src.s_addr;
-               for (i=0; i<6; i++)
+               for (i = 0; i < 6; i++)
                        al->ea[i] = eh->ether_shost[i];
                ++arp_num;
        }
-
 }
 #endif
 
 #ifdef NET_DEBUG
-void dump_packet_info(pkt, len)
-       void *pkt;
-       int len;
+void
+dump_packet_info(void *pkt, int len)
 {
        struct ether_header *eh = (struct ether_header *)pkt;
        struct ip *ih = (struct ip *)(eh + 1);
@@ -299,8 +290,6 @@
                printf("ip packet version %d\n", ih->ip_v);
                printf("source ip: 0x%x\n", ih->ip_src.s_addr);
                printf("dest ip: 0x%x\n", ih->ip_dst.s_addr);
-
        }
-
 }
 #endif



Home | Main Index | Thread Index | Old Index