arcnet: Expand odd BUGLVL macro with if and uses
[cascardo/linux.git] / drivers / net / arcnet / com90io.c
index 487d780..33a8531 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Linux ARCnet driver - COM90xx chipset (IO-mapped buffers)
- * 
+ *
  * Written 1997 by David Woodhouse.
  * Written 1994-1999 by Avery Pennarun.
  * Written 1999-2000 by Martin Mares <mj@ucw.cz>.
 #include <linux/bootmem.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <linux/arcdevice.h>
 
-
 #define VERSION "arcnet: COM90xx IO-mapped mode support (by David Woodhouse et el.)\n"
 
-
 /* Internal function declarations */
 
 static int com90io_found(struct net_device *dev);
@@ -53,31 +51,29 @@ static void com90io_copy_to_card(struct net_device *dev, int bufnum, int offset,
 static void com90io_copy_from_card(struct net_device *dev, int bufnum, int offset,
                                   void *buf, int count);
 
-
 /* Handy defines for ARCnet specific stuff */
 
 /* The number of low I/O ports used by the card. */
 #define ARCNET_TOTAL_SIZE 16
 
 /* COM 9026 controller chip --> ARCnet register addresses */
-#define _INTMASK (ioaddr+0)    /* writable */
-#define _STATUS  (ioaddr+0)    /* readable */
-#define _COMMAND (ioaddr+1)    /* writable, returns random vals on read (?) */
-#define _RESET  (ioaddr+8)     /* software reset (on read) */
-#define _MEMDATA  (ioaddr+12)  /* Data port for IO-mapped memory */
-#define _ADDR_HI  (ioaddr+15)  /* Control registers for said */
-#define _ADDR_LO  (ioaddr+14)
-#define _CONFIG  (ioaddr+2)    /* Configuration register */
+#define _INTMASK       (ioaddr + 0)    /* writable */
+#define _STATUS                (ioaddr + 0)    /* readable */
+#define _COMMAND       (ioaddr + 1)    /* writable, returns random vals on read (?) */
+#define _RESET         (ioaddr + 8)    /* software reset (on read) */
+#define _MEMDATA       (ioaddr + 12)   /* Data port for IO-mapped memory */
+#define _ADDR_HI       (ioaddr + 15)   /* Control registers for said */
+#define _ADDR_LO       (ioaddr + 14)
+#define _CONFIG                (ioaddr + 2)    /* Configuration register */
 
 #undef ASTATUS
 #undef ACOMMAND
 #undef AINTMASK
 
 #define ASTATUS()      inb(_STATUS)
-#define ACOMMAND(cmd) outb((cmd),_COMMAND)
-#define AINTMASK(msk)  outb((msk),_INTMASK)
-#define SETCONF()      outb((lp->config),_CONFIG)
-
+#define ACOMMAND(cmd)  outb((cmd), _COMMAND)
+#define AINTMASK(msk)  outb((msk), _INTMASK)
+#define SETCONF()      outb((lp->config), _CONFIG)
 
 /****************************************************************************
  *                                                                          *
@@ -111,7 +107,6 @@ static void put_buffer_byte(struct net_device *dev, unsigned offset, u_char datu
 
 #endif
 
-
 static void get_whole_buffer(struct net_device *dev, unsigned offset, unsigned length, char *dest)
 {
        int ioaddr = dev->base_addr;
@@ -142,8 +137,7 @@ static void put_whole_buffer(struct net_device *dev, unsigned offset, unsigned l
 #endif
 }
 
-/*
- * We cannot probe for an IO mapped card either, although we can check that
+/* We cannot probe for an IO mapped card either, although we can check that
  * it's where we were told it was, and even autoirq
  */
 static int __init com90io_probe(struct net_device *dev)
@@ -151,12 +145,13 @@ static int __init com90io_probe(struct net_device *dev)
        int ioaddr = dev->base_addr, status;
        unsigned long airqmask;
 
-       BUGLVL(D_NORMAL) printk(VERSION);
-       BUGLVL(D_NORMAL) printk("E-mail me if you actually test this driver, please!\n");
+       if (BUGLVL(D_NORMAL)) {
+               printk(VERSION);
+               printk("E-mail me if you actually test this driver, please!\n");
+       }
 
        if (!ioaddr) {
-               BUGMSG(D_NORMAL, "No autoprobe for IO mapped cards; you "
-                      "must specify the base address!\n");
+               BUGMSG(D_NORMAL, "No autoprobe for IO mapped cards; you must specify the base address!\n");
                return -ENODEV;
        }
        if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, "com90io probe")) {
@@ -197,13 +192,12 @@ static int __init com90io_probe(struct net_device *dev)
        outb(0, _ADDR_LO);
 
        if ((status = inb(_MEMDATA)) != 0xd1) {
-               BUGMSG(D_INIT_REASONS, "Signature byte not found"
-                      " (%Xh instead).\n", status);
+               BUGMSG(D_INIT_REASONS, "Signature byte not found (%Xh instead).\n",
+                      status);
                goto err_out;
        }
        if (!dev->irq) {
-               /*
-                * if we do this, we're sure to get an IRQ since the
+               /* if we do this, we're sure to get an IRQ since the
                 * card has just reset and the NORXflag is on until
                 * we tell it to start receiving.
                 */
@@ -227,7 +221,6 @@ err_out:
        return -ENODEV;
 }
 
-
 /* Set up the struct net_device associated with this card.  Called after
  * probing succeeds.
  */
@@ -279,9 +272,7 @@ static int __init com90io_found(struct net_device *dev)
        return 0;
 }
 
-
-/*
- * Do a hardware reset on the card, and set up necessary registers.
+/* Do a hardware reset on the card, and set up necessary registers.
  *
  * This should be called as little as possible, because it disrupts the
  * token on the network (causes a RECON) and requires a significant delay.
@@ -319,7 +310,6 @@ static int com90io_reset(struct net_device *dev, int really_reset)
        return 0;
 }
 
-
 static void com90io_command(struct net_device *dev, int cmd)
 {
        short ioaddr = dev->base_addr;
@@ -327,7 +317,6 @@ static void com90io_command(struct net_device *dev, int cmd)
        ACOMMAND(cmd);
 }
 
-
 static int com90io_status(struct net_device *dev)
 {
        short ioaddr = dev->base_addr;
@@ -335,7 +324,6 @@ static int com90io_status(struct net_device *dev)
        return ASTATUS();
 }
 
-
 static void com90io_setmask(struct net_device *dev, int mask)
 {
        short ioaddr = dev->base_addr;
@@ -349,7 +337,6 @@ static void com90io_copy_to_card(struct net_device *dev, int bufnum, int offset,
        TIME("put_whole_buffer", count, put_whole_buffer(dev, bufnum * 512 + offset, count, buf));
 }
 
-
 static void com90io_copy_from_card(struct net_device *dev, int bufnum, int offset,
                                   void *buf, int count)
 {
@@ -369,6 +356,7 @@ MODULE_LICENSE("GPL");
 static int __init com90io_setup(char *s)
 {
        int ints[4];
+
        s = get_options(s, 4, ints);
        if (!ints[0])
                return 0;