staging: dgap: fix a few 80+ char lines as reported by checkpatch
[platform/kernel/linux-rpi.git] / drivers / staging / dgap / dgap.c
index 7cb1ad5..69c19f1 100644 (file)
@@ -61,7 +61,7 @@
 #include <linux/pci.h>
 #include <linux/delay.h>       /* For udelay */
 #include <linux/slab.h>
-#include <asm/uaccess.h>       /* For copy_from_user/copy_to_user */
+#include <linux/uaccess.h>
 #include <linux/sched.h>
 
 #include <linux/interrupt.h>   /* For tasklet and interrupt structs/defines */
@@ -69,7 +69,7 @@
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
 #include <linux/serial_reg.h>
-#include <asm/io.h>            /* For read[bwl]/write[bwl] */
+#include <linux/io.h>          /* For read[bwl]/write[bwl] */
 
 #include <linux/string.h>
 #include <linux/device.h>
 
 #define init_MUTEX(sem)         sema_init(sem, 1)
 #define DECLARE_MUTEX(name)     \
-        struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
+       struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Digi International, http://www.digi.com");
 MODULE_DESCRIPTION("Driver for the Digi International EPCA PCI based product line");
 MODULE_SUPPORTED_DEVICE("dgap");
 
-/*
- * insmod command line overrideable parameters
- *
- * NOTE: we use a set of macros to create the variables, which allows
- * us to specify the variable type, name, initial value, and description.
- */
-PARM_INT(debug,                0x00,           0644,   "Driver debugging level");
-PARM_INT(rawreadok,    1,              0644,   "Bypass flip buffers on input");
-PARM_INT(trcbuf_size,  0x100000,       0644,   "Debugging trace buffer size.");
-
-
 /**************************************************************************
  *
  * protos for this file
  *
  */
 
-static int             dgap_start(void);
-static void            dgap_init_globals(void);
-static int             dgap_found_board(struct pci_dev *pdev, int id);
-static void            dgap_cleanup_board(struct board_t *brd);
-static void            dgap_poll_handler(ulong dummy);
-static int             dgap_init_pci(void);
-static int             dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
-static void            dgap_remove_one(struct pci_dev *dev);
-static int             dgap_probe1(struct pci_dev *pdev, int card_type);
-static void            dgap_mbuf(struct board_t *brd, const char *fmt, ...);
-static int             dgap_do_remap(struct board_t *brd);
-static irqreturn_t     dgap_intr(int irq, void *voidbrd);
+static int dgap_start(void);
+static void dgap_init_globals(void);
+static int dgap_found_board(struct pci_dev *pdev, int id);
+static void dgap_cleanup_board(struct board_t *brd);
+static void dgap_poll_handler(ulong dummy);
+static int dgap_init_pci(void);
+static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
+static void dgap_remove_one(struct pci_dev *dev);
+static int dgap_probe1(struct pci_dev *pdev, int card_type);
+static int dgap_do_remap(struct board_t *brd);
+static irqreturn_t dgap_intr(int irq, void *voidbrd);
 
 /* Our function prototypes */
 static int dgap_tty_open(struct tty_struct *tty, struct file *file);
 static void dgap_tty_close(struct tty_struct *tty, struct file *file);
-static int dgap_block_til_ready(struct tty_struct *tty, struct file *file, struct channel_t *ch);
-static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
-static int dgap_tty_digigeta(struct tty_struct *tty, struct digi_t __user *retinfo);
-static int dgap_tty_digiseta(struct tty_struct *tty, struct digi_t __user *new_info);
+static int dgap_block_til_ready(struct tty_struct *tty, struct file *file,
+                               struct channel_t *ch);
+static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
+                               unsigned long arg);
+static int dgap_tty_digigeta(struct tty_struct *tty,
+                               struct digi_t __user *retinfo);
+static int dgap_tty_digiseta(struct tty_struct *tty,
+                               struct digi_t __user *new_info);
 static int dgap_tty_digigetedelay(struct tty_struct *tty, int __user *retinfo);
 static int dgap_tty_digisetedelay(struct tty_struct *tty, int __user *new_info);
-static int dgap_tty_write_room(struct tty_structtty);
-static int dgap_tty_chars_in_buffer(struct tty_structtty);
+static int dgap_tty_write_room(struct tty_struct *tty);
+static int dgap_tty_chars_in_buffer(struct tty_struct *tty);
 static void dgap_tty_start(struct tty_struct *tty);
 static void dgap_tty_stop(struct tty_struct *tty);
 static void dgap_tty_throttle(struct tty_struct *tty);
@@ -136,26 +128,33 @@ static void dgap_tty_flush_chars(struct tty_struct *tty);
 static void dgap_tty_flush_buffer(struct tty_struct *tty);
 static void dgap_tty_hangup(struct tty_struct *tty);
 static int dgap_wait_for_drain(struct tty_struct *tty);
-static int dgap_set_modem_info(struct tty_struct *tty, unsigned int command, unsigned int __user *value);
-static int dgap_get_modem_info(struct channel_t *ch, unsigned int __user *value);
-static int dgap_tty_digisetcustombaud(struct tty_struct *tty, int __user *new_info);
-static int dgap_tty_digigetcustombaud(struct tty_struct *tty, int __user *retinfo);
+static int dgap_set_modem_info(struct tty_struct *tty, unsigned int command,
+                               unsigned int __user *value);
+static int dgap_get_modem_info(struct channel_t *ch,
+                               unsigned int __user *value);
+static int dgap_tty_digisetcustombaud(struct tty_struct *tty,
+                               int __user *new_info);
+static int dgap_tty_digigetcustombaud(struct tty_struct *tty,
+                               int __user *retinfo);
 static int dgap_tty_tiocmget(struct tty_struct *tty);
-static int dgap_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear);
+static int dgap_tty_tiocmset(struct tty_struct *tty, unsigned int set,
+                               unsigned int clear);
 static int dgap_tty_send_break(struct tty_struct *tty, int msec);
 static void dgap_tty_wait_until_sent(struct tty_struct *tty, int timeout);
-static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, int count);
-static void dgap_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios);
+static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,
+                               int count);
+static void dgap_tty_set_termios(struct tty_struct *tty,
+                               struct ktermios *old_termios);
 static int dgap_tty_put_char(struct tty_struct *tty, unsigned char c);
 static void dgap_tty_send_xchar(struct tty_struct *tty, char ch);
 
-static int     dgap_tty_register(struct board_t *brd);
-static int     dgap_tty_preinit(void);
-static int     dgap_tty_init(struct board_t *);
-static void    dgap_tty_post_uninit(void);
-static void    dgap_tty_uninit(struct board_t *);
-static void    dgap_carrier(struct channel_t *ch);
-static void    dgap_input(struct channel_t *ch);
+static int dgap_tty_register(struct board_t *brd);
+static int dgap_tty_preinit(void);
+static int dgap_tty_init(struct board_t *);
+static void dgap_tty_post_uninit(void);
+static void dgap_tty_uninit(struct board_t *);
+static void dgap_carrier(struct channel_t *ch);
+static void dgap_input(struct channel_t *ch);
 
 /*
  * Our function prototypes from dgap_fep5
@@ -164,11 +163,13 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds);
 static int dgap_event(struct board_t *bd);
 
 static void dgap_poll_tasklet(unsigned long data);
-static void dgap_cmdb(struct channel_t *ch, uchar cmd, uchar byte1, uchar byte2, uint ncmds);
+static void dgap_cmdb(struct channel_t *ch, uchar cmd, uchar byte1,
+                       uchar byte2, uint ncmds);
 static void dgap_cmdw(struct channel_t *ch, uchar cmd, u16 word, uint ncmds);
 static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt);
 static int dgap_param(struct tty_struct *tty);
-static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf, unsigned char *fbuf, int *len);
+static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf,
+                               unsigned char *fbuf, int *len);
 static uint dgap_get_custom_baud(struct channel_t *ch);
 static void dgap_firmware_reset_port(struct channel_t *ch);
 
@@ -183,8 +184,8 @@ static int dgap_checknode(struct cnode *p);
 static void dgap_err(char *s);
 
 /*
- * Function prototypes from dgap_sysfs.h 
- */ 
+ * Function prototypes from dgap_sysfs.h
+ */
 struct board_t;
 struct channel_t;
 struct un_t;
@@ -210,63 +211,58 @@ static char *dgap_create_config_string(struct board_t *bd, char *string);
 static uint dgap_config_get_useintr(struct board_t *bd);
 static uint dgap_config_get_altpin(struct board_t *bd);
 
-static int     dgap_ms_sleep(ulong ms);
-static void    dgap_do_bios_load(struct board_t *brd, uchar __user *ubios, int len);
-static void    dgap_do_fep_load(struct board_t *brd, uchar __user *ufep, int len);
+static int dgap_ms_sleep(ulong ms);
+static void dgap_do_bios_load(struct board_t *brd, uchar __user *ubios,
+                               int len);
+static void dgap_do_fep_load(struct board_t *brd, uchar __user *ufep, int len);
 #ifdef DIGI_CONCENTRATORS_SUPPORTED
-static void    dgap_do_conc_load(struct board_t *brd, uchar *uaddr, int len);
+static void dgap_do_conc_load(struct board_t *brd, uchar *uaddr, int len);
 #endif
-static int     dgap_after_config_loaded(int board);
-static int     dgap_finalize_board_init(struct board_t *brd);
+static int dgap_after_config_loaded(int board);
+static int dgap_finalize_board_init(struct board_t *brd);
 
 static void dgap_get_vpd(struct board_t *brd);
 static void dgap_do_reset_board(struct board_t *brd);
 static void dgap_do_wait_for_bios(struct board_t *brd);
 static void dgap_do_wait_for_fep(struct board_t *brd);
-static void dgap_sysfs_create(struct board_t *brd);
+static int dgap_tty_register_ports(struct board_t *brd);
 static int dgap_firmware_load(struct pci_dev *pdev, int card_type);
 
-/* Driver load/unload functions */
-int                    dgap_init_module(void);
-void                   dgap_cleanup_module(void);
+/* Driver unload function */
+static void dgap_cleanup_module(void);
 
-module_init(dgap_init_module);
 module_exit(dgap_cleanup_module);
 
-
 /*
  * File operations permitted on Control/Management major.
  */
-static struct file_operations DgapBoardFops =
-{
-       .owner          =       THIS_MODULE,
+static const struct file_operations DgapBoardFops = {
+       .owner  = THIS_MODULE,
 };
 
-
 /*
  * Globals
  */
-static uint                    dgap_NumBoards;
-static struct board_t          *dgap_Board[MAXBOARDS];
-DEFINE_SPINLOCK(dgap_global_lock);
-static ulong                   dgap_poll_counter;
-static char                    *dgap_config_buf;
-static int                     dgap_driver_state = DRIVER_INITIALIZED;
+static uint dgap_NumBoards;
+static struct board_t *dgap_Board[MAXBOARDS];
+static ulong dgap_poll_counter;
+static char *dgap_config_buf;
+static int dgap_driver_state = DRIVER_INITIALIZED;
 DEFINE_SPINLOCK(dgap_dl_lock);
-static wait_queue_head_t       dgap_dl_wait;
-static int                     dgap_dl_action;
-static int                     dgap_poll_tick = 20;    /* Poll interval - 20 ms */
+static wait_queue_head_t dgap_dl_wait;
+static int dgap_dl_action;
+static int dgap_poll_tick = 20;        /* Poll interval - 20 ms */
 
 /*
  * Static vars.
  */
-static int             dgap_Major_Control_Registered = FALSE;
-static uint            dgap_driver_start = FALSE;
+static int dgap_Major_Control_Registered = FALSE;
+static uint dgap_driver_start = FALSE;
 
-static struct class *  dgap_class;
+static struct class *dgap_class;
 
-static struct board_t  *dgap_BoardsByMajor[256];
-static uchar           *dgap_TmpWriteBuf = NULL;
+static struct board_t *dgap_BoardsByMajor[256];
+static uchar *dgap_TmpWriteBuf;
 DECLARE_MUTEX(dgap_TmpWriteSem);
 static uint dgap_count = 500;
 
@@ -274,8 +270,8 @@ static uint dgap_count = 500;
  * Poller stuff
  */
 DEFINE_SPINLOCK(dgap_poll_lock);       /* Poll scheduling lock */
-static ulong           dgap_poll_time;                         /* Time of next poll */
-static uint            dgap_poll_stop;                         /* Used to tell poller to stop */
+static ulong dgap_poll_time;           /* Time of next poll */
+static uint dgap_poll_stop;            /* Used to tell poller to stop */
 static struct timer_list dgap_poll_timer;
 
 /*
@@ -298,26 +294,25 @@ static struct timer_list dgap_poll_timer;
 */
 
 static struct pci_device_id dgap_pci_tbl[] = {
-       {       DIGI_VID, PCI_DEVICE_XEM_DID,   PCI_ANY_ID, PCI_ANY_ID, 0, 0,   0 },
-       {       DIGI_VID, PCI_DEVICE_CX_DID,    PCI_ANY_ID, PCI_ANY_ID, 0, 0,   1 },
-       {       DIGI_VID, PCI_DEVICE_CX_IBM_DID, PCI_ANY_ID, PCI_ANY_ID, 0, 0,  2 },
-       {       DIGI_VID, PCI_DEVICE_EPCJ_DID,  PCI_ANY_ID, PCI_ANY_ID, 0, 0,   3 },
-       {       DIGI_VID, PCI_DEVICE_920_2_DID, PCI_ANY_ID, PCI_ANY_ID, 0, 0,   4 },
-       {       DIGI_VID, PCI_DEVICE_920_4_DID, PCI_ANY_ID, PCI_ANY_ID, 0, 0,   5 },
-       {       DIGI_VID, PCI_DEVICE_920_8_DID, PCI_ANY_ID, PCI_ANY_ID, 0, 0,   6 },
-       {       DIGI_VID, PCI_DEVICE_XR_DID,    PCI_ANY_ID, PCI_ANY_ID, 0, 0,   7 },
-       {       DIGI_VID, PCI_DEVICE_XRJ_DID,   PCI_ANY_ID, PCI_ANY_ID, 0, 0,   8 },
-       {       DIGI_VID, PCI_DEVICE_XR_422_DID, PCI_ANY_ID, PCI_ANY_ID, 0, 0,  9 },
-       {       DIGI_VID, PCI_DEVICE_XR_IBM_DID, PCI_ANY_ID, PCI_ANY_ID, 0, 0,  10 },
-       {       DIGI_VID, PCI_DEVICE_XR_SAIP_DID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 11 },
-       {       DIGI_VID, PCI_DEVICE_XR_BULL_DID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12 },
-       {       DIGI_VID, PCI_DEVICE_920_8_HP_DID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13 },
-       {       DIGI_VID, PCI_DEVICE_XEM_HP_DID, PCI_ANY_ID, PCI_ANY_ID, 0, 0,  14 },
+       { DIGI_VID, PCI_DEV_XEM_DID,      PCI_ANY_ID, PCI_ANY_ID, 0, 0,  0 },
+       { DIGI_VID, PCI_DEV_CX_DID,       PCI_ANY_ID, PCI_ANY_ID, 0, 0,  1 },
+       { DIGI_VID, PCI_DEV_CX_IBM_DID,   PCI_ANY_ID, PCI_ANY_ID, 0, 0,  2 },
+       { DIGI_VID, PCI_DEV_EPCJ_DID,     PCI_ANY_ID, PCI_ANY_ID, 0, 0,  3 },
+       { DIGI_VID, PCI_DEV_920_2_DID,    PCI_ANY_ID, PCI_ANY_ID, 0, 0,  4 },
+       { DIGI_VID, PCI_DEV_920_4_DID,    PCI_ANY_ID, PCI_ANY_ID, 0, 0,  5 },
+       { DIGI_VID, PCI_DEV_920_8_DID,    PCI_ANY_ID, PCI_ANY_ID, 0, 0,  6 },
+       { DIGI_VID, PCI_DEV_XR_DID,       PCI_ANY_ID, PCI_ANY_ID, 0, 0,  7 },
+       { DIGI_VID, PCI_DEV_XRJ_DID,      PCI_ANY_ID, PCI_ANY_ID, 0, 0,  8 },
+       { DIGI_VID, PCI_DEV_XR_422_DID,   PCI_ANY_ID, PCI_ANY_ID, 0, 0,  9 },
+       { DIGI_VID, PCI_DEV_XR_IBM_DID,   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 10 },
+       { DIGI_VID, PCI_DEV_XR_SAIP_DID,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 11 },
+       { DIGI_VID, PCI_DEV_XR_BULL_DID,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12 },
+       { DIGI_VID, PCI_DEV_920_8_HP_DID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13 },
+       { DIGI_VID, PCI_DEV_XEM_HP_DID,   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14 },
        {0,}                                    /* 0 terminated list. */
 };
 MODULE_DEVICE_TABLE(pci, dgap_pci_tbl);
 
-
 /*
  * A generic list of Product names, PCI Vendor ID, and PCI Device ID.
  */
@@ -328,23 +323,22 @@ struct board_id {
        uint dpatype;
 };
 
-static struct board_id dgap_Ids[] =
-{
-       {       PPCM,           PCI_DEVICE_XEM_NAME,    64,     (T_PCXM | T_PCLITE | T_PCIBUS)  },
-       {       PCX,            PCI_DEVICE_CX_NAME,     128,    (T_CX | T_PCIBUS)               },
-       {       PCX,            PCI_DEVICE_CX_IBM_NAME, 128,    (T_CX | T_PCIBUS)               },
-       {       PEPC,           PCI_DEVICE_EPCJ_NAME,   224,    (T_EPC  | T_PCIBUS)             },
-       {       APORT2_920P,    PCI_DEVICE_920_2_NAME,  2,      (T_PCXR | T_PCLITE | T_PCIBUS)  },
-       {       APORT4_920P,    PCI_DEVICE_920_4_NAME,  4,      (T_PCXR | T_PCLITE | T_PCIBUS)  },
-       {       APORT8_920P,    PCI_DEVICE_920_8_NAME,  8,      (T_PCXR | T_PCLITE | T_PCIBUS)  },
-       {       PAPORT8,        PCI_DEVICE_XR_NAME,     8,      (T_PCXR | T_PCLITE | T_PCIBUS)  },
-       {       PAPORT8,        PCI_DEVICE_XRJ_NAME,    8,      (T_PCXR | T_PCLITE | T_PCIBUS)  },
-       {       PAPORT8,        PCI_DEVICE_XR_422_NAME, 8,      (T_PCXR | T_PCLITE | T_PCIBUS)  },
-       {       PAPORT8,        PCI_DEVICE_XR_IBM_NAME, 8,      (T_PCXR | T_PCLITE | T_PCIBUS)  },
-       {       PAPORT8,        PCI_DEVICE_XR_SAIP_NAME, 8,     (T_PCXR | T_PCLITE | T_PCIBUS)  },
-       {       PAPORT8,        PCI_DEVICE_XR_BULL_NAME, 8,     (T_PCXR | T_PCLITE | T_PCIBUS)  },
-       {       APORT8_920P,    PCI_DEVICE_920_8_HP_NAME, 8,    (T_PCXR | T_PCLITE | T_PCIBUS)  },
-       {       PPCM,           PCI_DEVICE_XEM_HP_NAME, 64,     (T_PCXM | T_PCLITE | T_PCIBUS)  },
+static struct board_id dgap_Ids[] = {
+       { PPCM,        PCI_DEV_XEM_NAME,     64, (T_PCXM|T_PCLITE|T_PCIBUS) },
+       { PCX,         PCI_DEV_CX_NAME,     128, (T_CX|T_PCIBUS)            },
+       { PCX,         PCI_DEV_CX_IBM_NAME, 128, (T_CX|T_PCIBUS)            },
+       { PEPC,        PCI_DEV_EPCJ_NAME,   224, (T_EPC|T_PCIBUS)           },
+       { APORT2_920P, PCI_DEV_920_2_NAME,    2, (T_PCXR|T_PCLITE|T_PCIBUS) },
+       { APORT4_920P, PCI_DEV_920_4_NAME,    4, (T_PCXR|T_PCLITE|T_PCIBUS) },
+       { APORT8_920P, PCI_DEV_920_8_NAME,    8, (T_PCXR|T_PCLITE|T_PCIBUS) },
+       { PAPORT8,     PCI_DEV_XR_NAME,       8, (T_PCXR|T_PCLITE|T_PCIBUS) },
+       { PAPORT8,     PCI_DEV_XRJ_NAME,      8, (T_PCXR|T_PCLITE|T_PCIBUS) },
+       { PAPORT8,     PCI_DEV_XR_422_NAME,   8, (T_PCXR|T_PCLITE|T_PCIBUS) },
+       { PAPORT8,     PCI_DEV_XR_IBM_NAME,   8, (T_PCXR|T_PCLITE|T_PCIBUS) },
+       { PAPORT8,     PCI_DEV_XR_SAIP_NAME,  8, (T_PCXR|T_PCLITE|T_PCIBUS) },
+       { PAPORT8,     PCI_DEV_XR_BULL_NAME,  8, (T_PCXR|T_PCLITE|T_PCIBUS) },
+       { APORT8_920P, PCI_DEV_920_8_HP_NAME, 8, (T_PCXR|T_PCLITE|T_PCIBUS) },
+       { PPCM,        PCI_DEV_XEM_HP_NAME,  64, (T_PCXM|T_PCLITE|T_PCIBUS) },
        {0,}                                            /* 0 terminated list. */
 };
 
@@ -385,7 +379,6 @@ static struct firmware_info fw_info[] = {
        {0,}
 };
 
-
 static char *dgap_driver_state_text[] = {
        "Driver Initialized",
        "Driver needs configuration load.",
@@ -408,7 +401,6 @@ static struct digi_t dgap_digi_init = {
        .digi_term =    "ansi"          /* default terminal type        */
 };
 
-
 /*
  * Define a local default termios struct. All ports will be created
  * with this termios initially.
@@ -417,14 +409,13 @@ static struct digi_t dgap_digi_init = {
  * 1 stop bit.
  */
 
-static struct ktermios DgapDefaultTermios =
-{
+static struct ktermios DgapDefaultTermios = {
        .c_iflag =      (DEFAULT_IFLAGS),       /* iflags */
        .c_oflag =      (DEFAULT_OFLAGS),       /* oflags */
        .c_cflag =      (DEFAULT_CFLAGS),       /* cflags */
        .c_lflag =      (DEFAULT_LFLAGS),       /* lflags */
        .c_cc =         INIT_C_CC,
-       .c_line =       0,
+       .c_line =       0,
 };
 
 static const struct tty_operations dgap_tty_ops = {
@@ -463,54 +454,54 @@ struct toklist {
 };
 
 static struct toklist dgap_tlist[] = {
-       {       BEGIN,          "config_begin"                  },
-       {       END,            "config_end"                    },
-       {       BOARD,          "board"                         },
-       {       PCX,            "Digi_AccelePort_C/X_PCI"       },      /* C/X_PCI */
-       {       PEPC,           "Digi_AccelePort_EPC/X_PCI"     },      /* EPC/X_PCI */
-       {       PPCM,           "Digi_AccelePort_Xem_PCI"       },      /* PCI/Xem */
-       {       APORT2_920P,    "Digi_AccelePort_2r_920_PCI"    },
-       {       APORT4_920P,    "Digi_AccelePort_4r_920_PCI"    },
-       {       APORT8_920P,    "Digi_AccelePort_8r_920_PCI"    },
-       {       PAPORT4,        "Digi_AccelePort_4r_PCI(EIA-232/RS-422)" },
-       {       PAPORT8,        "Digi_AccelePort_8r_PCI(EIA-232/RS-422)" },
-       {       IO,             "io"                            },
-       {       PCIINFO,        "pciinfo"                       },
-       {       LINE,           "line"                          },
-       {       CONC,           "conc"                          },
-       {       CONC,           "concentrator"                  },
-       {       CX,             "cx"                            },
-       {       CX,             "ccon"                          },
-       {       EPC,            "epccon"                        },
-       {       EPC,            "epc"                           },
-       {       MOD,            "module"                        },
-       {       ID,             "id"                            },
-       {       STARTO,         "start"                         },
-       {       SPEED,          "speed"                         },
-       {       CABLE,          "cable"                         },
-       {       CONNECT,        "connect"                       },
-       {       METHOD,         "method"                        },
-       {       STATUS,         "status"                        },
-       {       CUSTOM,         "Custom"                        },
-       {       BASIC,          "Basic"                         },
-       {       MEM,            "mem"                           },
-       {       MEM,            "memory"                        },
-       {       PORTS,          "ports"                         },
-       {       MODEM,          "modem"                         },
-       {       NPORTS,         "nports"                        },
-       {       TTYN,           "ttyname"                       },
-       {       CU,             "cuname"                        },
-       {       PRINT,          "prname"                        },
-       {       CMAJOR,         "major"                         },
-       {       ALTPIN,         "altpin"                        },
-       {       USEINTR,        "useintr"                       },
-       {       TTSIZ,          "ttysize"                       },
-       {       CHSIZ,          "chsize"                        },
-       {       BSSIZ,          "boardsize"                     },
-       {       UNTSIZ,         "schedsize"                     },
-       {       F2SIZ,          "f2200size"                     },
-       {       VPSIZ,          "vpixsize"                      },
-       {       0,              NULL                            }
+       { BEGIN,        "config_begin" },
+       { END,          "config_end" },
+       { BOARD,        "board" },
+       { PCX,          "Digi_AccelePort_C/X_PCI" },
+       { PEPC,         "Digi_AccelePort_EPC/X_PCI" },
+       { PPCM,         "Digi_AccelePort_Xem_PCI" },
+       { APORT2_920P,  "Digi_AccelePort_2r_920_PCI" },
+       { APORT4_920P,  "Digi_AccelePort_4r_920_PCI" },
+       { APORT8_920P,  "Digi_AccelePort_8r_920_PCI" },
+       { PAPORT4,      "Digi_AccelePort_4r_PCI(EIA-232/RS-422)" },
+       { PAPORT8,      "Digi_AccelePort_8r_PCI(EIA-232/RS-422)" },
+       { IO,           "io" },
+       { PCIINFO,      "pciinfo" },
+       { LINE,         "line" },
+       { CONC,         "conc" },
+       { CONC,         "concentrator" },
+       { CX,           "cx" },
+       { CX,           "ccon" },
+       { EPC,          "epccon" },
+       { EPC,          "epc" },
+       { MOD,          "module" },
+       { ID,           "id" },
+       { STARTO,       "start" },
+       { SPEED,        "speed" },
+       { CABLE,        "cable" },
+       { CONNECT,      "connect" },
+       { METHOD,       "method" },
+       { STATUS,       "status" },
+       { CUSTOM,       "Custom" },
+       { BASIC,        "Basic" },
+       { MEM,          "mem" },
+       { MEM,          "memory" },
+       { PORTS,        "ports" },
+       { MODEM,        "modem" },
+       { NPORTS,       "nports" },
+       { TTYN,         "ttyname" },
+       { CU,           "cuname" },
+       { PRINT,        "prname" },
+       { CMAJOR,       "major"  },
+       { ALTPIN,       "altpin" },
+       { USEINTR,      "useintr" },
+       { TTSIZ,        "ttysize" },
+       { CHSIZ,        "chsize" },
+       { BSSIZ,        "boardsize" },
+       { UNTSIZ,       "schedsize" },
+       { F2SIZ,        "f2200size" },
+       { VPSIZ,        "vpixsize" },
+       { 0,            NULL }
 };
 
 /************************************************************************
@@ -524,11 +515,11 @@ static struct toklist dgap_tlist[] = {
  *
  * Module load.  This is where it all starts.
  */
-int dgap_init_module(void)
+static int dgap_init_module(void)
 {
        int rc = 0;
 
-       APR(("%s, Digi International Part Number %s\n", DG_NAME, DG_PART));
+       pr_info("%s, Digi International Part Number %s\n", DG_NAME, DG_PART);
 
        dgap_driver_state = DRIVER_NEED_CONFIG_LOAD;
 
@@ -537,9 +528,8 @@ int dgap_init_module(void)
         */
        rc = dgap_start();
 
-       if (rc < 0) {
-               return(rc);
-       }
+       if (rc < 0)
+               return rc;
 
        /*
         * Find and configure all the cards
@@ -554,19 +544,17 @@ int dgap_init_module(void)
                if (dgap_NumBoards)
                        pci_unregister_driver(&dgap_driver);
                else
-                       printk("WARNING: dgap driver load failed.  No DGAP boards found.\n");
+                       pr_err("dgap: driver load failed. No boards found.\n");
 
                dgap_cleanup_module();
-       }
-       else {
+       } else {
                dgap_create_driver_sysfiles(&dgap_driver);
                dgap_driver_state = DRIVER_READY;
        }
 
-       DPR_INIT(("Finished init_module. Returning %d\n", rc));
-       return (rc);
+       return rc;
 }
-
+module_init(dgap_init_module);
 
 /*
  * Start of driver.
@@ -580,27 +568,27 @@ static int dgap_start(void)
 
                dgap_driver_start = TRUE;
 
-               /* make sure that the globals are init'd before we do anything else */
-               dgap_init_globals();
+               /*
+                * make sure that the globals are
+                * init'd before we do anything else
+                */
+               dgap_init_globals();
 
                dgap_NumBoards = 0;
 
-               APR(("For the tools package or updated drivers please visit http://www.digi.com\n"));
+               pr_info("For the tools package please visit http://www.digi.com\n");
 
                /*
                 * Register our base character device into the kernel.
-                * This allows the download daemon to connect to the downld device
-                * before any of the boards are init'ed.
                 */
                if (!dgap_Major_Control_Registered) {
                        /*
                         * Register management/dpa devices
                         */
-                       rc = register_chrdev(DIGI_DGAP_MAJOR, "dgap", &DgapBoardFops);
-                       if (rc < 0) {
-                               APR(("Can't register dgap driver device (%d)\n", rc));
-                               return (rc);
-                       }
+                       rc = register_chrdev(DIGI_DGAP_MAJOR, "dgap",
+                                                &DgapBoardFops);
+                       if (rc < 0)
+                               return rc;
 
                        dgap_class = class_create(THIS_MODULE, "dgap_mgmt");
                        device_create(dgap_class, NULL,
@@ -614,10 +602,8 @@ static int dgap_start(void)
                 */
                rc = dgap_tty_preinit();
 
-               if (rc < 0) {
-                       APR(("tty preinit - not enough memory (%d)\n", rc));
-                       return(rc);
-               }
+               if (rc < 0)
+                       return rc;
 
                /* Start the poller */
                DGAP_LOCK(dgap_poll_lock, flags);
@@ -633,10 +619,9 @@ static int dgap_start(void)
                dgap_driver_state = DRIVER_NEED_CONFIG_LOAD;
        }
 
-       return (rc);
+       return rc;
 }
 
-
 /*
  * Register pci driver, and return how many boards we have.
  */
@@ -645,7 +630,6 @@ static int dgap_init_pci(void)
        return pci_register_driver(&dgap_driver);
 }
 
-
 /* returns count (>= 0), or negative on error */
 static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
@@ -660,32 +644,28 @@ static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                rc = dgap_probe1(pdev, ent->driver_data);
                if (rc == 0) {
                        dgap_NumBoards++;
-                       DPR_INIT(("Incrementing numboards to %d\n", dgap_NumBoards));
                        rc = dgap_firmware_load(pdev, ent->driver_data);
                }
        }
        return rc;
 }
 
-
 static int dgap_probe1(struct pci_dev *pdev, int card_type)
 {
        return dgap_found_board(pdev, card_type);
 }
 
-
 static void dgap_remove_one(struct pci_dev *dev)
 {
        /* Do Nothing */
 }
 
-
 /*
  * dgap_cleanup_module()
  *
  * Module unload.  This is where it all ends.
  */
-void dgap_cleanup_module(void)
+static void dgap_cleanup_module(void)
 {
        int i;
        ulong lock_flags;
@@ -695,7 +675,7 @@ void dgap_cleanup_module(void)
        DGAP_UNLOCK(dgap_poll_lock, lock_flags);
 
        /* Turn off poller right away. */
-       del_timer_sync( &dgap_poll_timer);
+       del_timer_sync(&dgap_poll_timer);
 
        dgap_remove_driver_sysfiles(&dgap_driver);
 
@@ -725,7 +705,6 @@ void dgap_cleanup_module(void)
                pci_unregister_driver(&dgap_driver);
 }
 
-
 /*
  * dgap_cleanup_board()
  *
@@ -735,8 +714,8 @@ static void dgap_cleanup_board(struct board_t *brd)
 {
        int i = 0;
 
-        if(!brd || brd->magic != DGAP_BOARD_MAGIC)
-                return;
+       if (!brd || brd->magic != DGAP_BOARD_MAGIC)
+               return;
 
        if (brd->intr_used && brd->irq)
                free_irq(brd->irq, brd);
@@ -755,34 +734,18 @@ static void dgap_cleanup_board(struct board_t *brd)
                brd->re_map_membase = NULL;
        }
 
-        if (brd->msgbuf_head) {
-                unsigned long flags;
-
-                DGAP_LOCK(dgap_global_lock, flags);
-                brd->msgbuf = NULL;
-                printk("%s", brd->msgbuf_head);
-                kfree(brd->msgbuf_head);
-                brd->msgbuf_head = NULL;
-                DGAP_UNLOCK(dgap_global_lock, flags);
-        }
-
        /* Free all allocated channels structs */
-       for (i = 0; i < MAXPORTS ; i++) {
-               if (brd->channels[i]) {
-                       kfree(brd->channels[i]);
-                       brd->channels[i] = NULL;
-               }
-       }
+       for (i = 0; i < MAXPORTS ; i++)
+               kfree(brd->channels[i]);
 
        kfree(brd->flipbuf);
        kfree(brd->flipflagbuf);
 
        dgap_Board[brd->boardnum] = NULL;
 
-        kfree(brd);
+       kfree(brd);
 }
 
-
 /*
  * dgap_found_board()
  *
@@ -793,24 +756,13 @@ static int dgap_found_board(struct pci_dev *pdev, int id)
        struct board_t *brd;
        unsigned int pci_irq;
        int i = 0;
-       unsigned long flags;
 
        /* get the board structure and prep it */
-       brd = dgap_Board[dgap_NumBoards] =
-       (struct board_t *) kzalloc(sizeof(struct board_t), GFP_KERNEL);
-       if (!brd) {
-               APR(("memory allocation for board structure failed\n"));
-               return(-ENOMEM);
-       }
+       brd = kzalloc(sizeof(struct board_t), GFP_KERNEL);
+       if (!brd)
+               return -ENOMEM;
 
-       /* make a temporary message buffer for the boot messages */
-       brd->msgbuf = brd->msgbuf_head =
-               (char *) kzalloc(sizeof(char) * 8192, GFP_KERNEL);
-       if(!brd->msgbuf) {
-               kfree(brd);
-               APR(("memory allocation for board msgbuf failed\n"));
-               return(-ENOMEM);
-       }
+       dgap_Board[dgap_NumBoards] = brd;
 
        /* store the info for the board we've found */
        brd->magic = DGAP_BOARD_MAGIC;
@@ -836,9 +788,8 @@ static int dgap_found_board(struct pci_dev *pdev, int id)
        brd->wait_for_bios      = 0;
        brd->wait_for_fep       = 0;
 
-       for (i = 0; i < MAXPORTS; i++) {
+       for (i = 0; i < MAXPORTS; i++)
                brd->channels[i] = NULL;
-       }
 
        /* store which card & revision we have */
        pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &brd->subvendor);
@@ -851,7 +802,7 @@ static int dgap_found_board(struct pci_dev *pdev, int id)
        /* get the PCI Base Address Registers */
 
        /* Xr Jupiter and EPC use BAR 2 */
-       if (brd->device == PCI_DEVICE_XRJ_DID || brd->device == PCI_DEVICE_EPCJ_DID) {
+       if (brd->device == PCI_DEV_XRJ_DID || brd->device == PCI_DEV_EPCJ_DID) {
                brd->membase     = pci_resource_start(pdev, 2);
                brd->membase_end = pci_resource_end(pdev, 2);
        }
@@ -861,10 +812,8 @@ static int dgap_found_board(struct pci_dev *pdev, int id)
                brd->membase_end = pci_resource_end(pdev, 0);
        }
 
-       if (!brd->membase) {
-               APR(("card has no PCI IO resources, failing board.\n"));
+       if (!brd->membase)
                return -ENODEV;
-       }
 
        if (brd->membase & 1)
                brd->membase &= ~3;
@@ -880,11 +829,10 @@ static int dgap_found_board(struct pci_dev *pdev, int id)
        brd->port = brd->membase + PCI_IO_OFFSET;
        brd->port_end = brd->port + PCI_IO_SIZE;
 
-
        /*
         * Special initialization for non-PLX boards
         */
-       if (brd->device != PCI_DEVICE_XRJ_DID && brd->device != PCI_DEVICE_EPCJ_DID) {
+       if (brd->device != PCI_DEV_XRJ_DID && brd->device != PCI_DEV_EPCJ_DID) {
                unsigned short cmd;
 
                pci_write_config_byte(pdev, 0x40, 0);
@@ -903,19 +851,8 @@ static int dgap_found_board(struct pci_dev *pdev, int id)
        }
 
        /* init our poll helper tasklet */
-       tasklet_init(&brd->helper_tasklet, dgap_poll_tasklet, (unsigned long) brd);
-
-        /* Log the information about the board */
-       dgap_mbuf(brd, DRVSTR": board %d: %s (rev %d), irq %d\n",
-               dgap_NumBoards, brd->name, brd->rev, brd->irq);
-
-       DPR_INIT(("dgap_scan(%d) - printing out the msgbuf\n", i));
-       DGAP_LOCK(dgap_global_lock, flags);
-       brd->msgbuf = NULL;
-       printk("%s", brd->msgbuf_head);
-       kfree(brd->msgbuf_head);
-       brd->msgbuf_head = NULL;
-       DGAP_UNLOCK(dgap_global_lock, flags);
+       tasklet_init(&brd->helper_tasklet, dgap_poll_tasklet,
+                       (unsigned long) brd);
 
        i = dgap_do_remap(brd);
        if (i)
@@ -923,20 +860,16 @@ static int dgap_found_board(struct pci_dev *pdev, int id)
        else
                brd->state = NEED_RESET;
 
-        return(0);
+       return 0;
 }
 
 
-static int dgap_finalize_board_init(struct board_t *brd) {
-
-        int rc;
-
-        DPR_INIT(("dgap_finalize_board_init() - start\n"));
+static int dgap_finalize_board_init(struct board_t *brd)
+{
+       int rc;
 
        if (!brd || brd->magic != DGAP_BOARD_MAGIC)
-                return(-ENODEV);
-
-        DPR_INIT(("dgap_finalize_board_init() - start #2\n"));
+               return -ENODEV;
 
        brd->use_interrupts = dgap_config_get_useintr(brd);
 
@@ -947,18 +880,15 @@ static int dgap_finalize_board_init(struct board_t *brd) {
 
                rc = request_irq(brd->irq, dgap_intr, IRQF_SHARED, "DGAP", brd);
 
-               if (rc) {
-                       dgap_mbuf(brd, DRVSTR": Failed to hook IRQ %d. Board will work in poll mode.\n",
-                                  brd->irq);
+               if (rc)
                        brd->intr_used = 0;
-               }
                else
                        brd->intr_used = 1;
        } else {
                brd->intr_used = 0;
        }
 
-       return(0);
+       return 0;
 }
 
 static int dgap_firmware_load(struct pci_dev *pdev, int card_type)
@@ -1094,11 +1024,12 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type)
        ret = dgap_tty_init(brd);
        if (ret < 0) {
                dgap_tty_uninit(brd);
-               pr_err("dgap: Can't init tty devices (%d)\n", ret);
                return ret;
        }
 
-       dgap_sysfs_create(brd);
+       ret = dgap_tty_register_ports(brd);
+       if (ret)
+               return ret;
 
        brd->state = BOARD_READY;
        brd->dpastatus = BD_RUNNING;
@@ -1114,21 +1045,17 @@ static int dgap_do_remap(struct board_t *brd)
        if (!brd || brd->magic != DGAP_BOARD_MAGIC)
                return -ENXIO;
 
-       if (!request_mem_region(brd->membase, 0x200000, "dgap")) {
-               APR(("dgap: mem_region %lx already in use.\n", brd->membase));
+       if (!request_mem_region(brd->membase, 0x200000, "dgap"))
                return -ENOMEM;
-        }
 
-       if (!request_mem_region(brd->membase + PCI_IO_OFFSET, 0x200000, "dgap")) {
-               APR(("dgap: mem_region IO %lx already in use.\n",
-                       brd->membase + PCI_IO_OFFSET));
+       if (!request_mem_region(brd->membase + PCI_IO_OFFSET, 0x200000,
+                                       "dgap")) {
                release_mem_region(brd->membase, 0x200000);
                return -ENOMEM;
-        }
+       }
 
        brd->re_map_membase = ioremap(brd->membase, 0x200000);
        if (!brd->re_map_membase) {
-               APR(("dgap: ioremap mem %lx cannot be mapped.\n", brd->membase));
                release_mem_region(brd->membase, 0x200000);
                release_mem_region(brd->membase + PCI_IO_OFFSET, 0x200000);
                return -ENOMEM;
@@ -1139,17 +1066,12 @@ static int dgap_do_remap(struct board_t *brd)
                release_mem_region(brd->membase, 0x200000);
                release_mem_region(brd->membase + PCI_IO_OFFSET, 0x200000);
                iounmap(brd->re_map_membase);
-               APR(("dgap: ioremap IO mem %lx cannot be mapped.\n",
-                       brd->membase + PCI_IO_OFFSET));
                return -ENOMEM;
        }
 
-       DPR_INIT(("remapped io: 0x%p  remapped mem: 0x%p\n",
-               brd->re_map_port, brd->re_map_membase));
        return 0;
 }
 
-
 /*****************************************************************************
 *
 * Function:
@@ -1179,13 +1101,12 @@ static int dgap_do_remap(struct board_t *brd)
 static void dgap_poll_handler(ulong dummy)
 {
        int i;
-        struct board_t *brd;
-        unsigned long lock_flags;
+       struct board_t *brd;
+       unsigned long lock_flags;
        ulong new_time;
 
        dgap_poll_counter++;
 
-
        /*
         * Do not start the board state machine until
         * driver tells us its up and running, and has
@@ -1200,46 +1121,49 @@ static void dgap_poll_handler(ulong dummy)
         * Otherwise, use our new tasklet based poller, which should
         * speed things up for multiple boards.
         */
-       if ( (dgap_NumBoards == 1) || (num_online_cpus() <= 1) ) {
+       if ((dgap_NumBoards == 1) || (num_online_cpus() <= 1)) {
                for (i = 0; i < dgap_NumBoards; i++) {
 
                        brd = dgap_Board[i];
 
-                       if (brd->state == BOARD_FAILED) {
+                       if (brd->state == BOARD_FAILED)
                                continue;
-                       }
-                       if (!brd->intr_running) {
+                       if (!brd->intr_running)
                                /* Call the real board poller directly */
                                dgap_poll_tasklet((unsigned long) brd);
-                       }
                }
-       }
-       else {
-               /* Go thru each board, kicking off a tasklet for each if needed */
+       } else {
+               /*
+                * Go thru each board, kicking off a
+                * tasklet for each if needed
+                */
                for (i = 0; i < dgap_NumBoards; i++) {
                        brd = dgap_Board[i];
 
                        /*
                         * Attempt to grab the board lock.
                         *
-                        * If we can't get it, no big deal, the next poll will get it.
-                        * Basically, I just really don't want to spin in here, because I want
-                        * to kick off my tasklets as fast as I can, and then get out the poller.
+                        * If we can't get it, no big deal, the next poll
+                        * will get it. Basically, I just really don't want
+                        * to spin in here, because I want to kick off my
+                        * tasklets as fast as I can, and then get out the
+                        * poller.
                         */
-                       if (!spin_trylock(&brd->bd_lock)) {
+                       if (!spin_trylock(&brd->bd_lock))
                                continue;
-                       }
 
-                       /* If board is in a failed state, don't bother scheduling a tasklet */
+                       /*
+                        * If board is in a failed state, don't bother
+                        *  scheduling a tasklet
+                        */
                        if (brd->state == BOARD_FAILED) {
                                spin_unlock(&brd->bd_lock);
                                continue;
                        }
 
                        /* Schedule a poll helper task */
-                       if (!brd->intr_running) {
+                       if (!brd->intr_running)
                                tasklet_schedule(&brd->helper_tasklet);
-                       }
 
                        /*
                         * Can't do DGAP_UNLOCK here, as we don't have
@@ -1254,27 +1178,25 @@ schedule_poller:
        /*
         * Schedule ourself back at the nominal wakeup interval.
         */
-       DGAP_LOCK(dgap_poll_lock, lock_flags );
+       DGAP_LOCK(dgap_poll_lock, lock_flags);
        dgap_poll_time +=  dgap_jiffies_from_ms(dgap_poll_tick);
 
        new_time = dgap_poll_time - jiffies;
 
        if ((ulong) new_time >= 2 * dgap_poll_tick) {
-               dgap_poll_time = jiffies +  dgap_jiffies_from_ms(dgap_poll_tick);
+               dgap_poll_time =
+                       jiffies +  dgap_jiffies_from_ms(dgap_poll_tick);
        }
 
        dgap_poll_timer.function = dgap_poll_handler;
        dgap_poll_timer.data = 0;
        dgap_poll_timer.expires = dgap_poll_time;
-       DGAP_UNLOCK(dgap_poll_lock, lock_flags );
+       DGAP_UNLOCK(dgap_poll_lock, lock_flags);
 
        if (!dgap_poll_stop)
                add_timer(&dgap_poll_timer);
 }
 
-
-
-
 /*
  * dgap_intr()
  *
@@ -1284,18 +1206,14 @@ static irqreturn_t dgap_intr(int irq, void *voidbrd)
 {
        struct board_t *brd = (struct board_t *) voidbrd;
 
-       if (!brd) {
-               APR(("Received interrupt (%d) with null board associated\n", irq));
+       if (!brd)
                return IRQ_NONE;
-       }
 
        /*
         * Check to make sure its for us.
         */
-       if (brd->magic != DGAP_BOARD_MAGIC) {
-               APR(("Received interrupt (%d) with a board pointer that wasn't ours!\n", irq));
+       if (brd->magic != DGAP_BOARD_MAGIC)
                return IRQ_NONE;
-       }
 
        brd->intr_count++;
 
@@ -1306,7 +1224,6 @@ static irqreturn_t dgap_intr(int irq, void *voidbrd)
        return IRQ_HANDLED;
 }
 
-
 /*
  * dgap_init_globals()
  *
@@ -1318,65 +1235,21 @@ static void dgap_init_globals(void)
 {
        int i = 0;
 
-       dgap_rawreadok          = rawreadok;
-        dgap_trcbuf_size       = trcbuf_size;
-       dgap_debug              = debug;
-
-       for (i = 0; i < MAXBOARDS; i++) {
+       for (i = 0; i < MAXBOARDS; i++)
                dgap_Board[i] = NULL;
-       }
 
-       init_timer( &dgap_poll_timer );
+       init_timer(&dgap_poll_timer);
 
        init_waitqueue_head(&dgap_dl_wait);
        dgap_dl_action = 0;
 }
 
-
 /************************************************************************
  *
  * Utility functions
  *
  ************************************************************************/
 
-
-/*
- * dgap_mbuf()
- *
- * Used to print to the message buffer during board init.
- */
-static void dgap_mbuf(struct board_t *brd, const char *fmt, ...) {
-       va_list         ap;
-       char            buf[1024];
-       int             i;
-       unsigned long   flags;
-       size_t          length;
-
-       DGAP_LOCK(dgap_global_lock, flags);
-
-       /* Format buf using fmt and arguments contained in ap. */
-       va_start(ap, fmt);
-       i = vsnprintf(buf, sizeof(buf), fmt,  ap);
-       va_end(ap);
-
-       DPR((buf));
-
-       if (!brd || !brd->msgbuf) {
-               printk("%s", buf);
-               DGAP_UNLOCK(dgap_global_lock, flags);
-               return;
-       }
-
-       length = strlen(buf) + 1;
-       if (brd->msgbuf - brd->msgbuf_head < length)
-               length = brd->msgbuf - brd->msgbuf_head;
-       memcpy(brd->msgbuf, buf, length);
-       brd->msgbuf += length;
-
-       DGAP_UNLOCK(dgap_global_lock, flags);
-}
-
-
 /*
  * dgap_ms_sleep()
  *
@@ -1388,12 +1261,9 @@ static int dgap_ms_sleep(ulong ms)
 {
        current->state = TASK_INTERRUPTIBLE;
        schedule_timeout((ms * HZ) / 1000);
-       return (signal_pending(current));
+       return signal_pending(current);
 }
 
-
-
-
 /************************************************************************
  *
  * TTY Initialization/Cleanup Functions
@@ -1407,10 +1277,6 @@ static int dgap_ms_sleep(ulong ms)
  */
 static int dgap_tty_preinit(void)
 {
-       unsigned long flags;
-
-       DGAP_LOCK(dgap_global_lock, flags);
-
        /*
         * Allocate a buffer for doing the copy from user space to
         * kernel space in dgap_input().  We only use one buffer and
@@ -1419,17 +1285,12 @@ static int dgap_tty_preinit(void)
         */
        dgap_TmpWriteBuf = kmalloc(WRITEBUFLEN, GFP_ATOMIC);
 
-       if (!dgap_TmpWriteBuf) {
-               DGAP_UNLOCK(dgap_global_lock, flags);
-               DPR_INIT(("unable to allocate tmp write buf"));
-               return (-ENOMEM);
-       }
+       if (!dgap_TmpWriteBuf)
+               return -ENOMEM;
 
-        DGAP_UNLOCK(dgap_global_lock, flags);
-        return(0);
+       return 0;
 }
 
-
 /*
  * dgap_tty_register()
  *
@@ -1439,8 +1300,6 @@ static int dgap_tty_register(struct board_t *brd)
 {
        int rc = 0;
 
-       DPR_INIT(("tty_register start"));
-
        brd->SerialDriver = alloc_tty_driver(MAXPORTS);
 
        snprintf(brd->SerialName, MAXTTYNAMELEN, "tty_dgap_%d_", brd->boardnum);
@@ -1452,12 +1311,15 @@ static int dgap_tty_register(struct board_t *brd)
        brd->SerialDriver->subtype = SERIAL_TYPE_NORMAL;
        brd->SerialDriver->init_termios = DgapDefaultTermios;
        brd->SerialDriver->driver_name = DRVSTR;
-       brd->SerialDriver->flags = (TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_HARDWARE_BREAK);
+       brd->SerialDriver->flags = (TTY_DRIVER_REAL_RAW |
+                                   TTY_DRIVER_DYNAMIC_DEV |
+                                   TTY_DRIVER_HARDWARE_BREAK);
 
        /* The kernel wants space to store pointers to tty_structs */
-       brd->SerialDriver->ttys = kzalloc(MAXPORTS * sizeof(struct tty_struct *), GFP_KERNEL);
+       brd->SerialDriver->ttys =
+               kzalloc(MAXPORTS * sizeof(struct tty_struct *), GFP_KERNEL);
        if (!brd->SerialDriver->ttys)
-               return(-ENOMEM);
+               return -ENOMEM;
 
        /*
         * Entry points for driver.  Called by the kernel from
@@ -1481,12 +1343,15 @@ static int dgap_tty_register(struct board_t *brd)
        brd->PrintDriver->subtype = SERIAL_TYPE_NORMAL;
        brd->PrintDriver->init_termios = DgapDefaultTermios;
        brd->PrintDriver->driver_name = DRVSTR;
-       brd->PrintDriver->flags = (TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_HARDWARE_BREAK);
+       brd->PrintDriver->flags = (TTY_DRIVER_REAL_RAW |
+                                  TTY_DRIVER_DYNAMIC_DEV |
+                                  TTY_DRIVER_HARDWARE_BREAK);
 
        /* The kernel wants space to store pointers to tty_structs */
-       brd->PrintDriver->ttys = kzalloc(MAXPORTS * sizeof(struct tty_struct *), GFP_KERNEL);
+       brd->PrintDriver->ttys =
+               kzalloc(MAXPORTS * sizeof(struct tty_struct *), GFP_KERNEL);
        if (!brd->PrintDriver->ttys)
-               return(-ENOMEM);
+               return -ENOMEM;
 
        /*
         * Entry points for driver.  Called by the kernel from
@@ -1497,10 +1362,8 @@ static int dgap_tty_register(struct board_t *brd)
        if (!brd->dgap_Major_Serial_Registered) {
                /* Register tty devices */
                rc = tty_register_driver(brd->SerialDriver);
-               if (rc < 0) {
-                       APR(("Can't register tty device (%d)\n", rc));
-                       return(rc);
-               }
+               if (rc < 0)
+                       return rc;
                brd->dgap_Major_Serial_Registered = TRUE;
                dgap_BoardsByMajor[brd->SerialDriver->major] = brd;
                brd->dgap_Serial_Major = brd->SerialDriver->major;
@@ -1508,23 +1371,17 @@ static int dgap_tty_register(struct board_t *brd)
 
        if (!brd->dgap_Major_TransparentPrint_Registered) {
                /* Register Transparent Print devices */
-               rc = tty_register_driver(brd->PrintDriver);
-               if (rc < 0) {
-                       APR(("Can't register Transparent Print device (%d)\n", rc));
-                       return(rc);
-               }
+               rc = tty_register_driver(brd->PrintDriver);
+               if (rc < 0)
+                       return rc;
                brd->dgap_Major_TransparentPrint_Registered = TRUE;
                dgap_BoardsByMajor[brd->PrintDriver->major] = brd;
                brd->dgap_TransparentPrint_Major = brd->PrintDriver->major;
        }
 
-       DPR_INIT(("DGAP REGISTER TTY: MAJORS: %d %d\n", brd->SerialDriver->major,
-               brd->PrintDriver->major));
-
-       return (rc);
+       return rc;
 }
 
-
 /*
  * dgap_tty_init()
  *
@@ -1543,9 +1400,7 @@ static int dgap_tty_init(struct board_t *brd)
        struct cm_t *cm;
 
        if (!brd)
-               return (-ENXIO);
-
-       DPR_INIT(("dgap_tty_init start\n"));
+               return -ENXIO;
 
        /*
         * Initialize board structure elements.
@@ -1556,27 +1411,26 @@ static int dgap_tty_init(struct board_t *brd)
 
        brd->nasync = dgap_config_get_number_of_ports(brd);
 
-       if (!brd->nasync) {
+       if (!brd->nasync)
                brd->nasync = brd->maxports;
-       }
 
-       if (brd->nasync > brd->maxports) {
+       if (brd->nasync > brd->maxports)
                brd->nasync = brd->maxports;
-       }
 
        if (true_count != brd->nasync) {
                if ((brd->type == PPCM) && (true_count == 64)) {
-                       APR(("***WARNING**** %s configured for %d ports, has %d ports.\nPlease make SURE the EBI cable running from the card\nto each EM module is plugged into EBI IN!\n",
-                               brd->name, brd->nasync, true_count));
-               }
-               else if ((brd->type == PPCM) && (true_count == 0)) {
-                       APR(("***WARNING**** %s configured for %d ports, has %d ports.\nPlease make SURE the EBI cable running from the card\nto each EM module is plugged into EBI IN!\n",
-                               brd->name, brd->nasync, true_count));
-               }
-               else {
-                       APR(("***WARNING**** %s configured for %d ports, has %d ports.\n",
-                               brd->name, brd->nasync, true_count));
-               }
+                       pr_warn("dgap: %s configured for %d ports, has %d ports.\n",
+                               brd->name, brd->nasync, true_count);
+                       pr_warn("dgap: Please make SURE the EBI cable running from the card\n");
+                       pr_warn("dgap: to each EM module is plugged into EBI IN!\n");
+               } else if ((brd->type == PPCM) && (true_count == 0)) {
+                       pr_warn("dgap: %s configured for %d ports, has %d ports.\n",
+                               brd->name, brd->nasync, true_count);
+                       pr_warn("dgap: Please make SURE the EBI cable running from the card\n");
+                       pr_warn("dgap: to each EM module is plugged into EBI IN!\n");
+               } else
+                       pr_warn("dgap: %s configured for %d ports, has %d ports.\n",
+                               brd->name, brd->nasync, true_count);
 
                brd->nasync = true_count;
 
@@ -1584,7 +1438,7 @@ static int dgap_tty_init(struct board_t *brd)
                if (!brd->nasync) {
                        brd->state = BOARD_FAILED;
                        brd->dpastatus = BD_NOFEP;
-                       return(-ENXIO);
+                       return -ENXIO;
                }
        }
 
@@ -1594,11 +1448,10 @@ static int dgap_tty_init(struct board_t *brd)
         */
        for (i = 0; i < brd->nasync; i++) {
                if (!brd->channels[i]) {
-                       brd->channels[i] = kzalloc(sizeof(struct channel_t), GFP_ATOMIC);
-                       if (!brd->channels[i]) {
-                               DPR_CORE(("%s:%d Unable to allocate memory for channel struct\n",
-                                   __FILE__, __LINE__));
-                       }
+                       brd->channels[i] =
+                               kzalloc(sizeof(struct channel_t), GFP_ATOMIC);
+                       if (!brd->channels[i])
+                               return -ENOMEM;
                }
        }
 
@@ -1644,8 +1497,7 @@ static int dgap_tty_init(struct board_t *brd)
                        ch->ch_dsr      = DM_CD;
                        ch->ch_cd       = DM_DSR;
                        ch->ch_digi.digi_flags |= DIGI_ALTPIN;
-               }
-               else {
+               } else {
                        ch->ch_cd       = DM_CD;
                        ch->ch_dsr      = DM_DSR;
                }
@@ -1666,7 +1518,9 @@ static int dgap_tty_init(struct board_t *brd)
                 * Set queue water marks, interrupt mask,
                 * and general tty parameters.
                 */
-               ch->ch_tlw = tlw = ch->ch_tsize >= 2000 ? ((ch->ch_tsize * 5) / 8) : ch->ch_tsize / 2;
+               tlw = ch->ch_tsize >= 2000 ? ((ch->ch_tsize * 5) / 8) :
+                                               ch->ch_tsize / 2;
+               ch->ch_tlw = tlw;
 
                dgap_cmdw(ch, STLOW, tlw, 0);
 
@@ -1697,13 +1551,9 @@ static int dgap_tty_init(struct board_t *brd)
                writeb(1, &(ch->ch_bs->idata));
        }
 
-
-       DPR_INIT(("dgap_tty_init finish\n"));
-
-       return (0);
+       return 0;
 }
 
-
 /*
  * dgap_tty_post_uninit()
  *
@@ -1715,7 +1565,6 @@ static void dgap_tty_post_uninit(void)
        dgap_TmpWriteBuf = NULL;
 }
 
-
 /*
  * dgap_tty_uninit()
  *
@@ -1730,6 +1579,7 @@ static void dgap_tty_uninit(struct board_t *brd)
                dgap_BoardsByMajor[brd->SerialDriver->major] = NULL;
                brd->dgap_Serial_Major = 0;
                for (i = 0; i < brd->nasync; i++) {
+                       tty_port_destroy(&brd->SerialPorts[i]);
                        dgap_remove_tty_sysfs(brd->channels[i]->ch_tun.un_sysfs);
                        tty_unregister_device(brd->SerialDriver, i);
                }
@@ -1737,6 +1587,7 @@ static void dgap_tty_uninit(struct board_t *brd)
                kfree(brd->SerialDriver->ttys);
                brd->SerialDriver->ttys = NULL;
                put_tty_driver(brd->SerialDriver);
+               kfree(brd->SerialPorts);
                brd->dgap_Major_Serial_Registered = FALSE;
        }
 
@@ -1744,6 +1595,7 @@ static void dgap_tty_uninit(struct board_t *brd)
                dgap_BoardsByMajor[brd->PrintDriver->major] = NULL;
                brd->dgap_TransparentPrint_Major = 0;
                for (i = 0; i < brd->nasync; i++) {
+                       tty_port_destroy(&brd->PrinterPorts[i]);
                        dgap_remove_tty_sysfs(brd->channels[i]->ch_pun.un_sysfs);
                        tty_unregister_device(brd->PrintDriver, i);
                }
@@ -1751,13 +1603,12 @@ static void dgap_tty_uninit(struct board_t *brd)
                kfree(brd->PrintDriver->ttys);
                brd->PrintDriver->ttys = NULL;
                put_tty_driver(brd->PrintDriver);
+               kfree(brd->PrinterPorts);
                brd->dgap_Major_TransparentPrint_Registered = FALSE;
        }
 }
 
-
 #define TMPBUFLEN (1024)
-
 /*
  * dgap_sniff - Dump data out to the "sniff" buffer if the
  * proc sniff file is opened...
@@ -1822,9 +1673,8 @@ static void dgap_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *b
                         * We *cannot* sleep here waiting for space, because this
                         * function was probably called by the interrupt/timer routines!
                         */
-                       if (n == 0) {
+                       if (n == 0)
                                return;
-                       }
 
                        /*
                         * Copy as much data as will fit.
@@ -1871,7 +1721,6 @@ static void dgap_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *b
        } while (too_much_data);
 }
 
-
 /*=======================================================================
  *
  *      dgap_input - Process received data.
@@ -1905,16 +1754,13 @@ static void dgap_input(struct channel_t *ch)
        tp = ch->ch_tun.un_tty;
 
        bs  = ch->ch_bs;
-       if (!bs) {
+       if (!bs)
                return;
-       }
 
        bd = ch->ch_bd;
-       if(!bd || bd->magic != DGAP_BOARD_MAGIC)
+       if (!bd || bd->magic != DGAP_BOARD_MAGIC)
                return;
 
-       DPR_READ(("dgap_input start\n"));
-
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
 
@@ -1936,7 +1782,6 @@ static void dgap_input(struct channel_t *ch)
                writeb(1, &(bs->idata));
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               DPR_READ(("No data on port %d\n", ch->ch_portnum));
                return;
        }
 
@@ -1944,13 +1789,12 @@ static void dgap_input(struct channel_t *ch)
         * If the device is not open, or CREAD is off, flush
         * input data and return immediately.
         */
-       if ((bd->state != BOARD_READY) || !tp  || (tp->magic != TTY_MAGIC) ||
-            !(ch->ch_tun.un_flags & UN_ISOPEN) || !(tp->termios.c_cflag & CREAD) ||
+       if ((bd->state != BOARD_READY) || !tp  ||
+           (tp->magic != TTY_MAGIC) ||
+           !(ch->ch_tun.un_flags & UN_ISOPEN) ||
+           !(tp->termios.c_cflag & CREAD) ||
            (ch->ch_tun.un_flags & UN_CLOSING)) {
 
-               DPR_READ(("input. dropping %d bytes on port %d...\n", data_len, ch->ch_portnum));
-               DPR_READ(("input. tp: %p tp->magic: %x MAGIC:%x ch flags: %x\n",
-                       tp, tp ? tp->magic : 0, TTY_MAGIC, ch->ch_tun.un_flags));
                writew(head, &(bs->rx_tail));
                writeb(1, &(bs->idata));
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
@@ -1965,8 +1809,6 @@ static void dgap_input(struct channel_t *ch)
                writeb(1, &(bs->idata));
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               DPR_READ(("Port %d throttled, not reading any data. head: %x tail: %x\n",
-                       ch->ch_portnum, head, tail));
                return;
        }
 
@@ -1979,8 +1821,6 @@ static void dgap_input(struct channel_t *ch)
                writeb(0, &(bs->orun));
        }
 
-       DPR_READ(("dgap_input start 2\n"));
-
        /* Decide how much data we can send into the tty layer */
        flip_len = TTY_FLIPBUF_SIZE;
 
@@ -2022,7 +1862,6 @@ static void dgap_input(struct channel_t *ch)
                writeb(1, &(bs->idata));
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               DPR_READ(("dgap_input 1 - finish\n"));
                if (ld)
                        tty_ldisc_deref(ld);
                return;
@@ -2074,8 +1913,7 @@ static void dgap_input(struct channel_t *ch)
                len = tty_buffer_request_room(tp->port, len);
                tty_insert_flip_string_flags(tp->port, ch->ch_bd->flipbuf,
                        ch->ch_bd->flipflagbuf, len);
-       }
-       else {
+       } else {
                len = tty_buffer_request_room(tp->port, len);
                tty_insert_flip_string(tp->port, ch->ch_bd->flipbuf, len);
        }
@@ -2089,10 +1927,8 @@ static void dgap_input(struct channel_t *ch)
        if (ld)
                tty_ldisc_deref(ld);
 
-       DPR_READ(("dgap_input - finish\n"));
 }
 
-
 /************************************************************************
  * Determines when CARRIER changes state and takes appropriate
  * action.
@@ -2101,10 +1937,8 @@ static void dgap_carrier(struct channel_t *ch)
 {
        struct board_t *bd;
 
-        int virt_carrier = 0;
-        int phys_carrier = 0;
-
-       DPR_CARR(("dgap_carrier called...\n"));
+       int virt_carrier = 0;
+       int phys_carrier = 0;
 
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
                return;
@@ -2118,27 +1952,19 @@ static void dgap_carrier(struct channel_t *ch)
        if (ch->ch_digi.digi_flags & DIGI_ALTPIN) {
                ch->ch_dsr      = DM_CD;
                ch->ch_cd       = DM_DSR;
-       }
-       else {
+       } else {
                ch->ch_dsr      = DM_DSR;
                ch->ch_cd       = DM_CD;
        }
 
-       if (ch->ch_mistat & D_CD(ch)) {
-               DPR_CARR(("mistat: %x  D_CD: %x\n", ch->ch_mistat, D_CD(ch)));
+       if (ch->ch_mistat & D_CD(ch))
                phys_carrier = 1;
-       }
 
-       if (ch->ch_digi.digi_flags & DIGI_FORCEDCD) {
+       if (ch->ch_digi.digi_flags & DIGI_FORCEDCD)
                virt_carrier = 1;
-       }
 
-       if (ch->ch_c_cflag & CLOCAL) {
+       if (ch->ch_c_cflag & CLOCAL)
                virt_carrier = 1;
-       }
-
-
-       DPR_CARR(("DCD: physical: %d virt: %d\n", phys_carrier, virt_carrier));
 
        /*
         * Test for a VIRTUAL carrier transition to HIGH.
@@ -2150,8 +1976,6 @@ static void dgap_carrier(struct channel_t *ch)
                 * for carrier in the open routine.
                 */
 
-               DPR_CARR(("carrier: virt DCD rose\n"));
-
                if (waitqueue_active(&(ch->ch_flags_wait)))
                        wake_up_interruptible(&ch->ch_flags_wait);
        }
@@ -2166,8 +1990,6 @@ static void dgap_carrier(struct channel_t *ch)
                 * for carrier in the open routine.
                 */
 
-               DPR_CARR(("carrier: physical DCD rose\n"));
-
                if (waitqueue_active(&(ch->ch_flags_wait)))
                        wake_up_interruptible(&ch->ch_flags_wait);
        }
@@ -2181,9 +2003,9 @@ static void dgap_carrier(struct channel_t *ch)
         *  matter... it really only means "ignore carrier state", not
         *  "make pretend that carrier is there".
         */
-       if ((virt_carrier == 0) && ((ch->ch_flags & CH_CD) != 0) &&
-           (phys_carrier == 0))
-       {
+       if ((virt_carrier == 0) &&
+           ((ch->ch_flags & CH_CD) != 0) &&
+           (phys_carrier == 0)) {
 
                /*
                 *   When carrier drops:
@@ -2200,15 +2022,11 @@ static void dgap_carrier(struct channel_t *ch)
                if (waitqueue_active(&(ch->ch_flags_wait)))
                        wake_up_interruptible(&ch->ch_flags_wait);
 
-               if (ch->ch_tun.un_open_count > 0) {
-                       DPR_CARR(("Sending tty hangup\n"));
+               if (ch->ch_tun.un_open_count > 0)
                        tty_hangup(ch->ch_tun.un_tty);
-               }
 
-               if (ch->ch_pun.un_open_count > 0) {
-                       DPR_CARR(("Sending pr hangup\n"));
+               if (ch->ch_pun.un_open_count > 0)
                        tty_hangup(ch->ch_pun.un_tty);
-               }
        }
 
        /*
@@ -2225,7 +2043,6 @@ static void dgap_carrier(struct channel_t *ch)
                ch->ch_flags &= ~CH_CD;
 }
 
-
 /************************************************************************
  *
  * TTY Entry points and helper functions
@@ -2254,15 +2071,13 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)
        major = MAJOR(tty_devnum(tty));
        minor = MINOR(tty_devnum(tty));
 
-       if (major > 255) {
+       if (major > 255)
                return -ENXIO;
-       }
 
        /* Get board pointer from our array of majors we have allocated */
        brd = dgap_BoardsByMajor[major];
-       if (!brd) {
+       if (!brd)
                return -ENXIO;
-       }
 
        /*
         * If board is not yet up to a state of READY, go to
@@ -2271,9 +2086,8 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)
        rc = wait_event_interruptible(brd->state_wait,
                (brd->state & BOARD_READY));
 
-       if (rc) {
+       if (rc)
                return rc;
-       }
 
        DGAP_LOCK(brd->bd_lock, lock_flags);
 
@@ -2302,24 +2116,18 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)
        if (major == brd->dgap_Serial_Major) {
                un = &brd->channels[minor]->ch_tun;
                un->un_type = DGAP_SERIAL;
-       }
-       else if (major == brd->dgap_TransparentPrint_Major) {
+       } else if (major == brd->dgap_TransparentPrint_Major) {
                un = &brd->channels[minor]->ch_pun;
                un->un_type = DGAP_PRINT;
-       }
-       else {
+       } else {
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(brd->bd_lock, lock_flags);
-               DPR_OPEN(("%d Unknown TYPE!\n", __LINE__));
                return -ENXIO;
        }
 
        /* Store our unit into driver_data, so we always have it available. */
        tty->driver_data = un;
 
-       DPR_OPEN(("Open called. MAJOR: %d MINOR:%d unit: %p NAME: %s\n",
-               MAJOR(tty_devnum(tty)), MINOR(tty_devnum(tty)), un, brd->name));
-
        /*
         * Error if channel info pointer is NULL.
         */
@@ -2327,11 +2135,8 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)
        if (!bs) {
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(brd->bd_lock, lock_flags);
-               DPR_OPEN(("%d BS is 0!\n", __LINE__));
                return -ENXIO;
-        }
-
-       DPR_OPEN(("%d: tflag=%x  pflag=%x\n", __LINE__, ch->ch_tun.un_flags, ch->ch_pun.un_flags));
+       }
 
        /*
         * Initialize tty's
@@ -2348,8 +2153,6 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)
         */
        if (!((ch->ch_tun.un_flags | ch->ch_pun.un_flags) & UN_ISOPEN)) {
 
-               DPR_OPEN(("dgap_open: initializing channel in open...\n"));
-
                ch->ch_mforce = 0;
                ch->ch_mval = 0;
 
@@ -2388,14 +2191,8 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)
 
        rc = dgap_block_til_ready(tty, file, ch);
 
-       if (!un->un_tty) {
+       if (!un->un_tty)
                return -ENODEV;
-       }
-
-       if (rc) {
-               DPR_OPEN(("dgap_tty_open returning after dgap_block_til_ready "
-                       "with %d\n", rc));
-       }
 
        /* No going back now, increment our unit and channel counters */
        DGAP_LOCK(ch->ch_lock, lock_flags);
@@ -2404,11 +2201,9 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)
        un->un_flags |= (UN_ISOPEN);
        DGAP_UNLOCK(ch->ch_lock, lock_flags);
 
-       DPR_OPEN(("dgap_tty_open finished\n"));
-       return (rc);
+       return rc;
 }
 
-
 /*
  * dgap_block_til_ready()
  *
@@ -2422,16 +2217,13 @@ static int dgap_block_til_ready(struct tty_struct *tty, struct file *file, struc
        uint    old_flags = 0;
        int sleep_on_un_flags = 0;
 
-       if (!tty || tty->magic != TTY_MAGIC || !file || !ch || ch->magic != DGAP_CHANNEL_MAGIC) {
-               return (-ENXIO);
-       }
+       if (!tty || tty->magic != TTY_MAGIC || !file || !ch ||
+               ch->magic != DGAP_CHANNEL_MAGIC)
+               return -ENXIO;
 
        un = tty->driver_data;
-       if (!un || un->magic != DGAP_UNIT_MAGIC) {
-               return (-ENXIO);
-       }
-
-       DPR_OPEN(("dgap_block_til_ready - before block.\n"));
+       if (!un || un->magic != DGAP_UNIT_MAGIC)
+               return -ENXIO;
 
        DGAP_LOCK(ch->ch_lock, lock_flags);
 
@@ -2472,25 +2264,18 @@ static int dgap_block_til_ready(struct tty_struct *tty, struct file *file, struc
                         * 3) DCD (fake or real) is active.
                         */
 
-                       if (file->f_flags & O_NONBLOCK) {
+                       if (file->f_flags & O_NONBLOCK)
                                break;
-                       }
 
-                       if (tty->flags & (1 << TTY_IO_ERROR)) {
+                       if (tty->flags & (1 << TTY_IO_ERROR))
                                break;
-                       }
 
-                       if (ch->ch_flags & CH_CD) {
-                               DPR_OPEN(("%d: ch_flags: %x\n", __LINE__, ch->ch_flags));
+                       if (ch->ch_flags & CH_CD)
                                break;
-                       }
 
-                       if (ch->ch_flags & CH_FCAR) {
-                               DPR_OPEN(("%d: ch_flags: %x\n", __LINE__, ch->ch_flags));
+                       if (ch->ch_flags & CH_FCAR)
                                break;
-                       }
-               }
-               else {
+               } else {
                        sleep_on_un_flags = 1;
                }
 
@@ -2500,13 +2285,10 @@ static int dgap_block_til_ready(struct tty_struct *tty, struct file *file, struc
                 * Leave loop with error set.
                 */
                if (signal_pending(current)) {
-                       DPR_OPEN(("%d: signal pending...\n", __LINE__));
                        retval = -ERESTARTSYS;
                        break;
                }
 
-               DPR_OPEN(("dgap_block_til_ready - blocking.\n"));
-
                /*
                 * Store the flags before we let go of channel lock
                 */
@@ -2523,23 +2305,17 @@ static int dgap_block_til_ready(struct tty_struct *tty, struct file *file, struc
 
                DGAP_UNLOCK(ch->ch_lock, lock_flags);
 
-               DPR_OPEN(("Going to sleep on %s flags...\n",
-                       (sleep_on_un_flags ? "un" : "ch")));
-
                /*
                 * Wait for something in the flags to change from the current value.
                 */
                if (sleep_on_un_flags) {
                        retval = wait_event_interruptible(un->un_flags_wait,
                                (old_flags != (ch->ch_tun.un_flags | ch->ch_pun.un_flags)));
-               }
-               else {
+               } else {
                        retval = wait_event_interruptible(ch->ch_flags_wait,
                                (old_flags != ch->ch_flags));
                }
 
-               DPR_OPEN(("After sleep... retval: %x\n", retval));
-
                /*
                 * We got woken up for some reason.
                 * Before looping around, grab our channel lock.
@@ -2551,19 +2327,12 @@ static int dgap_block_til_ready(struct tty_struct *tty, struct file *file, struc
 
        DGAP_UNLOCK(ch->ch_lock, lock_flags);
 
-       DPR_OPEN(("dgap_block_til_ready - after blocking.\n"));
-
-       if (retval) {
-               DPR_OPEN(("dgap_block_til_ready - done. error. retval: %x\n", retval));
-               return(retval);
-       }
-
-       DPR_OPEN(("dgap_block_til_ready - done no error. jiffies: %lu\n", jiffies));
+       if (retval)
+               return retval;
 
-       return(0);
+       return 0;
 }
 
-
 /*
  * dgap_tty_hangup()
  *
@@ -2590,18 +2359,11 @@ static void dgap_tty_hangup(struct tty_struct *tty)
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
                return;
 
-       DPR_CLOSE(("dgap_hangup called. ch->ch_open_count: %d un->un_open_count: %d\n",
-               ch->ch_open_count, un->un_open_count));
-
        /* flush the transmit queues */
        dgap_tty_flush_buffer(tty);
 
-       DPR_CLOSE(("dgap_hangup finished. ch->ch_open_count: %d un->un_open_count: %d\n",
-               ch->ch_open_count, un->un_open_count));
 }
 
-
-
 /*
  * dgap_tty_close()
  *
@@ -2632,8 +2394,6 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)
 
        ts = &tty->termios;
 
-       DPR_CLOSE(("Close called\n"));
-
        DGAP_LOCK(ch->ch_lock, lock_flags);
 
        /*
@@ -2648,27 +2408,20 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)
                 * one, we've got real problems, since it means the
                 * serial port won't be shutdown.
                 */
-               APR(("tty->count is 1, un open count is %d\n", un->un_open_count));
                un->un_open_count = 1;
        }
 
-       if (--un->un_open_count < 0) {
-               APR(("bad serial port open count of %d\n", un->un_open_count));
+       if (--un->un_open_count < 0)
                un->un_open_count = 0;
-       }
 
        ch->ch_open_count--;
 
        if (ch->ch_open_count && un->un_open_count) {
-               DPR_CLOSE(("dgap_tty_close: not last close ch: %d un:%d\n",
-                       ch->ch_open_count, un->un_open_count));
-
                DGAP_UNLOCK(ch->ch_lock, lock_flags);
-                return;
-        }
+               return;
+       }
 
        /* OK, its the last close on the unit */
-       DPR_CLOSE(("dgap_tty_close - last close on unit procedures\n"));
 
        un->un_flags |= UN_CLOSING;
 
@@ -2676,7 +2429,7 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)
 
        /*
         * Only officially close channel if count is 0 and
-         * DIGI_PRINTER bit is not set.
+        * DIGI_PRINTER bit is not set.
         */
        if ((ch->ch_open_count == 0) && !(ch->ch_digi.digi_flags & DIGI_PRINTER)) {
 
@@ -2687,13 +2440,7 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)
                /* wait for output to drain */
                /* This will also return if we take an interrupt */
 
-               DPR_CLOSE(("Calling wait_for_drain\n"));
                rc = dgap_wait_for_drain(tty);
-               DPR_CLOSE(("After calling wait_for_drain\n"));
-
-               if (rc) {
-                       DPR_BASIC(("dgap_tty_close - bad return: %d ", rc));
-               }
 
                dgap_tty_flush_buffer(tty);
                tty_ldisc_flush(tty);
@@ -2705,23 +2452,18 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)
                /*
                 * If we have HUPCL set, lower DTR and RTS
                 */
-               if (ch->ch_c_cflag & HUPCL ) {
-                       DPR_CLOSE(("Close. HUPCL set, dropping DTR/RTS\n"));
+               if (ch->ch_c_cflag & HUPCL) {
                        ch->ch_mostat &= ~(D_RTS(ch)|D_DTR(ch));
-                       dgap_cmdb( ch, SMODEM, 0, D_DTR(ch)|D_RTS(ch), 0 );
+                       dgap_cmdb(ch, SMODEM, 0, D_DTR(ch)|D_RTS(ch), 0);
 
                        /*
                         * Go to sleep to ensure RTS/DTR
                         * have been dropped for modems to see it.
                         */
                        if (ch->ch_close_delay) {
-                               DPR_CLOSE(("Close. Sleeping for RTS/DTR drop\n"));
-
                                DGAP_UNLOCK(ch->ch_lock, lock_flags);
                                dgap_ms_sleep(ch->ch_close_delay);
                                DGAP_LOCK(ch->ch_lock, lock_flags);
-
-                               DPR_CLOSE(("Close. After sleeping for RTS/DTR drop\n"));
                        }
                }
 
@@ -2734,7 +2476,7 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)
        /*
         * turn off print device when closing print device.
         */
-       if ((un->un_type == DGAP_PRINT)  && (ch->ch_flags & CH_PRON) ) {
+       if ((un->un_type == DGAP_PRINT)  && (ch->ch_flags & CH_PRON)) {
                dgap_wmove(ch, ch->ch_digi.digi_offstr,
                        (int) ch->ch_digi.digi_offlen);
                ch->ch_flags &= ~CH_PRON;
@@ -2744,16 +2486,12 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)
        un->un_flags &= ~(UN_ISOPEN | UN_CLOSING);
        tty->driver_data = NULL;
 
-       DPR_CLOSE(("Close. Doing wakeups\n"));
        wake_up_interruptible(&ch->ch_flags_wait);
        wake_up_interruptible(&un->un_flags_wait);
 
        DGAP_UNLOCK(ch->ch_lock, lock_flags);
-
-        DPR_BASIC(("dgap_tty_close - complete\n"));
 }
 
-
 /*
  * dgap_tty_chars_in_buffer()
  *
@@ -2775,23 +2513,23 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty)
        ulong   lock_flags2 = 0;
 
        if (tty == NULL)
-               return(0);
+               return 0;
 
        un = tty->driver_data;
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
 
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
 
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
 
-        bs = ch->ch_bs;
+       bs = ch->ch_bs;
        if (!bs)
-               return (0);
+               return 0;
 
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
@@ -2818,12 +2556,11 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty)
         * 1) Transmit head and tail are equal (empty).
         * 2) Command queue head and tail are equal (empty).
         * 3) The "TBUSY" flag is 0. (Transmitter not busy).
-        */
+        */
 
        if ((ttail == thead) && (tbusy == 0) && (chead == ctail)) {
                chars = 0;
-       }
-       else {
+       } else {
                if (thead >= ttail)
                        chars = thead - ttail;
                else
@@ -2851,12 +2588,9 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty)
                }
        }
 
-       DPR_WRITE(("dgap_tty_chars_in_buffer. Port: %x - %d (head: %d tail: %d tsize: %d)\n",
-               ch->ch_portnum, chars, thead, ttail, ch->ch_tsize));
-        return(chars);
+       return chars;
 }
 
-
 static int dgap_wait_for_drain(struct tty_struct *tty)
 {
        struct channel_t *ch;
@@ -2877,14 +2611,12 @@ static int dgap_wait_for_drain(struct tty_struct *tty)
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
                return ret;
 
-        bs = ch->ch_bs;
+       bs = ch->ch_bs;
        if (!bs)
                return ret;
 
        ret = 0;
 
-       DPR_DRAIN(("dgap_wait_for_drain start\n"));
-
        /* Loop until data is drained */
        while (count != 0) {
 
@@ -2902,20 +2634,17 @@ static int dgap_wait_for_drain(struct tty_struct *tty)
                /* Go to sleep till we get woken up */
                ret = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
                /* If ret is non-zero, user ctrl-c'ed us */
-               if (ret) {
+               if (ret)
                        break;
-               }
        }
 
        DGAP_LOCK(ch->ch_lock, lock_flags);
        un->un_flags &= ~(UN_EMPTY);
        DGAP_UNLOCK(ch->ch_lock, lock_flags);
 
-       DPR_DRAIN(("dgap_wait_for_drain finish\n"));
-       return (ret);
+       return ret;
 }
 
-
 /*
  * dgap_maxcps_room
  *
@@ -2930,24 +2659,24 @@ static int dgap_maxcps_room(struct tty_struct *tty, int bytes_available)
        struct un_t *un = NULL;
 
        if (tty == NULL)
-               return (bytes_available);
+               return bytes_available;
 
        un = tty->driver_data;
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (bytes_available);
+               return bytes_available;
 
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (bytes_available);
+               return bytes_available;
 
        /*
         * If its not the Transparent print device, return
         * the full data amount.
         */
        if (un->un_type != DGAP_PRINT)
-               return (bytes_available);
+               return bytes_available;
 
-       if (ch->ch_digi.digi_maxcps > 0 && ch->ch_digi.digi_bufsize > 0 ) {
+       if (ch->ch_digi.digi_maxcps > 0 && ch->ch_digi.digi_bufsize > 0) {
                int cps_limit = 0;
                unsigned long current_time = jiffies;
                unsigned long buffer_time = current_time +
@@ -2957,12 +2686,10 @@ static int dgap_maxcps_room(struct tty_struct *tty, int bytes_available)
                        /* buffer is empty */
                        ch->ch_cpstime = current_time;            /* reset ch_cpstime */
                        cps_limit = ch->ch_digi.digi_bufsize;
-               }
-               else if (ch->ch_cpstime < buffer_time) {
+               } else if (ch->ch_cpstime < buffer_time) {
                        /* still room in the buffer */
                        cps_limit = ((buffer_time - ch->ch_cpstime) * ch->ch_digi.digi_maxcps) / HZ;
-               }
-               else {
+               } else {
                        /* no room in the buffer */
                        cps_limit = 0;
                }
@@ -2970,10 +2697,9 @@ static int dgap_maxcps_room(struct tty_struct *tty, int bytes_available)
                bytes_available = min(cps_limit, bytes_available);
        }
 
-       return (bytes_available);
+       return bytes_available;
 }
 
-
 static inline void dgap_set_firmware_event(struct un_t *un, unsigned int event)
 {
        struct channel_t *ch = NULL;
@@ -2984,7 +2710,7 @@ static inline void dgap_set_firmware_event(struct un_t *un, unsigned int event)
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
                return;
-        bs = ch->ch_bs;
+       bs = ch->ch_bs;
        if (!bs)
                return;
 
@@ -3002,7 +2728,6 @@ static inline void dgap_set_firmware_event(struct un_t *un, unsigned int event)
        }
 }
 
-
 /*
  * dgap_tty_write_room()
  *
@@ -3018,19 +2743,19 @@ static int dgap_tty_write_room(struct tty_struct *tty)
        ulong   lock_flags = 0;
 
        if (tty == NULL || dgap_TmpWriteBuf == NULL)
-               return(0);
+               return 0;
 
        un = tty->driver_data;
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
 
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
 
-        bs = ch->ch_bs;
+       bs = ch->ch_bs;
        if (!bs)
-               return (0);
+               return 0;
 
        DGAP_LOCK(ch->ch_lock, lock_flags);
 
@@ -3038,8 +2763,9 @@ static int dgap_tty_write_room(struct tty_struct *tty)
        head = readw(&(bs->tx_head)) & tmask;
        tail = readw(&(bs->tx_tail)) & tmask;
 
-        if ((ret = tail - head - 1) < 0)
-                ret += ch->ch_tsize;
+       ret = tail - head - 1;
+       if (ret < 0)
+               ret += ch->ch_tsize;
 
        /* Limit printer to maxcps */
        ret = dgap_maxcps_room(tty, ret);
@@ -3052,8 +2778,7 @@ static int dgap_tty_write_room(struct tty_struct *tty)
                if (!(ch->ch_flags & CH_PRON))
                        ret -= ch->ch_digi.digi_onlen;
                ret -= ch->ch_digi.digi_offlen;
-       }
-       else {
+       } else {
                if (ch->ch_flags & CH_PRON)
                        ret -= ch->ch_digi.digi_offlen;
        }
@@ -3071,12 +2796,9 @@ static int dgap_tty_write_room(struct tty_struct *tty)
        dgap_set_firmware_event(un, UN_LOW | UN_EMPTY);
        DGAP_UNLOCK(ch->ch_lock, lock_flags);
 
-       DPR_WRITE(("dgap_tty_write_room - %d tail: %d head: %d\n", ret, tail, head));
-
-        return(ret);
+       return ret;
 }
 
-
 /*
  * dgap_tty_put_char()
  *
@@ -3089,12 +2811,10 @@ static int dgap_tty_put_char(struct tty_struct *tty, unsigned char c)
        /*
         * Simply call tty_write.
         */
-       DPR_WRITE(("dgap_tty_put_char called\n"));
        dgap_tty_write(tty, &c, 1);
        return 1;
 }
 
-
 /*
  * dgap_tty_write()
  *
@@ -3114,25 +2834,22 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, int
        int from_user = 0;
 
        if (tty == NULL || dgap_TmpWriteBuf == NULL)
-               return(0);
+               return 0;
 
        un = tty->driver_data;
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
 
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return(0);
+               return 0;
 
-        bs = ch->ch_bs;
+       bs = ch->ch_bs;
        if (!bs)
-               return(0);
+               return 0;
 
        if (!count)
-               return(0);
-
-       DPR_WRITE(("dgap_tty_write: Port: %x tty=%p user=%d len=%d\n",
-               ch->ch_portnum, tty, from_user, count));
+               return 0;
 
        /*
         * Store original amount of characters passed in.
@@ -3148,12 +2865,10 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, int
        head = readw(&(bs->tx_head)) & tmask;
        tail = readw(&(bs->tx_tail)) & tmask;
 
-       if ((bufcount = tail - head - 1) < 0)
+       bufcount = tail - head - 1;
+       if (bufcount < 0)
                bufcount += ch->ch_tsize;
 
-       DPR_WRITE(("%d: bufcount: %x count: %x tail: %x head: %x tmask: %x\n",
-               __LINE__, bufcount, count, tail, head, tmask));
-
        /*
         * Limit printer output to maxcps overall, with bursts allowed
         * up to bufsize characters.
@@ -3172,7 +2887,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, int
        if (count <= 0) {
                dgap_set_firmware_event(un, UN_LOW | UN_EMPTY);
                DGAP_UNLOCK(ch->ch_lock, lock_flags);
-               return(0);
+               return 0;
        }
 
        /*
@@ -3203,7 +2918,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, int
        if (count <= 0) {
                dgap_set_firmware_event(un, UN_LOW | UN_EMPTY);
                DGAP_UNLOCK(ch->ch_lock, lock_flags);
-               return(0);
+               return 0;
        }
 
        if (from_user) {
@@ -3218,13 +2933,11 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, int
                 * the board.
                 */
                /* we're allowed to block if it's from_user */
-               if (down_interruptible(&dgap_TmpWriteSem)) {
-                       return (-EINTR);
-               }
+               if (down_interruptible(&dgap_TmpWriteSem))
+                       return -EINTR;
 
                if (copy_from_user(dgap_TmpWriteBuf, (const uchar __user *) buf, count)) {
                        up(&dgap_TmpWriteSem);
-                       printk("Write: Copy from user failed!\n");
                        return -EFAULT;
                }
 
@@ -3274,7 +2987,6 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, int
                writew(head, &(bs->tx_head));
        }
 
-
        dgap_set_firmware_event(un, UN_LOW | UN_EMPTY);
 
        /*
@@ -3290,8 +3002,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, int
                if (tail != head) {
                        un->un_flags |= UN_EMPTY;
                        writeb(1, &(bs->iempty));
-               }
-               else {
+               } else {
                        dgap_wmove(ch, ch->ch_digi.digi_offstr,
                                (int) ch->ch_digi.digi_offlen);
                        head = readw(&(bs->tx_head)) & tmask;
@@ -3302,24 +3013,18 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, int
        /* Update printer buffer empty time. */
        if ((un->un_type == DGAP_PRINT) && (ch->ch_digi.digi_maxcps > 0)
            && (ch->ch_digi.digi_bufsize > 0)) {
-                ch->ch_cpstime += (HZ * count) / ch->ch_digi.digi_maxcps;
+               ch->ch_cpstime += (HZ * count) / ch->ch_digi.digi_maxcps;
        }
 
        if (from_user) {
                DGAP_UNLOCK(ch->ch_lock, lock_flags);
                up(&dgap_TmpWriteSem);
-       }
-       else {
+       } else
                DGAP_UNLOCK(ch->ch_lock, lock_flags);
-       }
 
-       DPR_WRITE(("Write finished - Write %d bytes of %d.\n", count, orig_count));
-
-       return (count);
+       return count;
 }
 
-
-
 /*
  * Return modem signals to ld.
  */
@@ -3342,13 +3047,11 @@ static int dgap_tty_tiocmget(struct tty_struct *tty)
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
                return result;
 
-       DPR_IOCTL(("dgap_tty_tiocmget start\n"));
-
        DGAP_LOCK(ch->ch_lock, lock_flags);
 
        mstat = readb(&(ch->ch_bs->m_stat));
-        /* Append any outbound signals that might be pending... */
-        mstat |= ch->ch_mostat;
+       /* Append any outbound signals that might be pending... */
+       mstat |= ch->ch_mostat;
 
        DGAP_UNLOCK(ch->ch_lock, lock_flags);
 
@@ -3367,20 +3070,16 @@ static int dgap_tty_tiocmget(struct tty_struct *tty)
        if (mstat & D_CD(ch))
                result |= TIOCM_CD;
 
-       DPR_IOCTL(("dgap_tty_tiocmget finish\n"));
-
        return result;
 }
 
-
 /*
  * dgap_tty_tiocmset()
  *
  * Set modem signals, called by ld.
  */
-
 static int dgap_tty_tiocmset(struct tty_struct *tty,
-                unsigned int set, unsigned int clear)
+               unsigned int set, unsigned int clear)
 {
        struct board_t *bd;
        struct channel_t *ch;
@@ -3404,43 +3103,37 @@ static int dgap_tty_tiocmset(struct tty_struct *tty,
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
                return ret;
 
-       DPR_IOCTL(("dgap_tty_tiocmset start\n"));
-
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
 
        if (set & TIOCM_RTS) {
                ch->ch_mforce |= D_RTS(ch);
                ch->ch_mval   |= D_RTS(ch);
-        }
+       }
 
        if (set & TIOCM_DTR) {
                ch->ch_mforce |= D_DTR(ch);
                ch->ch_mval   |= D_DTR(ch);
-        }
+       }
 
        if (clear & TIOCM_RTS) {
                ch->ch_mforce |= D_RTS(ch);
                ch->ch_mval   &= ~(D_RTS(ch));
-        }
+       }
 
        if (clear & TIOCM_DTR) {
                ch->ch_mforce |= D_DTR(ch);
                ch->ch_mval   &= ~(D_DTR(ch));
-        }
+       }
 
        dgap_param(tty);
 
        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-       DPR_IOCTL(("dgap_tty_tiocmset finish\n"));
-
-       return (0);
+       return 0;
 }
 
-
-
 /*
  * dgap_tty_send_break()
  *
@@ -3482,8 +3175,6 @@ static int dgap_tty_send_break(struct tty_struct *tty, int msec)
                break;
        }
 
-       DPR_IOCTL(("dgap_tty_send_break start 1.  %lx\n", jiffies));
-
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
 #if 0
@@ -3494,14 +3185,9 @@ static int dgap_tty_send_break(struct tty_struct *tty, int msec)
        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-       DPR_IOCTL(("dgap_tty_send_break finish\n"));
-
-       return (0);
+       return 0;
 }
 
-
-
-
 /*
  * dgap_tty_wait_until_sent()
  *
@@ -3509,17 +3195,9 @@ static int dgap_tty_send_break(struct tty_struct *tty, int msec)
  */
 static void dgap_tty_wait_until_sent(struct tty_struct *tty, int timeout)
 {
-       int rc;
-       rc = dgap_wait_for_drain(tty);
-       if (rc) {
-               DPR_IOCTL(("dgap_tty_ioctl - bad return: %d ", rc));
-               return;
-       }
-       return;
+       dgap_wait_for_drain(tty);
 }
 
-
-
 /*
  * dgap_send_xchar()
  *
@@ -3548,8 +3226,6 @@ static void dgap_tty_send_xchar(struct tty_struct *tty, char c)
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
                return;
 
-       DPR_IOCTL(("dgap_tty_send_xchar start 1.  %lx\n", jiffies));
-
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
 
@@ -3561,15 +3237,12 @@ static void dgap_tty_send_xchar(struct tty_struct *tty, char c)
         * by hand...
         */
 #if 0
-       if (c == STOP_CHAR(tty)) {
+       if (c == STOP_CHAR(tty))
                dgap_cmdw(ch, RPAUSE, 0, 0);
-       }
-       else if (c == START_CHAR(tty)) {
+       else if (c == START_CHAR(tty))
                dgap_cmdw(ch, RRESUME, 0, 0);
-       }
-       else {
+       else
                dgap_wmove(ch, &c, 1);
-       }
 #else
        dgap_wmove(ch, &c, 1);
 #endif
@@ -3577,14 +3250,9 @@ static void dgap_tty_send_xchar(struct tty_struct *tty, char c)
        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-       DPR_IOCTL(("dgap_tty_send_xchar finish\n"));
-
        return;
 }
 
-
-
-
 /*
  * Return modem signals to ld.
  */
@@ -3595,10 +3263,8 @@ static int dgap_get_modem_info(struct channel_t *ch, unsigned int __user *value)
        ulong lock_flags;
        int rc = 0;
 
-       DPR_IOCTL(("dgap_get_modem_info start\n"));
-
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return(-ENXIO);
+               return -ENXIO;
 
        DGAP_LOCK(ch->ch_lock, lock_flags);
 
@@ -3625,11 +3291,9 @@ static int dgap_get_modem_info(struct channel_t *ch, unsigned int __user *value)
 
        rc = put_user(result, value);
 
-       DPR_IOCTL(("dgap_get_modem_info finish\n"));
-       return(rc);
+       return rc;
 }
 
-
 /*
  * dgap_set_modem_info()
  *
@@ -3660,27 +3324,21 @@ static int dgap_set_modem_info(struct tty_struct *tty, unsigned int command, uns
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
                return ret;
 
-       DPR_IOCTL(("dgap_set_modem_info() start\n"));
-
        ret = get_user(arg, value);
-       if (ret) {
-               DPR_IOCTL(("dgap_set_modem_info %d ret: %x. finished.\n", __LINE__, ret));
-               return(ret);
-       }
-
-       DPR_IOCTL(("dgap_set_modem_info: command: %x arg: %x\n", command, arg));
+       if (ret)
+               return ret;
 
        switch (command) {
        case TIOCMBIS:
                if (arg & TIOCM_RTS) {
                        ch->ch_mforce |= D_RTS(ch);
                        ch->ch_mval   |= D_RTS(ch);
-               }
+               }
 
                if (arg & TIOCM_DTR) {
                        ch->ch_mforce |= D_DTR(ch);
                        ch->ch_mval   |= D_DTR(ch);
-               }
+               }
 
                break;
 
@@ -3688,36 +3346,32 @@ static int dgap_set_modem_info(struct tty_struct *tty, unsigned int command, uns
                if (arg & TIOCM_RTS) {
                        ch->ch_mforce |= D_RTS(ch);
                        ch->ch_mval   &= ~(D_RTS(ch));
-               }
+               }
 
                if (arg & TIOCM_DTR) {
                        ch->ch_mforce |= D_DTR(ch);
                        ch->ch_mval   &= ~(D_DTR(ch));
-               }
+               }
 
                break;
 
-        case TIOCMSET:
+       case TIOCMSET:
                ch->ch_mforce = D_DTR(ch)|D_RTS(ch);
 
-               if (arg & TIOCM_RTS) {
+               if (arg & TIOCM_RTS)
                        ch->ch_mval |= D_RTS(ch);
-               }
-               else {
+               else
                        ch->ch_mval &= ~(D_RTS(ch));
-               }
 
-               if (arg & TIOCM_DTR) {
+               if (arg & TIOCM_DTR)
                        ch->ch_mval |= (D_DTR(ch));
-               }
-               else {
+               else
                        ch->ch_mval &= ~(D_DTR(ch));
-               }
 
                break;
 
        default:
-               return(-EINVAL);
+               return -EINVAL;
        }
 
        DGAP_LOCK(bd->bd_lock, lock_flags);
@@ -3728,12 +3382,9 @@ static int dgap_set_modem_info(struct tty_struct *tty, unsigned int command, uns
        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-       DPR_IOCTL(("dgap_set_modem_info finish\n"));
-
-       return (0);
+       return 0;
 }
 
-
 /*
  * dgap_tty_digigeta()
  *
@@ -3750,18 +3401,18 @@ static int dgap_tty_digigeta(struct tty_struct *tty, struct digi_t __user *retin
        ulong lock_flags;
 
        if (!retinfo)
-               return (-EFAULT);
+               return -EFAULT;
 
        if (!tty || tty->magic != TTY_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        un = tty->driver_data;
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        memset(&tmp, 0, sizeof(tmp));
 
@@ -3770,12 +3421,11 @@ static int dgap_tty_digigeta(struct tty_struct *tty, struct digi_t __user *retin
        DGAP_UNLOCK(ch->ch_lock, lock_flags);
 
        if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
-               return (-EFAULT);
+               return -EFAULT;
 
-       return (0);
+       return 0;
 }
 
-
 /*
  * dgap_tty_digiseta()
  *
@@ -3793,27 +3443,23 @@ static int dgap_tty_digiseta(struct tty_struct *tty, struct digi_t __user *new_i
        ulong   lock_flags = 0;
        unsigned long lock_flags2;
 
-       DPR_IOCTL(("DIGI_SETA start\n"));
-
        if (!tty || tty->magic != TTY_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        un = tty->driver_data;
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
-        if (copy_from_user(&new_digi, new_info, sizeof(struct digi_t))) {
-               DPR_IOCTL(("DIGI_SETA failed copy_from_user\n"));
-                return(-EFAULT);
-       }
+       if (copy_from_user(&new_digi, new_info, sizeof(struct digi_t)))
+               return -EFAULT;
 
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
@@ -3846,12 +3492,9 @@ static int dgap_tty_digiseta(struct tty_struct *tty, struct digi_t __user *new_i
        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-       DPR_IOCTL(("DIGI_SETA finish\n"));
-
-       return(0);
+       return 0;
 }
 
-
 /*
  * dgap_tty_digigetedelay()
  *
@@ -3868,18 +3511,18 @@ static int dgap_tty_digigetedelay(struct tty_struct *tty, int __user *retinfo)
        ulong lock_flags;
 
        if (!retinfo)
-               return (-EFAULT);
+               return -EFAULT;
 
        if (!tty || tty->magic != TTY_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        un = tty->driver_data;
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        memset(&tmp, 0, sizeof(tmp));
 
@@ -3888,12 +3531,11 @@ static int dgap_tty_digigetedelay(struct tty_struct *tty, int __user *retinfo)
        DGAP_UNLOCK(ch->ch_lock, lock_flags);
 
        if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
-               return (-EFAULT);
+               return -EFAULT;
 
-       return (0);
+       return 0;
 }
 
-
 /*
  * dgap_tty_digisetedelay()
  *
@@ -3909,27 +3551,23 @@ static int dgap_tty_digisetedelay(struct tty_struct *tty, int __user *new_info)
        ulong lock_flags;
        ulong lock_flags2;
 
-       DPR_IOCTL(("DIGI_SETA start\n"));
-
        if (!tty || tty->magic != TTY_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        un = tty->driver_data;
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
-        if (copy_from_user(&new_digi, new_info, sizeof(int))) {
-               DPR_IOCTL(("DIGI_SETEDELAY failed copy_from_user\n"));
-                return(-EFAULT);
-       }
+       if (copy_from_user(&new_digi, new_info, sizeof(int)))
+               return -EFAULT;
 
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
@@ -3941,12 +3579,9 @@ static int dgap_tty_digisetedelay(struct tty_struct *tty, int __user *new_info)
        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-       DPR_IOCTL(("DIGI_SETA finish\n"));
-
-       return(0);
+       return 0;
 }
 
-
 /*
  * dgap_tty_digigetcustombaud()
  *
@@ -3960,18 +3595,18 @@ static int dgap_tty_digigetcustombaud(struct tty_struct *tty, int __user *retinf
        ulong lock_flags;
 
        if (!retinfo)
-               return (-EFAULT);
+               return -EFAULT;
 
        if (!tty || tty->magic != TTY_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        un = tty->driver_data;
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        memset(&tmp, 0, sizeof(tmp));
 
@@ -3979,15 +3614,12 @@ static int dgap_tty_digigetcustombaud(struct tty_struct *tty, int __user *retinf
        tmp = dgap_get_custom_baud(ch);
        DGAP_UNLOCK(ch->ch_lock, lock_flags);
 
-       DPR_IOCTL(("DIGI_GETCUSTOMBAUD. Returning %d\n", tmp));
-
        if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
-               return (-EFAULT);
+               return -EFAULT;
 
-       return (0);
+       return 0;
 }
 
-
 /*
  * dgap_tty_digisetcustombaud()
  *
@@ -4002,33 +3634,27 @@ static int dgap_tty_digisetcustombaud(struct tty_struct *tty, int __user *new_in
        ulong lock_flags;
        ulong lock_flags2;
 
-       DPR_IOCTL(("DIGI_SETCUSTOMBAUD start\n"));
-
        if (!tty || tty->magic != TTY_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        un = tty->driver_data;
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (-EFAULT);
+               return -EFAULT;
 
 
-       if (copy_from_user(&new_rate, new_info, sizeof(unsigned int))) {
-               DPR_IOCTL(("DIGI_SETCUSTOMBAUD failed copy_from_user\n"));
-               return(-EFAULT);
-       }
+       if (copy_from_user(&new_rate, new_info, sizeof(unsigned int)))
+               return -EFAULT;
 
        if (bd->bd_flags & BD_FEP5PLUS) {
 
-               DPR_IOCTL(("DIGI_SETCUSTOMBAUD. Setting %d\n", new_rate));
-
                DGAP_LOCK(bd->bd_lock, lock_flags);
                DGAP_LOCK(ch->ch_lock, lock_flags2);
 
@@ -4040,12 +3666,9 @@ static int dgap_tty_digisetcustombaud(struct tty_struct *tty, int __user *new_in
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
        }
 
-       DPR_IOCTL(("DIGI_SETCUSTOMBAUD finish\n"));
-
-       return(0);
+       return 0;
 }
 
-
 /*
  * dgap_set_termios()
  */
@@ -4089,7 +3712,6 @@ static void dgap_tty_set_termios(struct tty_struct *tty, struct ktermios *old_te
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
 }
 
-
 static void dgap_tty_throttle(struct tty_struct *tty)
 {
        struct board_t *bd;
@@ -4105,16 +3727,14 @@ static void dgap_tty_throttle(struct tty_struct *tty)
        if (!un || un->magic != DGAP_UNIT_MAGIC)
                return;
 
-        ch = un->un_ch;
-        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-                return;
+       ch = un->un_ch;
+       if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+               return;
 
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
                return;
 
-       DPR_IOCTL(("dgap_tty_throttle start\n"));
-
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
 
@@ -4126,10 +3746,8 @@ static void dgap_tty_throttle(struct tty_struct *tty)
        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-       DPR_IOCTL(("dgap_tty_throttle finish\n"));
 }
 
-
 static void dgap_tty_unthrottle(struct tty_struct *tty)
 {
        struct board_t *bd;
@@ -4145,16 +3763,14 @@ static void dgap_tty_unthrottle(struct tty_struct *tty)
        if (!un || un->magic != DGAP_UNIT_MAGIC)
                return;
 
-        ch = un->un_ch;
-        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-                return;
+       ch = un->un_ch;
+       if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+               return;
 
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
                return;
 
-       DPR_IOCTL(("dgap_tty_unthrottle start\n"));
-
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
 
@@ -4166,11 +3782,8 @@ static void dgap_tty_unthrottle(struct tty_struct *tty)
 
        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
-
-       DPR_IOCTL(("dgap_tty_unthrottle finish\n"));
 }
 
-
 static void dgap_tty_start(struct tty_struct *tty)
 {
        struct board_t *bd;
@@ -4186,16 +3799,14 @@ static void dgap_tty_start(struct tty_struct *tty)
        if (!un || un->magic != DGAP_UNIT_MAGIC)
                return;
 
-        ch = un->un_ch;
-        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-                return;
+       ch = un->un_ch;
+       if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+               return;
 
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
                return;
 
-       DPR_IOCTL(("dgap_tty_start start\n"));
-
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
 
@@ -4204,10 +3815,8 @@ static void dgap_tty_start(struct tty_struct *tty)
        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-       DPR_IOCTL(("dgap_tty_start finish\n"));
 }
 
-
 static void dgap_tty_stop(struct tty_struct *tty)
 {
        struct board_t *bd;
@@ -4223,16 +3832,14 @@ static void dgap_tty_stop(struct tty_struct *tty)
        if (!un || un->magic != DGAP_UNIT_MAGIC)
                return;
 
-        ch = un->un_ch;
-        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-                return;
+       ch = un->un_ch;
+       if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+               return;
 
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
                return;
 
-       DPR_IOCTL(("dgap_tty_stop start\n"));
-
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
 
@@ -4241,10 +3848,8 @@ static void dgap_tty_stop(struct tty_struct *tty)
        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-       DPR_IOCTL(("dgap_tty_stop finish\n"));
 }
 
-
 /*
  * dgap_tty_flush_chars()
  *
@@ -4273,16 +3878,14 @@ static void dgap_tty_flush_chars(struct tty_struct *tty)
        if (!un || un->magic != DGAP_UNIT_MAGIC)
                return;
 
-        ch = un->un_ch;
-        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-                return;
+       ch = un->un_ch;
+       if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+               return;
 
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
                return;
 
-       DPR_IOCTL(("dgap_tty_flush_chars start\n"));
-
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
 
@@ -4290,12 +3893,8 @@ static void dgap_tty_flush_chars(struct tty_struct *tty)
 
        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
-
-       DPR_IOCTL(("dgap_tty_flush_chars finish\n"));
 }
 
-
-
 /*
  * dgap_tty_flush_buffer()
  *
@@ -4317,16 +3916,14 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty)
        if (!un || un->magic != DGAP_UNIT_MAGIC)
                return;
 
-        ch = un->un_ch;
-        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-                return;
+       ch = un->un_ch;
+       if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+               return;
 
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
                return;
 
-       DPR_IOCTL(("dgap_tty_flush_buffer on port: %d start\n", ch->ch_portnum));
-
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
 
@@ -4348,12 +3945,8 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty)
        if (waitqueue_active(&tty->write_wait))
                wake_up_interruptible(&tty->write_wait);
        tty_wakeup(tty);
-
-       DPR_IOCTL(("dgap_tty_flush_buffer finish\n"));
 }
 
-
-
 /*****************************************************************************
  *
  * The IOCTL function and all of its helpers
@@ -4378,31 +3971,27 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
        void __user *uarg = (void __user *) arg;
 
        if (!tty || tty->magic != TTY_MAGIC)
-               return (-ENODEV);
+               return -ENODEV;
 
        un = tty->driver_data;
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (-ENODEV);
+               return -ENODEV;
 
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (-ENODEV);
+               return -ENODEV;
 
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (-ENODEV);
-
-       DPR_IOCTL(("dgap_tty_ioctl start on port %d - cmd %s (%x), arg %lx\n",
-               ch->ch_portnum, dgap_ioctl_name(cmd), cmd, arg));
+               return -ENODEV;
 
        DGAP_LOCK(bd->bd_lock, lock_flags);
        DGAP_LOCK(ch->ch_lock, lock_flags2);
 
        if (un->un_open_count <= 0) {
-               DPR_BASIC(("dgap_tty_ioctl - unit not open.\n"));
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               return(-EIO);
+               return -EIO;
        }
 
        switch (cmd) {
@@ -4421,35 +4010,27 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                rc = tty_check_change(tty);
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               if (rc) {
-                       return(rc);
-               }
+               if (rc)
+                       return rc;
 
                rc = dgap_wait_for_drain(tty);
 
-               if (rc) {
-                       DPR_IOCTL(("dgap_tty_ioctl - bad return: %d ", rc));
-                       return(-EINTR);
-               }
+               if (rc)
+                       return -EINTR;
 
                DGAP_LOCK(bd->bd_lock, lock_flags);
                DGAP_LOCK(ch->ch_lock, lock_flags2);
 
-               if(((cmd == TCSBRK) && (!arg)) || (cmd == TCSBRKP)) {
+               if (((cmd == TCSBRK) && (!arg)) || (cmd == TCSBRKP))
                        dgap_cmdw(ch, SBREAK, (u16) SBREAK_TIME, 0);
-               }
 
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-               DPR_IOCTL(("dgap_tty_ioctl finish on port %d - cmd %s (%x), arg %lx\n",
-                       ch->ch_portnum, dgap_ioctl_name(cmd), cmd, arg));
-
-                return(0);
-
+               return 0;
 
        case TCSBRKP:
-               /* support for POSIX tcsendbreak()
+               /* support for POSIX tcsendbreak()
 
                 * According to POSIX.1 spec (7.2.2.1.2) breaks should be
                 * between 0.25 and 0.5 seconds so we'll ask for something
@@ -4458,15 +4039,12 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                rc = tty_check_change(tty);
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               if (rc) {
-                       return(rc);
-               }
+               if (rc)
+                       return rc;
 
                rc = dgap_wait_for_drain(tty);
-               if (rc) {
-                       DPR_IOCTL(("dgap_tty_ioctl - bad return: %d ", rc));
-                       return(-EINTR);
-               }
+               if (rc)
+                       return -EINTR;
 
                DGAP_LOCK(bd->bd_lock, lock_flags);
                DGAP_LOCK(ch->ch_lock, lock_flags2);
@@ -4476,12 +4054,9 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-               DPR_IOCTL(("dgap_tty_ioctl finish on port %d - cmd %s (%x), arg %lx\n",
-                       ch->ch_portnum, dgap_ioctl_name(cmd), cmd, arg));
-
-               return(0);
+               return 0;
 
-        case TIOCSBRK:
+       case TIOCSBRK:
                /*
                 * FEP5 doesn't support turning on a break unconditionally.
                 * The FEP5 device will stop sending a break automatically
@@ -4491,15 +4066,12 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                rc = tty_check_change(tty);
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               if (rc) {
-                       return(rc);
-               }
+               if (rc)
+                       return rc;
 
                rc = dgap_wait_for_drain(tty);
-               if (rc) {
-                       DPR_IOCTL(("dgap_tty_ioctl - bad return: %d ", rc));
-                       return(-EINTR);
-               }
+               if (rc)
+                       return -EINTR;
 
                DGAP_LOCK(bd->bd_lock, lock_flags);
                DGAP_LOCK(ch->ch_lock, lock_flags2);
@@ -4509,12 +4081,9 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-               DPR_IOCTL(("dgap_tty_ioctl finish on port %d - cmd %s (%x), arg %lx\n",
-                       ch->ch_portnum, dgap_ioctl_name(cmd), cmd, arg));
-
                return 0;
 
-        case TIOCCBRK:
+       case TIOCCBRK:
                /*
                 * FEP5 doesn't support turning off a break unconditionally.
                 * The FEP5 device will stop sending a break automatically
@@ -4531,7 +4100,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
                rc = put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *) arg);
-               return(rc);
+               return rc;
 
        case TIOCSSOFTCAR:
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
@@ -4539,7 +4108,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 
                rc = get_user(arg, (unsigned long __user *) arg);
                if (rc)
-                       return(rc);
+                       return rc;
 
                DGAP_LOCK(bd->bd_lock, lock_flags);
                DGAP_LOCK(ch->ch_lock, lock_flags2);
@@ -4548,19 +4117,19 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-               return(0);
+               return 0;
 
        case TIOCMGET:
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-                return(dgap_get_modem_info(ch, uarg));
+               return dgap_get_modem_info(ch, uarg);
 
        case TIOCMBIS:
        case TIOCMBIC:
        case TIOCMSET:
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               return(dgap_set_modem_info(tty, cmd, uarg));
+               return dgap_set_modem_info(tty, cmd, uarg);
 
                /*
                 * Here are any additional ioctl's that we want to implement
@@ -4580,7 +4149,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                if (rc) {
                        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                        DGAP_UNLOCK(bd->bd_lock, lock_flags);
-                       return(rc);
+                       return rc;
                }
 
                if ((arg == TCIFLUSH) || (arg == TCIOFLUSH)) {
@@ -4594,7 +4163,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                if ((arg == TCOFLUSH) || (arg == TCIOFLUSH)) {
                        ch->ch_flags &= ~CH_STOP;
                        head = readw(&(ch->ch_bs->tx_head));
-                       dgap_cmdw(ch, FLUSHTX, (u16) head, 0 );
+                       dgap_cmdw(ch, FLUSHTX, (u16) head, 0);
                        dgap_cmdw(ch, RESUMETX, 0, 0);
                        if (ch->ch_tun.un_flags & (UN_LOW|UN_EMPTY)) {
                                ch->ch_tun.un_flags &= ~(UN_LOW|UN_EMPTY);
@@ -4619,10 +4188,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-               DPR_IOCTL(("dgap_tty_ioctl (LINE:%d) finish on port %d - cmd %s (%x), arg %lx\n",
-                       __LINE__, ch->ch_portnum, dgap_ioctl_name(cmd), cmd, arg));
-
-               return(-ENOIOCTLCMD);
+               return -ENOIOCTLCMD;
 
        case TCSETSF:
        case TCSETSW:
@@ -4646,29 +4212,22 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
                rc = dgap_wait_for_drain(tty);
-               if (rc) {
-                       DPR_IOCTL(("dgap_tty_ioctl - bad return: %d ", rc));
-                       return(-EINTR);
-               }
-
-               DPR_IOCTL(("dgap_tty_ioctl finish on port %d - cmd %s (%x), arg %lx\n",
-                       ch->ch_portnum, dgap_ioctl_name(cmd), cmd, arg));
+               if (rc)
+                       return -EINTR;
 
                /* pretend we didn't recognize this */
-               return(-ENOIOCTLCMD);
+               return -ENOIOCTLCMD;
 
        case TCSETAW:
 
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
                rc = dgap_wait_for_drain(tty);
-               if (rc) {
-                       DPR_IOCTL(("dgap_tty_ioctl - bad return: %d ", rc));
-                       return(-EINTR);
-               }
+               if (rc)
+                       return -EINTR;
 
                /* pretend we didn't recognize this */
-               return(-ENOIOCTLCMD);
+               return -ENOIOCTLCMD;
 
        case TCXONC:
                /*
@@ -4682,43 +4241,42 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                if (rc) {
                        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                        DGAP_UNLOCK(bd->bd_lock, lock_flags);
-                       return(rc);
+                       return rc;
                }
 
-               DPR_IOCTL(("dgap_ioctl - in TCXONC - %d\n", cmd));
                switch (arg) {
 
                case TCOON:
                        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                        DGAP_UNLOCK(bd->bd_lock, lock_flags);
                        dgap_tty_start(tty);
-                       return(0);
+                       return 0;
                case TCOOFF:
                        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                        DGAP_UNLOCK(bd->bd_lock, lock_flags);
                        dgap_tty_stop(tty);
-                       return(0);
+                       return 0;
                case TCION:
                        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                        DGAP_UNLOCK(bd->bd_lock, lock_flags);
                        /* Make the ld do it */
-                       return(-ENOIOCTLCMD);
+                       return -ENOIOCTLCMD;
                case TCIOFF:
                        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                        DGAP_UNLOCK(bd->bd_lock, lock_flags);
                        /* Make the ld do it */
-                       return(-ENOIOCTLCMD);
+                       return -ENOIOCTLCMD;
                default:
                        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                        DGAP_UNLOCK(bd->bd_lock, lock_flags);
-                       return(-EINVAL);
+                       return -EINVAL;
                }
 
        case DIGI_GETA:
                /* get information for ditty */
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               return(dgap_tty_digigeta(tty, uarg));
+               return dgap_tty_digigeta(tty, uarg);
 
        case DIGI_SETAW:
        case DIGI_SETAF:
@@ -4729,42 +4287,38 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                        DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                        DGAP_UNLOCK(bd->bd_lock, lock_flags);
                        rc = dgap_wait_for_drain(tty);
-                       if (rc) {
-                               DPR_IOCTL(("dgap_tty_ioctl - bad return: %d ", rc));
-                               return(-EINTR);
-                       }
+                       if (rc)
+                               return -EINTR;
                        DGAP_LOCK(bd->bd_lock, lock_flags);
                        DGAP_LOCK(ch->ch_lock, lock_flags2);
-               }
-               else {
+               } else
                        tty_ldisc_flush(tty);
-               }
                /* fall thru */
 
        case DIGI_SETA:
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               return(dgap_tty_digiseta(tty, uarg));
+               return dgap_tty_digiseta(tty, uarg);
 
        case DIGI_GEDELAY:
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               return(dgap_tty_digigetedelay(tty, uarg));
+               return dgap_tty_digigetedelay(tty, uarg);
 
        case DIGI_SEDELAY:
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               return(dgap_tty_digisetedelay(tty, uarg));
+               return dgap_tty_digisetedelay(tty, uarg);
 
        case DIGI_GETCUSTOMBAUD:
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               return(dgap_tty_digigetcustombaud(tty, uarg));
+               return dgap_tty_digigetcustombaud(tty, uarg);
 
        case DIGI_SETCUSTOMBAUD:
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
-               return(dgap_tty_digisetcustombaud(tty, uarg));
+               return dgap_tty_digisetcustombaud(tty, uarg);
 
        case DIGI_RESET_PORT:
                dgap_firmware_reset_port(ch);
@@ -4777,11 +4331,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
-               DPR_IOCTL(("dgap_tty_ioctl - in default\n"));
-               DPR_IOCTL(("dgap_tty_ioctl end - cmd %s (%x), arg %lx\n",
-                       dgap_ioctl_name(cmd), cmd, arg));
-
-               return(-ENOIOCTLCMD);
+               return -ENOIOCTLCMD;
        }
 }
 
@@ -4808,32 +4358,53 @@ static int dgap_after_config_loaded(int board)
        return 0;
 }
 
-
-
 /*
  * Create pr and tty device entries
  */
-static void dgap_sysfs_create(struct board_t *brd)
+static int dgap_tty_register_ports(struct board_t *brd)
 {
        struct channel_t *ch;
-       int j = 0;
+       int i;
+
+       brd->SerialPorts = kcalloc(brd->nasync, sizeof(*brd->SerialPorts),
+                                       GFP_KERNEL);
+       if (brd->SerialPorts == NULL)
+               return -ENOMEM;
+       for (i = 0; i < brd->nasync; i++)
+               tty_port_init(&brd->SerialPorts[i]);
+
+       brd->PrinterPorts = kcalloc(brd->nasync, sizeof(*brd->PrinterPorts),
+                                       GFP_KERNEL);
+       if (brd->PrinterPorts == NULL) {
+               kfree(brd->SerialPorts);
+               return -ENOMEM;
+       }
+       for (i = 0; i < brd->nasync; i++)
+               tty_port_init(&brd->PrinterPorts[i]);
 
        ch = brd->channels[0];
-       for (j = 0; j < brd->nasync; j++, ch = brd->channels[j]) {
+       for (i = 0; i < brd->nasync; i++, ch = brd->channels[i]) {
+
                struct device *classp;
-               classp = tty_register_device(brd->SerialDriver, j,
-                                               &(ch->ch_bd->pdev->dev));
-               ch->ch_tun.un_sysfs = classp;
+
+               classp = tty_port_register_device(&brd->SerialPorts[i],
+                                       brd->SerialDriver,
+                                       brd->firstminor + i, NULL);
+
                dgap_create_tty_sysfs(&ch->ch_tun, classp);
+               ch->ch_tun.un_sysfs = classp;
+
+               classp = tty_port_register_device(&brd->PrinterPorts[i],
+                                       brd->PrintDriver,
+                                       brd->firstminor + i, NULL);
 
-               classp = tty_register_device(brd->PrintDriver, j,
-                                               &(ch->ch_bd->pdev->dev));
-               ch->ch_pun.un_sysfs = classp;
                dgap_create_tty_sysfs(&ch->ch_pun, classp);
+               ch->ch_pun.un_sysfs = classp;
        }
        dgap_create_ports_sysfiles(brd);
-}
 
+       return 0;
+}
 
 /*
  * Copies the BIOS code from the user to the board,
@@ -4848,8 +4419,6 @@ static void dgap_do_bios_load(struct board_t *brd, uchar __user *ubios, int len)
        if (!brd || (brd->magic != DGAP_BOARD_MAGIC) || !brd->re_map_membase)
                return;
 
-       DPR_INIT(("dgap_do_bios_load() start\n"));
-
        addr = brd->re_map_membase;
 
        /*
@@ -4871,7 +4440,6 @@ static void dgap_do_bios_load(struct board_t *brd, uchar __user *ubios, int len)
        writeb(FEPCLR, brd->re_map_port);
 }
 
-
 /*
  * Checks to see if the BIOS completed running on the card.
  */
@@ -4897,7 +4465,6 @@ static void dgap_do_wait_for_bios(struct board_t *brd)
        while (brd->wait_for_bios < 1000) {
                /* Check to see if BIOS thinks board is good. (GD). */
                if (word == *(u16 *) "GD") {
-                       DPR_INIT(("GOT GD in memory, moving states.\n"));
                        brd->state = FINISHED_BIOS_LOAD;
                        return;
                }
@@ -4909,13 +4476,12 @@ static void dgap_do_wait_for_bios(struct board_t *brd)
        /* Gave up on board after too long of time taken */
        err1 = readw(addr + SEQUENCE);
        err2 = readw(addr + ERROR);
-       APR(("***WARNING*** %s failed diagnostics.  Error #(%x,%x).\n",
-               brd->name, err1, err2));
+       pr_warn("dgap: %s failed diagnostics.  Error #(%x,%x).\n",
+               brd->name, err1, err2);
        brd->state = BOARD_FAILED;
        brd->dpastatus = BD_NOBIOS;
 }
 
-
 /*
  * Copies the FEP code from the user to the board,
  * and starts the FEP running.
@@ -4930,8 +4496,6 @@ static void dgap_do_fep_load(struct board_t *brd, uchar *ufep, int len)
 
        addr = brd->re_map_membase;
 
-       DPR_INIT(("dgap_do_fep_load() for board %s : start\n", brd->name));
-
        /*
         * Download FEP
         */
@@ -4961,11 +4525,8 @@ static void dgap_do_fep_load(struct board_t *brd, uchar *ufep, int len)
        writel(0xbfc01004, (addr + 0xc34));
        writel(0x3, (addr + 0xc30));
 
-       DPR_INIT(("dgap_do_fep_load() for board %s : finish\n", brd->name));
-
 }
 
-
 /*
  * Waits for the FEP to report thats its ready for us to use.
  */
@@ -5008,15 +4569,12 @@ static void dgap_do_wait_for_fep(struct board_t *brd)
        /* Gave up on board after too long of time taken */
        err1 = readw(addr + SEQUENCE);
        err2 = readw(addr + ERROR);
-       APR(("***WARNING*** FEPOS for %s not functioning.  Error #(%x,%x).\n",
-               brd->name, err1, err2));
+       pr_warn("dgap: FEPOS for %s not functioning.  Error #(%x,%x).\n",
+               brd->name, err1, err2);
        brd->state = BOARD_FAILED;
        brd->dpastatus = BD_NOFEP;
-
-       DPR_INIT(("dgap_do_wait_for_fep() for board %s : finish\n", brd->name));
 }
 
-
 /*
  * Physically forces the FEP5 card to reset itself.
  */
@@ -5027,13 +4585,9 @@ static void dgap_do_reset_board(struct board_t *brd)
        u32 check2;
        int i = 0;
 
-       if (!brd || (brd->magic != DGAP_BOARD_MAGIC) || !brd->re_map_membase || !brd->re_map_port) {
-               DPR_INIT(("dgap_do_reset_board() start. bad values. brd: %p mem: %p io: %p\n",
-                       brd, brd ? brd->re_map_membase : 0, brd ? brd->re_map_port : 0));
+       if (!brd || (brd->magic != DGAP_BOARD_MAGIC) ||
+           !brd->re_map_membase || !brd->re_map_port)
                return;
-       }
-
-       DPR_INIT(("dgap_do_reset_board() start. io: %p\n", brd->re_map_port));
 
        /* FEPRST does not vary among supported boards */
        writeb(FEPRST, brd->re_map_port);
@@ -5046,10 +4600,10 @@ static void dgap_do_reset_board(struct board_t *brd)
 
        }
        if (i > 1000) {
-               APR(("*** WARNING *** Board not resetting...  Failing board.\n"));
+               pr_warn("dgap: Board not resetting...  Failing board.\n");
                brd->state = BOARD_FAILED;
                brd->dpastatus = BD_NOFEP;
-               goto failed;
+               return;
        }
 
        /*
@@ -5061,20 +4615,17 @@ static void dgap_do_reset_board(struct board_t *brd)
        check2 = readl(brd->re_map_membase + HIGHMEM);
 
        if ((check1 != 0xa55a3cc3) || (check2 != 0x5aa5c33c)) {
-               APR(("*** Warning *** No memory at %p for board.\n", brd->re_map_membase));
+               pr_warn("dgap: No memory at %p for board.\n",
+                       brd->re_map_membase);
                brd->state = BOARD_FAILED;
                brd->dpastatus = BD_NOFEP;
-               goto failed;
+               return;
        }
 
        if (brd->state != BOARD_FAILED)
                brd->state = FINISHED_RESET;
-
-failed:
-       DPR_INIT(("dgap_do_reset_board() finish\n"));
 }
 
-
 #ifdef DIGI_CONCENTRATORS_SUPPORTED
 /*
  * Sends a concentrator image into the FEP5 board.
@@ -5205,7 +4756,6 @@ static void dgap_get_vpd(struct board_t *brd)
        pci_write_config_dword(brd->pdev, PCI_ROM_ADDRESS, magic);
 }
 
-
 /*
  * Our board poller function.
  */
@@ -5217,10 +4767,8 @@ static void dgap_poll_tasklet(unsigned long data)
        char *vaddr;
        u16 head, tail;
 
-       if (!bd || (bd->magic != DGAP_BOARD_MAGIC)) {
-               APR(("dgap_poll_tasklet() - NULL or bad bd.\n"));
+       if (!bd || (bd->magic != DGAP_BOARD_MAGIC))
                return;
-       }
 
        if (bd->inhibit_poller)
                return;
@@ -5245,9 +4793,8 @@ static void dgap_poll_tasklet(unsigned long data)
                        return;
                }
 
-               if (!bd->nasync) {
+               if (!bd->nasync)
                        goto out;
-               }
 
                eaddr = (struct ev_t *) (vaddr + EVBUF);
 
@@ -5268,9 +4815,8 @@ out:
                /*
                 * If board is doing interrupts, ACK the interrupt.
                 */
-               if (bd && bd->intr_running) {
+               if (bd && bd->intr_running)
                        readb(bd->re_map_port + 2);
-               }
 
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
                return;
@@ -5288,9 +4834,8 @@ out:
        }
 
        /* Move to next state */
-       if (bd->state == FINISHED_RESET) {
+       if (bd->state == FINISHED_RESET)
                bd->state = NEED_CONFIG;
-       }
 
        if (bd->state == NEED_CONFIG) {
                /*
@@ -5304,25 +4849,21 @@ out:
                 * back, and this is a PAPORT8 board, retry with a
                 * PAPORT4 attempt as well.
                 */
-               if (bd->type == PAPORT8 && !bd->bd_config) {
+               if (bd->type == PAPORT8 && !bd->bd_config)
                        bd->bd_config = dgap_find_config(PAPORT4, bd->pci_bus, bd->pci_slot);
-               }
 
                /*
                 * Register the ttys (if any) into the kernel.
                 */
-               if (bd->bd_config) {
+               if (bd->bd_config)
                        bd->state = FINISHED_CONFIG;
-               }
-               else {
+               else
                        bd->state = CONFIG_NOT_FOUND;
-               }
        }
 
        /* Move to next state */
-       if (bd->state == FINISHED_CONFIG) {
+       if (bd->state == FINISHED_CONFIG)
                bd->state = NEED_DEVICE_CREATION;
-       }
 
        /* Move to next state */
        if (bd->state == NEED_DEVICE_CREATION) {
@@ -5338,9 +4879,8 @@ out:
        }
 
        /* Move to next state */
-       if (bd->state == FINISHED_DEVICE_CREATION) {
+       if (bd->state == FINISHED_DEVICE_CREATION)
                bd->state = NEED_BIOS_LOAD;
-       }
 
        /* Move to next state */
        if (bd->state == NEED_BIOS_LOAD) {
@@ -5356,9 +4896,8 @@ out:
        }
 
        /* Wait for BIOS to test board... */
-       if (bd->state == WAIT_BIOS_LOAD) {
+       if (bd->state == WAIT_BIOS_LOAD)
                dgap_do_wait_for_bios(bd);
-       }
 
        /* Move to next state */
        if (bd->state == FINISHED_BIOS_LOAD) {
@@ -5376,10 +4915,8 @@ out:
        }
 
        /* Wait for FEP to load on board... */
-       if (bd->state == WAIT_FEP_LOAD) {
+       if (bd->state == WAIT_FEP_LOAD)
                dgap_do_wait_for_fep(bd);
-       }
-
 
        /* Move to next state */
        if (bd->state == FINISHED_FEP_LOAD) {
@@ -5391,11 +4928,9 @@ out:
 
                if (rc < 0) {
                        dgap_tty_uninit(bd);
-                       APR(("Can't init tty devices (%d)\n", rc));
                        bd->state = BOARD_FAILED;
                        bd->dpastatus = BD_NOFEP;
-               }
-               else {
+               } else {
                        bd->state = NEED_PROC_CREATION;
 
                        /*
@@ -5436,7 +4971,6 @@ out:
        DGAP_UNLOCK(bd->bd_lock, lock_flags);
 }
 
-
 /*=======================================================================
  *
  *      dgap_cmdb - Sends a 2 byte command to the FEP.
@@ -5464,10 +4998,8 @@ static void dgap_cmdb(struct channel_t *ch, uchar cmd, uchar byte1, uchar byte2,
        /*
         * Check if board is still alive.
         */
-       if (ch->ch_bd->state == BOARD_FAILED) {
-               DPR_CORE(("%s:%d board is in failed state.\n", __FILE__, __LINE__));
+       if (ch->ch_bd->state == BOARD_FAILED)
                return;
-       }
 
        /*
         * Make sure the pointers are in range before
@@ -5485,7 +5017,6 @@ static void dgap_cmdb(struct channel_t *ch, uchar cmd, uchar byte1, uchar byte2,
         * Forget it if pointers out of range.
         */
        if (head >= (CMDMAX - CMDSTART) || (head & 03)) {
-               DPR_CORE(("%s:%d pointers out of range, failing board!\n", __FILE__, __LINE__));
                ch->ch_bd->state = BOARD_FAILED;
                return;
        }
@@ -5519,7 +5050,6 @@ static void dgap_cmdb(struct channel_t *ch, uchar cmd, uchar byte1, uchar byte2,
                        break;
 
                if (--count == 0) {
-                       DPR_CORE(("%s:%d failing board.\n",__FILE__, __LINE__));
                        ch->ch_bd->state = BOARD_FAILED;
                        return;
                }
@@ -5527,7 +5057,6 @@ static void dgap_cmdb(struct channel_t *ch, uchar cmd, uchar byte1, uchar byte2,
        }
 }
 
-
 /*=======================================================================
  *
  *      dgap_cmdw - Sends a 1 word command to the FEP.
@@ -5554,10 +5083,8 @@ static void dgap_cmdw(struct channel_t *ch, uchar cmd, u16 word, uint ncmds)
        /*
         * Check if board is still alive.
         */
-       if (ch->ch_bd->state == BOARD_FAILED) {
-               DPR_CORE(("%s:%d board is failed!\n", __FILE__, __LINE__));
+       if (ch->ch_bd->state == BOARD_FAILED)
                return;
-       }
 
        /*
         * Make sure the pointers are in range before
@@ -5574,7 +5101,6 @@ static void dgap_cmdw(struct channel_t *ch, uchar cmd, u16 word, uint ncmds)
         * Forget it if pointers out of range.
         */
        if (head >= (CMDMAX - CMDSTART) || (head & 03)) {
-               DPR_CORE(("%s:%d Pointers out of range.  Failing board.\n",__FILE__, __LINE__));
                ch->ch_bd->state = BOARD_FAILED;
                return;
        }
@@ -5607,7 +5133,6 @@ static void dgap_cmdw(struct channel_t *ch, uchar cmd, u16 word, uint ncmds)
                        break;
 
                if (--count == 0) {
-                       DPR_CORE(("%s:%d Failing board.\n",__FILE__, __LINE__));
                        ch->ch_bd->state = BOARD_FAILED;
                        return;
                }
@@ -5615,8 +5140,6 @@ static void dgap_cmdw(struct channel_t *ch, uchar cmd, u16 word, uint ncmds)
        }
 }
 
-
-
 /*=======================================================================
  *
  *      dgap_cmdw_ext - Sends a extended word command to the FEP.
@@ -5643,10 +5166,8 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)
        /*
         * Check if board is still alive.
         */
-       if (ch->ch_bd->state == BOARD_FAILED) {
-               DPR_CORE(("%s:%d board is failed!\n", __FILE__, __LINE__));
+       if (ch->ch_bd->state == BOARD_FAILED)
                return;
-       }
 
        /*
         * Make sure the pointers are in range before
@@ -5663,7 +5184,6 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)
         * Forget it if pointers out of range.
         */
        if (head >= (CMDMAX - CMDSTART) || (head & 03)) {
-               DPR_CORE(("%s:%d Pointers out of range.  Failing board.\n",__FILE__, __LINE__));
                ch->ch_bd->state = BOARD_FAILED;
                return;
        }
@@ -5682,11 +5202,10 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)
         * If the second part of the command won't fit,
         * put it at the beginning of the circular buffer.
         */
-       if (((head + 4) >= ((CMDMAX - CMDSTART)) || (head & 03))) {
+       if (((head + 4) >= ((CMDMAX - CMDSTART)) || (head & 03)))
                writew((u16) word, (char *) (vaddr + CMDSTART));
-       } else {
+       else
                writew((u16) word, (char *) (vaddr + head + CMDSTART + 4));
-       }
 
        head = (head + 8) & (CMDMAX - CMDSTART - 4);
 
@@ -5709,7 +5228,6 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)
                        break;
 
                if (--count == 0) {
-                       DPR_CORE(("%s:%d Failing board.\n",__FILE__, __LINE__));
                        ch->ch_bd->state = BOARD_FAILED;
                        return;
                }
@@ -5717,7 +5235,6 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)
        }
 }
 
-
 /*=======================================================================
  *
  *      dgap_wmove - Write data to FEP buffer.
@@ -5746,10 +5263,9 @@ static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt)
        /*
         * If pointers are out of range, just return.
         */
-       if ((cnt > ch->ch_tsize) || (unsigned)(head - ch->ch_tstart) >= ch->ch_tsize) {
-               DPR_CORE(("%s:%d pointer out of range", __FILE__, __LINE__));
+       if ((cnt > ch->ch_tsize) ||
+           (unsigned)(head - ch->ch_tstart) >= ch->ch_tsize)
                return;
-       }
 
        /*
         * If the write wraps over the top of the circular buffer,
@@ -5788,13 +5304,11 @@ static uint dgap_get_custom_baud(struct channel_t *ch)
        ulong offset = 0;
        uint value = 0;
 
-       if (!ch || ch->magic != DGAP_CHANNEL_MAGIC) {
+       if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
                return 0;
-       }
 
-       if (!ch->ch_bd || ch->ch_bd->magic != DGAP_BOARD_MAGIC) {
+       if (!ch->ch_bd || ch->ch_bd->magic != DGAP_BOARD_MAGIC)
                return 0;
-       }
 
        if (!(ch->ch_bd->bd_flags & BD_FEP5PLUS))
                return 0;
@@ -5815,7 +5329,6 @@ static uint dgap_get_custom_baud(struct channel_t *ch)
        return value;
 }
 
-
 /*
  * Calls the firmware to reset this channel.
  */
@@ -5842,7 +5355,6 @@ static void dgap_firmware_reset_port(struct channel_t *ch)
        ch->ch_hflow = 0;
 }
 
-
 /*=======================================================================
  *
  *      dgap_param - Set Digi parameters.
@@ -5882,9 +5394,6 @@ static int dgap_param(struct tty_struct *tty)
        if (!bs)
                return -ENXIO;
 
-       DPR_PARAM(("param start: tdev: %x cflags: %x oflags: %x iflags: %x\n",
-               ch->ch_tun.un_dev, ch->ch_c_cflag, ch->ch_c_oflag, ch->ch_c_iflag));
-
        ts = &tty->termios;
 
        /*
@@ -5912,8 +5421,6 @@ static int dgap_param(struct tty_struct *tty)
                 * Tell the fep to do the command
                 */
 
-               DPR_PARAM(("param: Want %d speed\n", ch->ch_custom_speed));
-
                dgap_cmdw_ext(ch, 0xff01, ch->ch_custom_speed, 0);
 
                /*
@@ -5922,8 +5429,6 @@ static int dgap_param(struct tty_struct *tty)
                 */
                ch->ch_baud_info = ch->ch_custom_speed = dgap_get_custom_baud(ch);
 
-               DPR_PARAM(("param: Got %d speed\n", ch->ch_custom_speed));
-
                /* Handle transition from B0 */
                if (ch->ch_flags & CH_BAUD0) {
                        ch->ch_flags &= ~(CH_BAUD0);
@@ -5978,20 +5483,17 @@ static int dgap_param(struct tty_struct *tty)
 
                jindex = baud;
 
-               if ((iindex >= 0) && (iindex < 4) && (jindex >= 0) && (jindex < 16)) {
+               if ((iindex >= 0) && (iindex < 4) &&
+                   (jindex >= 0) && (jindex < 16))
                        baud = bauds[iindex][jindex];
-               } else {
-                       DPR_IOCTL(("baud indices were out of range (%d)(%d)",
-                               iindex, jindex));
+               else
                        baud = 0;
-               }
 
                if (baud == 0)
                        baud = 9600;
 
                ch->ch_baud_info = baud;
 
-
                /*
                 * CBAUD has bit position 0x1000 set these days to indicate Linux
                 * baud rate remap.
@@ -6007,38 +5509,39 @@ static int dgap_param(struct tty_struct *tty)
                if ((ch->ch_digi.digi_flags & DIGI_FAST) || (ch->ch_c_cflag & CBAUDEX))
                        cflag |= HUPCL;
 
-
-               if ((ch->ch_c_cflag & CBAUDEX) && !(ch->ch_digi.digi_flags & DIGI_FAST)) {
-               /*
-                * The below code is trying to guarantee that only baud rates
-                * 115200, 230400, 460800, 921600 are remapped.  We use exclusive or
-                * because the various baud rates share common bit positions
-                * and therefore can't be tested for easily.
-                */
+               if ((ch->ch_c_cflag & CBAUDEX) &&
+                   !(ch->ch_digi.digi_flags & DIGI_FAST)) {
+                       /*
+                        * The below code is trying to guarantee that only
+                        * baud rates 115200, 230400, 460800, 921600 are
+                        * remapped. We use exclusive or  because the various
+                        * baud rates share common bit positions and therefore
+                        * can't be tested for easily.
+                        */
                        tcflag_t tcflag = (ch->ch_c_cflag & CBAUD) | CBAUDEX;
                        int baudpart = 0;
 
                        /* Map high speed requests to index into FEP's baud table */
                        switch (tcflag) {
-                       case B57600 :
+                       case B57600:
                                baudpart = 1;
                                break;
 #ifdef B76800
-                       case B76800 :
+                       case B76800:
                                baudpart = 2;
                                break;
 #endif
-                       case B115200 :
+                       case B115200:
                                baudpart = 3;
                                break;
-                       case B230400 :
+                       case B230400:
                                baudpart = 9;
                                break;
-                       case B460800 :
+                       case B460800:
                                baudpart = 11;
                                break;
 #ifdef B921600
-                       case B921600 :
+                       case B921600:
                                baudpart = 12;
                                break;
 #endif
@@ -6081,7 +5584,7 @@ static int dgap_param(struct tty_struct *tty)
         * Only the IBM Xr card can switch between
         * 232 and 422 modes on the fly
         */
-       if (bd->device == PCI_DEVICE_XR_IBM_DID) {
+       if (bd->device == PCI_DEV_XR_IBM_DID) {
                if (ch->ch_digi.digi_flags & DIGI_422)
                        dgap_cmdb(ch, SCOMMODE, MODE_422, 0, 0);
                else
@@ -6089,7 +5592,7 @@ static int dgap_param(struct tty_struct *tty)
        }
 
        if (ch->ch_digi.digi_flags & DIGI_ALTPIN)
-               iflag |= IALTPIN ;
+               iflag |= IALTPIN;
 
        if (iflag != ch->ch_fepiflag) {
                ch->ch_fepiflag = iflag;
@@ -6103,9 +5606,8 @@ static int dgap_param(struct tty_struct *tty)
         */
        hflow = 0;
 
-       if (ch->ch_c_cflag & CRTSCTS) {
+       if (ch->ch_c_cflag & CRTSCTS)
                hflow |= (D_RTS(ch) | D_CTS(ch));
-       }
        if (ch->ch_digi.digi_flags & RTSPACE)
                hflow |= D_RTS(ch);
        if (ch->ch_digi.digi_flags & DTRPACE)
@@ -6130,12 +5632,10 @@ static int dgap_param(struct tty_struct *tty)
         */
        if (bd->bd_flags & BD_FEP5PLUS) {
                u16 hflow2 = 0;
-               if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
+               if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE)
                        hflow2 |= (D_RTS(ch));
-               }
-               if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
+               if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE)
                        hflow2 |= (D_DTR(ch));
-               }
 
                dgap_cmdw_ext(ch, 0xff03, hflow2, 0);
        }
@@ -6146,14 +5646,10 @@ static int dgap_param(struct tty_struct *tty)
 
        mval ^= ch->ch_mforce & (mval ^ ch->ch_mval);
 
-       DPR_PARAM(("dgap_param: mval: %x ch_mforce: %x ch_mval: %x ch_mostat: %x\n",
-               mval, ch->ch_mforce, ch->ch_mval, ch->ch_mostat));
-
        if (ch->ch_mostat ^ mval) {
                ch->ch_mostat = mval;
 
                /* Okay to have channel and board locks held calling this */
-               DPR_PARAM(("dgap_param: Sending SMODEM mval: %x\n", mval));
                dgap_cmdb(ch, SMODEM, (uchar) mval, D_RTS(ch)|D_DTR(ch), 0);
        }
 
@@ -6185,12 +5681,9 @@ static int dgap_param(struct tty_struct *tty)
                dgap_cmdb(ch, SAFLOWC, ch->ch_fepastartc, ch->ch_fepastopc, 0);
        }
 
-       DPR_PARAM(("param finish\n"));
-
        return 0;
 }
 
-
 /*
  * dgap_parity_scan()
  *
@@ -6208,8 +5701,6 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf, unsigned
        cout = cbuf;
        fout = fbuf;
 
-       DPR_PSCAN(("dgap_parity_scan start\n"));
-
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
                return;
 
@@ -6222,10 +5713,10 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf, unsigned
 
                case 0:
                        /* No FF seen yet */
-                       if (c == (unsigned char) '\377') {
+                       if (c == (unsigned char) '\377')
                                /* delete this character from stream */
                                ch->pscan_state = 1;
-                       else {
+                       else {
                                *cout++ = c;
                                *fout++ = TTY_NORMAL;
                                count += 1;
@@ -6255,31 +5746,21 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf, unsigned
                        if (ch->pscan_savechar == 0x0) {
 
                                if (c == 0x0) {
-                                       DPR_PSCAN(("dgap_parity_scan in 3rd char of ff seq. c: %x setting break.\n", c));
                                        ch->ch_err_break++;
                                        *fout++ = TTY_BREAK;
-                               }
-                               else {
-                                       DPR_PSCAN(("dgap_parity_scan in 3rd char of ff seq. c: %x setting parity.\n", c));
+                               } else {
                                        ch->ch_err_parity++;
                                        *fout++ = TTY_PARITY;
                                }
                        }
-                       else {
-                               DPR_PSCAN(("%s:%d Logic Error.\n", __FILE__, __LINE__));
-                       }
 
                        count += 1;
                        ch->pscan_state = 0;
                }
        }
        *len = count;
-       DPR_PSCAN(("dgap_parity_scan finish\n"));
 }
 
-
-
-
 /*=======================================================================
  *
  *      dgap_event - FEP to host event processing routine.
@@ -6327,7 +5808,6 @@ static int dgap_event(struct board_t *bd)
 
        if (head >= EVMAX - EVSTART || tail >= EVMAX - EVSTART ||
            (head | tail) & 03) {
-               DPR_EVENT(("should be calling xxfail %d\n", __LINE__));
                /* Let go of board lock */
                DGAP_UNLOCK(bd->bd_lock, lock_flags);
                return -ENXIO;
@@ -6349,24 +5829,19 @@ static int dgap_event(struct board_t *bd)
                modem  = event[2];
                b1     = event[3];
 
-               DPR_EVENT(("event: jiffies: %ld port: %d reason: %x modem: %x\n",
-                       jiffies, port, reason, modem));
-
                /*
                 * Make sure the interrupt is valid.
                 */
                if (port >= bd->nasync)
                        goto next;
 
-               if (!(reason & (IFMODEM | IFBREAK | IFTLW | IFTEM | IFDATA))) {
+               if (!(reason & (IFMODEM | IFBREAK | IFTLW | IFTEM | IFDATA)))
                        goto next;
-               }
 
                ch = bd->channels[port];
 
-               if (!ch || ch->magic != DGAP_CHANNEL_MAGIC) {
+               if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
                        goto next;
-               }
 
                /*
                 * If we have made it here, the event was valid.
@@ -6424,8 +5899,6 @@ static int dgap_event(struct board_t *bd)
                 */
                if (reason & IFBREAK) {
 
-                       DPR_EVENT(("got IFBREAK\n"));
-
                        if (ch->ch_tun.un_tty) {
                                /* A break has been indicated */
                                ch->ch_err_break++;
@@ -6440,16 +5913,13 @@ static int dgap_event(struct board_t *bd)
                 */
                if (reason & IFTLW) {
 
-                       DPR_EVENT(("event: got low event\n"));
-
                        if (ch->ch_tun.un_flags & UN_LOW) {
                                ch->ch_tun.un_flags &= ~UN_LOW;
 
                                if (ch->ch_tun.un_flags & UN_ISOPEN) {
                                        if ((ch->ch_tun.un_tty->flags &
                                           (1 << TTY_DO_WRITE_WAKEUP)) &&
-                                               ch->ch_tun.un_tty->ldisc->ops->write_wakeup)
-                                       {
+                                               ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
                                                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                                                DGAP_UNLOCK(bd->bd_lock, lock_flags);
                                                (ch->ch_tun.un_tty->ldisc->ops->write_wakeup)(ch->ch_tun.un_tty);
@@ -6458,8 +5928,6 @@ static int dgap_event(struct board_t *bd)
                                        }
                                        wake_up_interruptible(&ch->ch_tun.un_tty->write_wait);
                                        wake_up_interruptible(&ch->ch_tun.un_flags_wait);
-
-                                       DPR_EVENT(("event: Got low event. jiffies: %lu\n", jiffies));
                                }
                        }
 
@@ -6468,8 +5936,7 @@ static int dgap_event(struct board_t *bd)
                                if (ch->ch_pun.un_flags & UN_ISOPEN) {
                                        if ((ch->ch_pun.un_tty->flags &
                                           (1 << TTY_DO_WRITE_WAKEUP)) &&
-                                               ch->ch_pun.un_tty->ldisc->ops->write_wakeup)
-                                       {
+                                               ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
                                                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                                                DGAP_UNLOCK(bd->bd_lock, lock_flags);
                                                (ch->ch_pun.un_tty->ldisc->ops->write_wakeup)(ch->ch_pun.un_tty);
@@ -6491,15 +5958,12 @@ static int dgap_event(struct board_t *bd)
                 * Process Transmit empty.
                 */
                if (reason & IFTEM) {
-                       DPR_EVENT(("event: got empty event\n"));
-
                        if (ch->ch_tun.un_flags & UN_EMPTY) {
                                ch->ch_tun.un_flags &= ~UN_EMPTY;
                                if (ch->ch_tun.un_flags & UN_ISOPEN) {
                                        if ((ch->ch_tun.un_tty->flags &
                                           (1 << TTY_DO_WRITE_WAKEUP)) &&
-                                               ch->ch_tun.un_tty->ldisc->ops->write_wakeup)
-                                       {
+                                               ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
                                                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                                                DGAP_UNLOCK(bd->bd_lock, lock_flags);
 
@@ -6517,8 +5981,7 @@ static int dgap_event(struct board_t *bd)
                                if (ch->ch_pun.un_flags & UN_ISOPEN) {
                                        if ((ch->ch_pun.un_tty->flags &
                                           (1 << TTY_DO_WRITE_WAKEUP)) &&
-                                               ch->ch_pun.un_tty->ldisc->ops->write_wakeup)
-                                       {
+                                               ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
                                                DGAP_UNLOCK(ch->ch_lock, lock_flags2);
                                                DGAP_UNLOCK(bd->bd_lock, lock_flags);
                                                (ch->ch_pun.un_tty->ldisc->ops->write_wakeup)(ch->ch_pun.un_tty);
@@ -6583,33 +6046,6 @@ static ssize_t dgap_driver_state_show(struct device_driver *ddp, char *buf)
 }
 static DRIVER_ATTR(state, S_IRUSR, dgap_driver_state_show, NULL);
 
-
-static ssize_t dgap_driver_debug_show(struct device_driver *ddp, char *buf)
-{
-       return snprintf(buf, PAGE_SIZE, "0x%x\n", dgap_debug);
-}
-
-static ssize_t dgap_driver_debug_store(struct device_driver *ddp, const char *buf, size_t count)
-{
-       sscanf(buf, "0x%x\n", &dgap_debug);
-       return count;
-}
-static DRIVER_ATTR(debug, (S_IRUSR | S_IWUSR), dgap_driver_debug_show, dgap_driver_debug_store);
-
-
-static ssize_t dgap_driver_rawreadok_show(struct device_driver *ddp, char *buf)
-{
-       return snprintf(buf, PAGE_SIZE, "0x%x\n", dgap_rawreadok);
-}
-
-static ssize_t dgap_driver_rawreadok_store(struct device_driver *ddp, const char *buf, size_t count)
-{
-       sscanf(buf, "0x%x\n", &dgap_rawreadok);
-       return count;
-}
-static DRIVER_ATTR(rawreadok, (S_IRUSR | S_IWUSR), dgap_driver_rawreadok_show, dgap_driver_rawreadok_store);
-
-
 static ssize_t dgap_driver_pollrate_show(struct device_driver *ddp, char *buf)
 {
        return snprintf(buf, PAGE_SIZE, "%dms\n", dgap_poll_tick);
@@ -6617,12 +6053,12 @@ static ssize_t dgap_driver_pollrate_show(struct device_driver *ddp, char *buf)
 
 static ssize_t dgap_driver_pollrate_store(struct device_driver *ddp, const char *buf, size_t count)
 {
-       sscanf(buf, "%d\n", &dgap_poll_tick);
+       if (sscanf(buf, "%d\n", &dgap_poll_tick) != 1)
+               return -EINVAL;
        return count;
 }
 static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgap_driver_pollrate_show, dgap_driver_pollrate_store);
 
-
 static void dgap_create_driver_sysfiles(struct pci_driver *dgap_driver)
 {
        int rc = 0;
@@ -6631,41 +6067,37 @@ static void dgap_create_driver_sysfiles(struct pci_driver *dgap_driver)
        rc |= driver_create_file(driverfs, &driver_attr_version);
        rc |= driver_create_file(driverfs, &driver_attr_boards);
        rc |= driver_create_file(driverfs, &driver_attr_maxboards);
-       rc |= driver_create_file(driverfs, &driver_attr_debug);
-       rc |= driver_create_file(driverfs, &driver_attr_rawreadok);
        rc |= driver_create_file(driverfs, &driver_attr_pollrate);
        rc |= driver_create_file(driverfs, &driver_attr_pollcounter);
        rc |= driver_create_file(driverfs, &driver_attr_state);
-       if (rc) {
+       if (rc)
                printk(KERN_ERR "DGAP: sysfs driver_create_file failed!\n");
-       }
 }
 
-
 static void dgap_remove_driver_sysfiles(struct pci_driver *dgap_driver)
 {
        struct device_driver *driverfs = &dgap_driver->driver;
        driver_remove_file(driverfs, &driver_attr_version);
        driver_remove_file(driverfs, &driver_attr_boards);
        driver_remove_file(driverfs, &driver_attr_maxboards);
-       driver_remove_file(driverfs, &driver_attr_debug);
-       driver_remove_file(driverfs, &driver_attr_rawreadok);
        driver_remove_file(driverfs, &driver_attr_pollrate);
        driver_remove_file(driverfs, &driver_attr_pollcounter);
        driver_remove_file(driverfs, &driver_attr_state);
 }
 
+static struct board_t *dgap_verify_board(struct device *p)
+{
+       struct board_t *bd;
+
+       if (!p)
+               return NULL;
 
-#define DGAP_VERIFY_BOARD(p, bd)                       \
-       if (!p)                                         \
-               return (0);                             \
-                                                       \
-       bd = dev_get_drvdata(p);                        \
-       if (!bd || bd->magic != DGAP_BOARD_MAGIC)       \
-               return (0);                             \
-       if (bd->state != BOARD_READY)                   \
-               return (0);                             \
+       bd = dev_get_drvdata(p);
+       if (!bd || bd->magic != DGAP_BOARD_MAGIC || bd->state != BOARD_READY)
+               return NULL;
 
+       return bd;
+}
 
 static ssize_t dgap_ports_state_show(struct device *p, struct device_attribute *attr, char *buf)
 {
@@ -6673,7 +6105,9 @@ static ssize_t dgap_ports_state_show(struct device *p, struct device_attribute *
        int count = 0;
        int i = 0;
 
-       DGAP_VERIFY_BOARD(p, bd);
+       bd = dgap_verify_board(p);
+       if (!bd)
+               return 0;
 
        for (i = 0; i < bd->nasync; i++) {
                count += snprintf(buf + count, PAGE_SIZE - count,
@@ -6684,14 +6118,15 @@ static ssize_t dgap_ports_state_show(struct device *p, struct device_attribute *
 }
 static DEVICE_ATTR(ports_state, S_IRUSR, dgap_ports_state_show, NULL);
 
-
 static ssize_t dgap_ports_baud_show(struct device *p, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
        int count = 0;
        int i = 0;
 
-       DGAP_VERIFY_BOARD(p, bd);
+       bd = dgap_verify_board(p);
+       if (!bd)
+               return 0;
 
        for (i = 0; i < bd->nasync; i++) {
                count +=  snprintf(buf + count, PAGE_SIZE - count,
@@ -6701,17 +6136,18 @@ static ssize_t dgap_ports_baud_show(struct device *p, struct device_attribute *a
 }
 static DEVICE_ATTR(ports_baud, S_IRUSR, dgap_ports_baud_show, NULL);
 
-
 static ssize_t dgap_ports_msignals_show(struct device *p, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
        int count = 0;
        int i = 0;
 
-       DGAP_VERIFY_BOARD(p, bd);
+       bd = dgap_verify_board(p);
+       if (!bd)
+               return 0;
 
        for (i = 0; i < bd->nasync; i++) {
-               if (bd->channels[i]->ch_open_count) {
+               if (bd->channels[i]->ch_open_count)
                        count += snprintf(buf + count, PAGE_SIZE - count,
                                "%d %s %s %s %s %s %s\n", bd->channels[i]->ch_portnum,
                                (bd->channels[i]->ch_mostat & UART_MCR_RTS) ? "RTS" : "",
@@ -6720,135 +6156,133 @@ static ssize_t dgap_ports_msignals_show(struct device *p, struct device_attribut
                                (bd->channels[i]->ch_mistat & UART_MSR_DSR) ? "DSR" : "",
                                (bd->channels[i]->ch_mistat & UART_MSR_DCD) ? "DCD" : "",
                                (bd->channels[i]->ch_mistat & UART_MSR_RI)  ? "RI"  : "");
-               } else {
+               else
                        count += snprintf(buf + count, PAGE_SIZE - count,
                                "%d\n", bd->channels[i]->ch_portnum);
-               }
        }
        return count;
 }
 static DEVICE_ATTR(ports_msignals, S_IRUSR, dgap_ports_msignals_show, NULL);
 
-
 static ssize_t dgap_ports_iflag_show(struct device *p, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
        int count = 0;
        int i = 0;
 
-       DGAP_VERIFY_BOARD(p, bd);
+       bd = dgap_verify_board(p);
+       if (!bd)
+               return 0;
 
-       for (i = 0; i < bd->nasync; i++) {
+       for (i = 0; i < bd->nasync; i++)
                count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
                        bd->channels[i]->ch_portnum, bd->channels[i]->ch_c_iflag);
-       }
        return count;
 }
 static DEVICE_ATTR(ports_iflag, S_IRUSR, dgap_ports_iflag_show, NULL);
 
-
 static ssize_t dgap_ports_cflag_show(struct device *p, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
        int count = 0;
        int i = 0;
 
-       DGAP_VERIFY_BOARD(p, bd);
+       bd = dgap_verify_board(p);
+       if (!bd)
+               return 0;
 
-       for (i = 0; i < bd->nasync; i++) {
+       for (i = 0; i < bd->nasync; i++)
                count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
                        bd->channels[i]->ch_portnum, bd->channels[i]->ch_c_cflag);
-       }
        return count;
 }
 static DEVICE_ATTR(ports_cflag, S_IRUSR, dgap_ports_cflag_show, NULL);
 
-
 static ssize_t dgap_ports_oflag_show(struct device *p, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
        int count = 0;
        int i = 0;
 
-       DGAP_VERIFY_BOARD(p, bd);
+       bd = dgap_verify_board(p);
+       if (!bd)
+               return 0;
 
-       for (i = 0; i < bd->nasync; i++) {
+       for (i = 0; i < bd->nasync; i++)
                count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
                        bd->channels[i]->ch_portnum, bd->channels[i]->ch_c_oflag);
-       }
        return count;
 }
 static DEVICE_ATTR(ports_oflag, S_IRUSR, dgap_ports_oflag_show, NULL);
 
-
 static ssize_t dgap_ports_lflag_show(struct device *p, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
        int count = 0;
        int i = 0;
 
-       DGAP_VERIFY_BOARD(p, bd);
+       bd = dgap_verify_board(p);
+       if (!bd)
+               return 0;
 
-       for (i = 0; i < bd->nasync; i++) {
+       for (i = 0; i < bd->nasync; i++)
                count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
                        bd->channels[i]->ch_portnum, bd->channels[i]->ch_c_lflag);
-       }
        return count;
 }
 static DEVICE_ATTR(ports_lflag, S_IRUSR, dgap_ports_lflag_show, NULL);
 
-
 static ssize_t dgap_ports_digi_flag_show(struct device *p, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
        int count = 0;
        int i = 0;
 
-       DGAP_VERIFY_BOARD(p, bd);
+       bd = dgap_verify_board(p);
+       if (!bd)
+               return 0;
 
-       for (i = 0; i < bd->nasync; i++) {
+       for (i = 0; i < bd->nasync; i++)
                count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
                        bd->channels[i]->ch_portnum, bd->channels[i]->ch_digi.digi_flags);
-       }
        return count;
 }
 static DEVICE_ATTR(ports_digi_flag, S_IRUSR, dgap_ports_digi_flag_show, NULL);
 
-
 static ssize_t dgap_ports_rxcount_show(struct device *p, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
        int count = 0;
        int i = 0;
 
-       DGAP_VERIFY_BOARD(p, bd);
+       bd = dgap_verify_board(p);
+       if (!bd)
+               return 0;
 
-       for (i = 0; i < bd->nasync; i++) {
+       for (i = 0; i < bd->nasync; i++)
                count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n",
                        bd->channels[i]->ch_portnum, bd->channels[i]->ch_rxcount);
-       }
        return count;
 }
 static DEVICE_ATTR(ports_rxcount, S_IRUSR, dgap_ports_rxcount_show, NULL);
 
-
 static ssize_t dgap_ports_txcount_show(struct device *p, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
        int count = 0;
        int i = 0;
 
-       DGAP_VERIFY_BOARD(p, bd);
+       bd = dgap_verify_board(p);
+       if (!bd)
+               return 0;
 
-       for (i = 0; i < bd->nasync; i++) {
+       for (i = 0; i < bd->nasync; i++)
                count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n",
                        bd->channels[i]->ch_portnum, bd->channels[i]->ch_txcount);
-       }
        return count;
 }
 static DEVICE_ATTR(ports_txcount, S_IRUSR, dgap_ports_txcount_show, NULL);
 
-
 /* this function creates the sys files that will export each signal status
  * to sysfs each value will be put in a separate filename
  */
@@ -6867,12 +6301,10 @@ static void dgap_create_ports_sysfiles(struct board_t *bd)
        rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_digi_flag);
        rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_rxcount);
        rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_txcount);
-       if (rc) {
+       if (rc)
                printk(KERN_ERR "DGAP: sysfs device_create_file failed!\n");
-       }
 }
 
-
 /* removes all the sys files created for that port */
 static void dgap_remove_ports_sysfiles(struct board_t *bd)
 {
@@ -6888,7 +6320,6 @@ static void dgap_remove_ports_sysfiles(struct board_t *bd)
        device_remove_file(&(bd->pdev->dev), &dev_attr_ports_txcount);
 }
 
-
 static ssize_t dgap_tty_state_show(struct device *d, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
@@ -6896,24 +6327,23 @@ static ssize_t dgap_tty_state_show(struct device *d, struct device_attribute *at
        struct un_t *un;
 
        if (!d)
-               return (0);
+               return 0;
        un = dev_get_drvdata(d);
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
        if (bd->state != BOARD_READY)
-               return (0);
+               return 0;
 
        return snprintf(buf, PAGE_SIZE, "%s", un->un_open_count ? "Open" : "Closed");
 }
 static DEVICE_ATTR(state, S_IRUSR, dgap_tty_state_show, NULL);
 
-
 static ssize_t dgap_tty_baud_show(struct device *d, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
@@ -6921,24 +6351,23 @@ static ssize_t dgap_tty_baud_show(struct device *d, struct device_attribute *att
        struct un_t *un;
 
        if (!d)
-               return (0);
+               return 0;
        un = dev_get_drvdata(d);
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
        if (bd->state != BOARD_READY)
-               return (0);
+               return 0;
 
        return snprintf(buf, PAGE_SIZE, "%d\n", ch->ch_baud_info);
 }
 static DEVICE_ATTR(baud, S_IRUSR, dgap_tty_baud_show, NULL);
 
-
 static ssize_t dgap_tty_msignals_show(struct device *d, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
@@ -6946,18 +6375,18 @@ static ssize_t dgap_tty_msignals_show(struct device *d, struct device_attribute
        struct un_t *un;
 
        if (!d)
-               return (0);
+               return 0;
        un = dev_get_drvdata(d);
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
        if (bd->state != BOARD_READY)
-               return (0);
+               return 0;
 
        if (ch->ch_open_count) {
                return snprintf(buf, PAGE_SIZE, "%s %s %s %s %s %s\n",
@@ -6972,7 +6401,6 @@ static ssize_t dgap_tty_msignals_show(struct device *d, struct device_attribute
 }
 static DEVICE_ATTR(msignals, S_IRUSR, dgap_tty_msignals_show, NULL);
 
-
 static ssize_t dgap_tty_iflag_show(struct device *d, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
@@ -6980,24 +6408,23 @@ static ssize_t dgap_tty_iflag_show(struct device *d, struct device_attribute *at
        struct un_t *un;
 
        if (!d)
-               return (0);
+               return 0;
        un = dev_get_drvdata(d);
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
        if (bd->state != BOARD_READY)
-               return (0);
+               return 0;
 
        return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_iflag);
 }
 static DEVICE_ATTR(iflag, S_IRUSR, dgap_tty_iflag_show, NULL);
 
-
 static ssize_t dgap_tty_cflag_show(struct device *d, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
@@ -7005,24 +6432,23 @@ static ssize_t dgap_tty_cflag_show(struct device *d, struct device_attribute *at
        struct un_t *un;
 
        if (!d)
-               return (0);
+               return 0;
        un = dev_get_drvdata(d);
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
        if (bd->state != BOARD_READY)
-               return (0);
+               return 0;
 
        return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_cflag);
 }
 static DEVICE_ATTR(cflag, S_IRUSR, dgap_tty_cflag_show, NULL);
 
-
 static ssize_t dgap_tty_oflag_show(struct device *d, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
@@ -7030,24 +6456,23 @@ static ssize_t dgap_tty_oflag_show(struct device *d, struct device_attribute *at
        struct un_t *un;
 
        if (!d)
-               return (0);
+               return 0;
        un = dev_get_drvdata(d);
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
        if (bd->state != BOARD_READY)
-               return (0);
+               return 0;
 
        return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_oflag);
 }
 static DEVICE_ATTR(oflag, S_IRUSR, dgap_tty_oflag_show, NULL);
 
-
 static ssize_t dgap_tty_lflag_show(struct device *d, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
@@ -7055,24 +6480,23 @@ static ssize_t dgap_tty_lflag_show(struct device *d, struct device_attribute *at
        struct un_t *un;
 
        if (!d)
-               return (0);
+               return 0;
        un = dev_get_drvdata(d);
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
        if (bd->state != BOARD_READY)
-               return (0);
+               return 0;
 
        return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_lflag);
 }
 static DEVICE_ATTR(lflag, S_IRUSR, dgap_tty_lflag_show, NULL);
 
-
 static ssize_t dgap_tty_digi_flag_show(struct device *d, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
@@ -7080,24 +6504,23 @@ static ssize_t dgap_tty_digi_flag_show(struct device *d, struct device_attribute
        struct un_t *un;
 
        if (!d)
-               return (0);
+               return 0;
        un = dev_get_drvdata(d);
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
        if (bd->state != BOARD_READY)
-               return (0);
+               return 0;
 
        return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_digi.digi_flags);
 }
 static DEVICE_ATTR(digi_flag, S_IRUSR, dgap_tty_digi_flag_show, NULL);
 
-
 static ssize_t dgap_tty_rxcount_show(struct device *d, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
@@ -7105,24 +6528,23 @@ static ssize_t dgap_tty_rxcount_show(struct device *d, struct device_attribute *
        struct un_t *un;
 
        if (!d)
-               return (0);
+               return 0;
        un = dev_get_drvdata(d);
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
        if (bd->state != BOARD_READY)
-               return (0);
+               return 0;
 
        return snprintf(buf, PAGE_SIZE, "%ld\n", ch->ch_rxcount);
 }
 static DEVICE_ATTR(rxcount, S_IRUSR, dgap_tty_rxcount_show, NULL);
 
-
 static ssize_t dgap_tty_txcount_show(struct device *d, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
@@ -7130,24 +6552,23 @@ static ssize_t dgap_tty_txcount_show(struct device *d, struct device_attribute *
        struct un_t *un;
 
        if (!d)
-               return (0);
+               return 0;
        un = dev_get_drvdata(d);
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
        if (bd->state != BOARD_READY)
-               return (0);
+               return 0;
 
        return snprintf(buf, PAGE_SIZE, "%ld\n", ch->ch_txcount);
 }
 static DEVICE_ATTR(txcount, S_IRUSR, dgap_tty_txcount_show, NULL);
 
-
 static ssize_t dgap_tty_name_show(struct device *d, struct device_attribute *attr, char *buf)
 {
        struct board_t *bd;
@@ -7162,20 +6583,20 @@ static ssize_t dgap_tty_name_show(struct device *d, struct device_attribute *att
        int i = 0;
 
        if (!d)
-               return (0);
+               return 0;
        un = dev_get_drvdata(d);
        if (!un || un->magic != DGAP_UNIT_MAGIC)
-               return (0);
+               return 0;
        ch = un->un_ch;
        if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
-               return (0);
+               return 0;
        bd = ch->ch_bd;
        if (!bd || bd->magic != DGAP_BOARD_MAGIC)
-               return (0);
+               return 0;
        if (bd->state != BOARD_READY)
-               return (0);
+               return 0;
 
-        bn = bd->boardnum;
+       bn = bd->boardnum;
        cn = ch->ch_portnum;
 
        for (cptr = bd->bd_config; cptr; cptr = cptr->next) {
@@ -7197,30 +6618,26 @@ static ssize_t dgap_tty_name_show(struct device *d, struct device_attribute *att
                        if (strstr(cptr->u.ttyname, "tty")) {
                                ptr1 = cptr->u.ttyname;
                                ptr1 += 3;
-                       }
-                       else {
+                       } else
                                ptr1 = cptr->u.ttyname;
-                       }
 
                        for (i = 0; i < dgap_config_get_number_of_ports(bd); i++) {
-                               if (cn == i) {
+                               if (cn == i)
                                        return snprintf(buf, PAGE_SIZE, "%s%s%02d\n",
                                                (un->un_type == DGAP_PRINT) ? "pr" : "tty",
                                                ptr1, i + starto);
-                               }
                        }
                }
 
                if (cptr->type == CNODE) {
 
                        for (i = 0; i < cptr->u.conc.nport; i++) {
-                               if (cn == (i + ncount)) {
+                               if (cn == (i + ncount))
 
                                        return snprintf(buf, PAGE_SIZE, "%s%s%02d\n",
                                                (un->un_type == DGAP_PRINT) ? "pr" : "tty",
                                                cptr->u.conc.id,
                                                i + (cptr->u.conc.v_start ? cptr->u.conc.start : 1));
-                               }
                        }
 
                        ncount += cptr->u.conc.nport;
@@ -7229,12 +6646,11 @@ static ssize_t dgap_tty_name_show(struct device *d, struct device_attribute *att
                if (cptr->type == MNODE) {
 
                        for (i = 0; i < cptr->u.module.nport; i++) {
-                               if (cn == (i + ncount)) {
+                               if (cn == (i + ncount))
                                        return snprintf(buf, PAGE_SIZE, "%s%s%02d\n",
                                                (un->un_type == DGAP_PRINT) ? "pr" : "tty",
                                                cptr->u.module.id,
                                                i + (cptr->u.module.v_start ? cptr->u.module.start : 1));
-                               }
                        }
 
                        ncount += cptr->u.module.nport;
@@ -7248,7 +6664,6 @@ static ssize_t dgap_tty_name_show(struct device *d, struct device_attribute *att
 }
 static DEVICE_ATTR(custom_name, S_IRUSR, dgap_tty_name_show, NULL);
 
-
 static struct attribute *dgap_sysfs_tty_entries[] = {
        &dev_attr_state.attr,
        &dev_attr_baud.attr,
@@ -7264,31 +6679,23 @@ static struct attribute *dgap_sysfs_tty_entries[] = {
        NULL
 };
 
-
 static struct attribute_group dgap_tty_attribute_group = {
        .name = NULL,
        .attrs = dgap_sysfs_tty_entries,
 };
 
-
-
-
 static void dgap_create_tty_sysfs(struct un_t *un, struct device *c)
 {
        int ret;
 
        ret = sysfs_create_group(&c->kobj, &dgap_tty_attribute_group);
-       if (ret) {
-               printk(KERN_ERR "dgap: failed to create sysfs tty device attributes.\n");
-               sysfs_remove_group(&c->kobj, &dgap_tty_attribute_group);
+       if (ret)
                return;
-       }
 
        dev_set_drvdata(c, un);
 
 }
 
-
 static void dgap_remove_tty_sysfs(struct device *c)
 {
        sysfs_remove_group(&c->kobj, &dgap_tty_attribute_group);
@@ -7308,43 +6715,43 @@ static int      dgap_parsefile(char **in, int Remove)
        brd = line = conc = NULL;
 
        /* perhaps we are adding to an existing list? */
-       while (p->next != NULL) {
+       while (p->next != NULL)
                p = p->next;
-       }
 
        /* file must start with a BEGIN */
-       while ( (rc = dgap_gettok(in,p)) != BEGIN ) {
+       while ((rc = dgap_gettok(in, p)) != BEGIN) {
                if (rc == 0) {
                        dgap_err("unexpected EOF");
-                       return(-1);
+                       return -1;
                }
        }
 
-       for (; ; ) {
-               rc = dgap_gettok(in,p);
+       for (; ;) {
+               rc = dgap_gettok(in, p);
                if (rc == 0) {
                        dgap_err("unexpected EOF");
-                       return(-1);
+                       return -1;
                }
 
                switch (rc) {
                case 0:
                        dgap_err("unexpected end of file");
-                       return(-1);
+                       return -1;
 
                case BEGIN:     /* should only be 1 begin */
                        dgap_err("unexpected config_begin\n");
-                       return(-1);
+                       return -1;
 
                case END:
-                       return(0);
+                       return 0;
 
                case BOARD:     /* board info */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(BNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(BNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
 
@@ -7357,57 +6764,52 @@ static int      dgap_parsefile(char **in, int Remove)
                case APORT2_920P:       /* AccelePort_4 */
                        if (p->type != BNODE) {
                                dgap_err("unexpected Digi_2r_920 string");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.type = APORT2_920P;
                        p->u.board.v_type = 1;
-                       DPR_INIT(("Adding Digi_2r_920 PCI to config...\n"));
                        break;
 
                case APORT4_920P:       /* AccelePort_4 */
                        if (p->type != BNODE) {
                                dgap_err("unexpected Digi_4r_920 string");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.type = APORT4_920P;
                        p->u.board.v_type = 1;
-                       DPR_INIT(("Adding Digi_4r_920 PCI to config...\n"));
                        break;
 
                case APORT8_920P:       /* AccelePort_8 */
                        if (p->type != BNODE) {
                                dgap_err("unexpected Digi_8r_920 string");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.type = APORT8_920P;
                        p->u.board.v_type = 1;
-                       DPR_INIT(("Adding Digi_8r_920 PCI to config...\n"));
                        break;
 
                case PAPORT4:   /* AccelePort_4 PCI */
                        if (p->type != BNODE) {
                                dgap_err("unexpected Digi_4r(PCI) string");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.type = PAPORT4;
                        p->u.board.v_type = 1;
-                       DPR_INIT(("Adding Digi_4r PCI to config...\n"));
                        break;
 
                case PAPORT8:   /* AccelePort_8 PCI */
                        if (p->type != BNODE) {
                                dgap_err("unexpected Digi_8r string");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.type = PAPORT8;
                        p->u.board.v_type = 1;
-                       DPR_INIT(("Adding Digi_8r PCI to config...\n"));
                        break;
 
                case PCX:       /* PCI C/X */
                        if (p->type != BNODE) {
                                dgap_err("unexpected Digi_C/X_(PCI) string");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.type = PCX;
                        p->u.board.v_type = 1;
@@ -7415,13 +6817,12 @@ static int      dgap_parsefile(char **in, int Remove)
                        p->u.board.conc2 = 0;
                        p->u.board.module1 = 0;
                        p->u.board.module2 = 0;
-                       DPR_INIT(("Adding PCI C/X to config...\n"));
                        break;
 
                case PEPC:      /* PCI EPC/X */
                        if (p->type != BNODE) {
                                dgap_err("unexpected \"Digi_EPC/X_(PCI)\" string");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.type = PEPC;
                        p->u.board.v_type = 1;
@@ -7429,122 +6830,113 @@ static int    dgap_parsefile(char **in, int Remove)
                        p->u.board.conc2 = 0;
                        p->u.board.module1 = 0;
                        p->u.board.module2 = 0;
-                       DPR_INIT(("Adding PCI EPC/X to config...\n"));
                        break;
 
                case PPCM:      /* PCI/Xem */
                        if (p->type != BNODE) {
                                dgap_err("unexpected PCI/Xem string");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.type = PPCM;
                        p->u.board.v_type = 1;
                        p->u.board.conc1 = 0;
                        p->u.board.conc2 = 0;
-                       DPR_INIT(("Adding PCI XEM to config...\n"));
                        break;
 
                case IO:        /* i/o port */
                        if (p->type != BNODE) {
                                dgap_err("IO port only vaild for boards");
-                               return(-1);
+                               return -1;
                        }
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.portstr = dgap_savestring(s);
                        p->u.board.port = (short)simple_strtol(s, &s2, 0);
                        if ((short)strlen(s) > (short)(s2 - s)) {
                                dgap_err("bad number for IO port");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.v_port = 1;
-                       DPR_INIT(("Adding IO (%s) to config...\n", s));
                        break;
 
                case MEM:       /* memory address */
                        if (p->type != BNODE) {
                                dgap_err("memory address only vaild for boards");
-                               return(-1);
+                               return -1;
                        }
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.addrstr = dgap_savestring(s);
                        p->u.board.addr = simple_strtoul(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for memory address");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.v_addr = 1;
-                       DPR_INIT(("Adding MEM (%s) to config...\n", s));
                        break;
 
                case PCIINFO:   /* pci information */
                        if (p->type != BNODE) {
                                dgap_err("memory address only vaild for boards");
-                               return(-1);
+                               return -1;
                        }
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.pcibusstr = dgap_savestring(s);
                        p->u.board.pcibus = simple_strtoul(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for pci bus");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.v_pcibus = 1;
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.pcislotstr = dgap_savestring(s);
                        p->u.board.pcislot = simple_strtoul(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for pci slot");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.v_pcislot = 1;
-
-                       DPR_INIT(("Adding PCIINFO (%s %s) to config...\n", p->u.board.pcibusstr,
-                               p->u.board.pcislotstr));
                        break;
 
                case METHOD:
                        if (p->type != BNODE) {
                                dgap_err("install method only vaild for boards");
-                               return(-1);
+                               return -1;
                        }
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.method = dgap_savestring(s);
                        p->u.board.v_method = 1;
-                       DPR_INIT(("Adding METHOD (%s) to config...\n", s));
                        break;
 
                case STATUS:
                        if (p->type != BNODE) {
                                dgap_err("config status only vaild for boards");
-                               return(-1);
+                               return -1;
                        }
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.board.status = dgap_savestring(s);
-                       DPR_INIT(("Adding STATUS (%s) to config...\n", s));
                        break;
 
                case NPORTS:    /* number of ports */
@@ -7552,50 +6944,49 @@ static int      dgap_parsefile(char **in, int Remove)
                                s = dgap_getword(in);
                                if (s == NULL) {
                                        dgap_err("unexpected end of file");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.board.nport = (char)simple_strtol(s, &s2, 0);
                                if ((int)strlen(s) > (int)(s2 - s)) {
                                        dgap_err("bad number for number of ports");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.board.v_nport = 1;
                        } else if (p->type == CNODE) {
                                s = dgap_getword(in);
                                if (s == NULL) {
                                        dgap_err("unexpected end of file");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.conc.nport = (char)simple_strtol(s, &s2, 0);
                                if ((int)strlen(s) > (int)(s2 - s)) {
                                        dgap_err("bad number for number of ports");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.conc.v_nport = 1;
                        } else if (p->type == MNODE) {
                                s = dgap_getword(in);
                                if (s == NULL) {
                                        dgap_err("unexpected end of file");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.module.nport = (char)simple_strtol(s, &s2, 0);
                                if ((int)strlen(s) > (int)(s2 - s)) {
                                        dgap_err("bad number for number of ports");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.module.v_nport = 1;
                        } else {
                                dgap_err("nports only valid for concentrators or modules");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding NPORTS (%s) to config...\n", s));
                        break;
 
                case ID:        /* letter ID used in tty name */
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
 
                        p->u.board.status = dgap_savestring(s);
@@ -7608,9 +6999,8 @@ static int        dgap_parsefile(char **in, int Remove)
                                p->u.module.v_id = 1;
                        } else {
                                dgap_err("id only valid for concentrators or modules");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding ID (%s) to config...\n", s));
                        break;
 
                case STARTO:    /* start offset of ID */
@@ -7618,116 +7008,120 @@ static int    dgap_parsefile(char **in, int Remove)
                                s = dgap_getword(in);
                                if (s == NULL) {
                                        dgap_err("unexpected end of file");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.board.start = simple_strtol(s, &s2, 0);
                                if ((int)strlen(s) > (int)(s2 - s)) {
                                        dgap_err("bad number for start of tty count");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.board.v_start = 1;
                        } else if (p->type == CNODE) {
                                s = dgap_getword(in);
                                if (s == NULL) {
                                        dgap_err("unexpected end of file");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.conc.start = simple_strtol(s, &s2, 0);
                                if ((int)strlen(s) > (int)(s2 - s)) {
                                        dgap_err("bad number for start of tty count");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.conc.v_start = 1;
                        } else if (p->type == MNODE) {
                                s = dgap_getword(in);
                                if (s == NULL) {
                                        dgap_err("unexpected end of file");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.module.start = simple_strtol(s, &s2, 0);
                                if ((int)strlen(s) > (int)(s2 - s)) {
                                        dgap_err("bad number for start of tty count");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.module.v_start = 1;
                        } else {
                                dgap_err("start only valid for concentrators or modules");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding START (%s) to config...\n", s));
                        break;
 
                case TTYN:      /* tty name prefix */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(TNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(TNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
-                       if ( (s = dgap_getword(in)) == NULL ) {
+                       s = dgap_getword(in);
+                       if (!s) {
                                dgap_err("unexpeced end of file");
-                               return(-1);
+                               return -1;
                        }
-                       if ( (p->u.ttyname = dgap_savestring(s)) == NULL ) {
+                       p->u.ttyname = dgap_savestring(s);
+                       if (!p->u.ttyname) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding TTY (%s) to config...\n", s));
                        break;
 
                case CU:        /* cu name prefix */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(CUNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(CUNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
-                       if ( (s = dgap_getword(in)) == NULL ) {
+                       s = dgap_getword(in);
+                       if (!s) {
                                dgap_err("unexpeced end of file");
-                               return(-1);
+                               return -1;
                        }
-                       if ( (p->u.cuname = dgap_savestring(s)) == NULL ) {
+                       p->u.cuname = dgap_savestring(s);
+                       if (!p->u.cuname) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding CU (%s) to config...\n", s));
                        break;
 
                case LINE:      /* line information */
                        if (dgap_checknode(p))
-                               return(-1);
+                               return -1;
                        if (brd == NULL) {
                                dgap_err("must specify board before line info");
-                               return(-1);
+                               return -1;
                        }
                        switch (brd->u.board.type) {
                        case PPCM:
                                dgap_err("line not vaild for PC/em");
-                               return(-1);
+                               return -1;
                        }
-                       if ( (p->next = dgap_newnode(LNODE)) == NULL ) {
+                       p->next = dgap_newnode(LNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        conc = NULL;
                        line = p;
                        linecnt++;
-                       DPR_INIT(("Adding LINE to config...\n"));
                        break;
 
                case CONC:      /* concentrator information */
                        if (dgap_checknode(p))
-                               return(-1);
+                               return -1;
                        if (line == NULL) {
                                dgap_err("must specify line info before concentrator");
-                               return(-1);
+                               return -1;
                        }
-                       if ( (p->next = dgap_newnode(CNODE)) == NULL ) {
+                       p->next = dgap_newnode(CNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        conc = p;
@@ -7736,35 +7130,32 @@ static int      dgap_parsefile(char **in, int Remove)
                        else
                                brd->u.board.conc1++;
 
-                       DPR_INIT(("Adding CONC to config...\n"));
                        break;
 
                case CX:        /* c/x type concentrator */
                        if (p->type != CNODE) {
                                dgap_err("cx only valid for concentrators");
-                               return(-1);
+                               return -1;
                        }
                        p->u.conc.type = CX;
                        p->u.conc.v_type = 1;
-                       DPR_INIT(("Adding CX to config...\n"));
                        break;
 
                case EPC:       /* epc type concentrator */
                        if (p->type != CNODE) {
                                dgap_err("cx only valid for concentrators");
-                               return(-1);
+                               return -1;
                        }
                        p->u.conc.type = EPC;
                        p->u.conc.v_type = 1;
-                       DPR_INIT(("Adding EPC to config...\n"));
                        break;
 
                case MOD:       /* EBI module */
                        if (dgap_checknode(p))
-                               return(-1);
+                               return -1;
                        if (brd == NULL) {
                                dgap_err("must specify board info before EBI modules");
-                               return(-1);
+                               return -1;
                        }
                        switch (brd->u.board.type) {
                        case PPCM:
@@ -7773,12 +7164,13 @@ static int      dgap_parsefile(char **in, int Remove)
                        default:
                                if (conc == NULL) {
                                        dgap_err("must specify concentrator info before EBI module");
-                                       return(-1);
+                                       return -1;
                                }
                        }
-                       if ( (p->next = dgap_newnode(MNODE)) == NULL ) {
+                       p->next = dgap_newnode(MNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        if (linecnt)
@@ -7786,39 +7178,36 @@ static int      dgap_parsefile(char **in, int Remove)
                        else
                                brd->u.board.module1++;
 
-                       DPR_INIT(("Adding MOD to config...\n"));
                        break;
 
                case PORTS:     /* ports type EBI module */
                        if (p->type != MNODE) {
                                dgap_err("ports only valid for EBI modules");
-                               return(-1);
+                               return -1;
                        }
                        p->u.module.type = PORTS;
                        p->u.module.v_type = 1;
-                       DPR_INIT(("Adding PORTS to config...\n"));
                        break;
 
                case MODEM:     /* ports type EBI module */
                        if (p->type != MNODE) {
                                dgap_err("modem only valid for modem modules");
-                               return(-1);
+                               return -1;
                        }
                        p->u.module.type = MODEM;
                        p->u.module.v_type = 1;
-                       DPR_INIT(("Adding MODEM to config...\n"));
                        break;
 
                case CABLE:
                        if (p->type == LNODE) {
-                               if ((s = dgap_getword(in)) == NULL) {
+                               s = dgap_getword(in);
+                               if (!s) {
                                        dgap_err("unexpected end of file");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.line.cable = dgap_savestring(s);
                                p->u.line.v_cable = 1;
                        }
-                       DPR_INIT(("Adding CABLE (%s) to config...\n", s));
                        break;
 
                case SPEED:     /* sync line speed indication */
@@ -7826,262 +7215,262 @@ static int    dgap_parsefile(char **in, int Remove)
                                s = dgap_getword(in);
                                if (s == NULL) {
                                        dgap_err("unexpected end of file");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.line.speed = (char)simple_strtol(s, &s2, 0);
                                if ((short)strlen(s) > (short)(s2 - s)) {
                                        dgap_err("bad number for line speed");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.line.v_speed = 1;
                        } else if (p->type == CNODE) {
                                s = dgap_getword(in);
                                if (s == NULL) {
                                        dgap_err("unexpected end of file");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.conc.speed = (char)simple_strtol(s, &s2, 0);
                                if ((short)strlen(s) > (short)(s2 - s)) {
                                        dgap_err("bad number for line speed");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.conc.v_speed = 1;
                        } else {
                                dgap_err("speed valid only for lines or concentrators.");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding SPEED (%s) to config...\n", s));
                        break;
 
                case CONNECT:
                        if (p->type == CNODE) {
-                               if ((s = dgap_getword(in)) == NULL) {
+                               s = dgap_getword(in);
+                               if (!s) {
                                        dgap_err("unexpected end of file");
-                                       return(-1);
+                                       return -1;
                                }
                                p->u.conc.connect = dgap_savestring(s);
                                p->u.conc.v_connect = 1;
                        }
-                       DPR_INIT(("Adding CONNECT (%s) to config...\n", s));
                        break;
                case PRINT:     /* transparent print name prefix */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(PNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(PNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
-                       if ( (s = dgap_getword(in)) == NULL ) {
+                       s = dgap_getword(in);
+                       if (!s) {
                                dgap_err("unexpeced end of file");
-                               return(-1);
+                               return -1;
                        }
-                       if ( (p->u.printname = dgap_savestring(s)) == NULL ) {
+                       p->u.printname = dgap_savestring(s);
+                       if (!p->u.printname) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding PRINT (%s) to config...\n", s));
                        break;
 
                case CMAJOR:    /* major number */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(JNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(JNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.majornumber = simple_strtol(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for major number");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding CMAJOR (%s) to config...\n", s));
                        break;
 
                case ALTPIN:    /* altpin setting */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(ANODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(ANODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.altpin = simple_strtol(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for altpin");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding ALTPIN (%s) to config...\n", s));
                        break;
 
                case USEINTR:           /* enable interrupt setting */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(INTRNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(INTRNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.useintr = simple_strtol(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for useintr");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding USEINTR (%s) to config...\n", s));
                        break;
 
                case TTSIZ:     /* size of tty structure */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(TSNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(TSNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.ttysize = simple_strtol(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for ttysize");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding TTSIZ (%s) to config...\n", s));
                        break;
 
                case CHSIZ:     /* channel structure size */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(CSNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(CSNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.chsize = simple_strtol(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for chsize");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding CHSIZE (%s) to config...\n", s));
                        break;
 
                case BSSIZ:     /* board structure size */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(BSNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(BSNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.bssize = simple_strtol(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for bssize");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding BSSIZ (%s) to config...\n", s));
                        break;
 
                case UNTSIZ:    /* sched structure size */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(USNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(USNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.unsize = simple_strtol(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for schedsize");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding UNTSIZ (%s) to config...\n", s));
                        break;
 
                case F2SIZ:     /* f2200 structure size */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(FSNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(FSNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.f2size = simple_strtol(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for f2200size");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding F2SIZ (%s) to config...\n", s));
                        break;
 
                case VPSIZ:     /* vpix structure size */
                        if (dgap_checknode(p))
-                               return(-1);
-                       if ( (p->next = dgap_newnode(VSNODE)) == NULL ) {
+                               return -1;
+                       p->next = dgap_newnode(VSNODE);
+                       if (!p->next) {
                                dgap_err("out of memory");
-                               return(-1);
+                               return -1;
                        }
                        p = p->next;
                        s = dgap_getword(in);
                        if (s == NULL) {
                                dgap_err("unexpected end of file");
-                               return(-1);
+                               return -1;
                        }
                        p->u.vpixsize = simple_strtol(s, &s2, 0);
                        if ((int)strlen(s) > (int)(s2 - s)) {
                                dgap_err("bad number for vpixsize");
-                               return(-1);
+                               return -1;
                        }
-                       DPR_INIT(("Adding VPSIZ (%s) to config...\n", s));
                        break;
                }
        }
 }
 
-
 /*
  * dgap_sindex: much like index(), but it looks for a match of any character in
  * the group, and returns that position.  If the first character is a ^, then
  * this will match the first occurrence not in that group.
  */
-static char *dgap_sindex (char *string, char *group)
+static char *dgap_sindex(char *string, char *group)
 {
        char    *ptr;
 
@@ -8098,8 +7487,7 @@ static char *dgap_sindex (char *string, char *group)
                        if (*ptr == '\0')
                                return string;
                }
-       }
-       else {
+       } else {
                for (; *string; string++) {
                        for (ptr = group; *ptr; ptr++) {
                                if (*ptr == *string)
@@ -8111,7 +7499,6 @@ static char *dgap_sindex (char *string, char *group)
        return (char *) NULL;
 }
 
-
 /*
  * Get a token from the input file; return 0 if end of file is reached
  */
@@ -8124,26 +7511,23 @@ static int dgap_gettok(char **in, struct cnode *p)
                w = dgap_getword(in);
                snprintf(dgap_cword, MAXCWORD, "%s", w);
                for (t = dgap_tlist; t->token != 0; t++) {
-                       if ( !strcmp(w, t->string)) {
-                               return(t->token);
-                       }
+                       if (!strcmp(w, t->string))
+                               return t->token;
                }
                dgap_err("board !!type not specified");
-               return(1);
-       }
-       else {
-               while ( (w = dgap_getword(in)) != NULL ) {
+               return 1;
+       } else {
+               while ((w = dgap_getword(in))) {
                        snprintf(dgap_cword, MAXCWORD, "%s", w);
                        for (t = dgap_tlist; t->token != 0; t++) {
-                               if ( !strcmp(w, t->string) )
-                                       return(t->token);
+                               if (!strcmp(w, t->string))
+                                       return t->token;
                        }
                }
-               return(0);
+               return 0;
        }
 }
 
-
 /*
  * get a word from the input stream, also keep track of current line number.
  * words are separated by whitespace.
@@ -8152,7 +7536,7 @@ static char *dgap_getword(char **in)
 {
        char *ret_ptr = *in;
 
-        char *ptr = dgap_sindex(*in, " \t\n");
+       char *ptr = dgap_sindex(*in, " \t\n");
 
        /* If no word found, return null */
        if (!ptr)
@@ -8171,17 +7555,15 @@ static char *dgap_getword(char **in)
        return ret_ptr;
 }
 
-
 /*
  * print an error message, giving the line number in the file where
  * the error occurred.
  */
 static void dgap_err(char *s)
 {
-       printk("DGAP: parse: %s\n", s);
+       pr_err("dgap: parse: %s\n", s);
 }
 
-
 /*
  * allocate a new configuration node of type t
  */
@@ -8194,10 +7576,9 @@ static struct cnode *dgap_newnode(int t)
                memset((char *)n, 0, sizeof(struct cnode));
                n->type = t;
        }
-       return(n);
+       return n;
 }
 
-
 /*
  * dgap_checknode: see if all the necessary info has been supplied for a node
  * before creating the next node.
@@ -8208,53 +7589,53 @@ static int dgap_checknode(struct cnode *p)
        case BNODE:
                if (p->u.board.v_type == 0) {
                        dgap_err("board type !not specified");
-                       return(1);
+                       return 1;
                }
 
-               return(0);
+               return 0;
 
        case LNODE:
                if (p->u.line.v_speed == 0) {
                        dgap_err("line speed not specified");
-                       return(1);
+                       return 1;
                }
-               return(0);
+               return 0;
 
        case CNODE:
                if (p->u.conc.v_type == 0) {
                        dgap_err("concentrator type not specified");
-                       return(1);
+                       return 1;
                }
                if (p->u.conc.v_speed == 0) {
                        dgap_err("concentrator line speed not specified");
-                       return(1);
+                       return 1;
                }
                if (p->u.conc.v_nport == 0) {
                        dgap_err("number of ports on concentrator not specified");
-                       return(1);
+                       return 1;
                }
                if (p->u.conc.v_id == 0) {
                        dgap_err("concentrator id letter not specified");
-                       return(1);
+                       return 1;
                }
-               return(0);
+               return 0;
 
        case MNODE:
                if (p->u.module.v_type == 0) {
                        dgap_err("EBI module type not specified");
-                       return(1);
+                       return 1;
                }
                if (p->u.module.v_nport == 0) {
                        dgap_err("number of ports on EBI module not specified");
-                       return(1);
+                       return 1;
                }
                if (p->u.module.v_id == 0) {
                        dgap_err("EBI module id letter not specified");
-                       return(1);
+                       return 1;
                }
-               return(0);
+               return 0;
        }
-       return(0);
+       return 0;
 }
 
 /*
@@ -8263,13 +7644,13 @@ static int dgap_checknode(struct cnode *p)
 static char    *dgap_savestring(char *s)
 {
        char    *p;
-       if ( (p = kmalloc(strlen(s) + 1, GFP_ATOMIC) ) != NULL) {
+
+       p = kmalloc(strlen(s) + 1, GFP_ATOMIC);
+       if (p)
                strcpy(p, s);
-       }
-       return(p);
+       return p;
 }
 
-
 /*
  * Given a board pointer, returns whether we should use interrupts or not.
  */
@@ -8278,7 +7659,7 @@ static uint dgap_config_get_useintr(struct board_t *bd)
        struct cnode *p = NULL;
 
        if (!bd)
-               return(0);
+               return 0;
 
        for (p = bd->bd_config; p; p = p->next) {
                switch (p->type) {
@@ -8296,7 +7677,6 @@ static uint dgap_config_get_useintr(struct board_t *bd)
        return 0;
 }
 
-
 /*
  * Given a board pointer, returns whether we turn on altpin or not.
  */
@@ -8305,7 +7685,7 @@ static uint dgap_config_get_altpin(struct board_t *bd)
        struct cnode *p = NULL;
 
        if (!bd)
-               return(0);
+               return 0;
 
        for (p = bd->bd_config; p; p = p->next) {
                switch (p->type) {
@@ -8323,8 +7703,6 @@ static uint dgap_config_get_altpin(struct board_t *bd)
        return 0;
 }
 
-
-
 /*
  * Given a specific type of board, if found, detached link and
  * returns the first occurrence in the list.
@@ -8343,18 +7721,12 @@ static struct cnode *dgap_find_config(int type, int bus, int slot)
 
                        if (p->u.board.type == type) {
 
-                               if (p->u.board.v_pcibus && p->u.board.pcibus != bus) {
-                                       DPR(("Found matching board, but wrong bus position. System says bus %d, we want bus %ld\n",
-                                               bus, p->u.board.pcibus));
+                               if (p->u.board.v_pcibus &&
+                                   p->u.board.pcibus != bus)
                                        continue;
-                               }
-                               if (p->u.board.v_pcislot && p->u.board.pcislot != slot) {
-                                       DPR_INIT(("Found matching board, but wrong slot position. System says slot %d, we want slot %ld\n",
-                                               slot, p->u.board.pcislot));
+                               if (p->u.board.v_pcislot &&
+                                   p->u.board.pcislot != slot)
                                        continue;
-                               }
-
-                               DPR_INIT(("Matched type in config file\n"));
 
                                found = p;
                                /*
@@ -8401,7 +7773,7 @@ static uint dgap_config_get_number_of_ports(struct board_t *bd)
        struct cnode *p = NULL;
 
        if (!bd)
-               return(0);
+               return 0;
 
        for (p = bd->bd_config; p; p = p->next) {
 
@@ -8421,7 +7793,7 @@ static uint dgap_config_get_number_of_ports(struct board_t *bd)
                        break;
                }
        }
-       return (count);
+       return count;
 }
 
 static char *dgap_create_config_string(struct board_t *bd, char *string)
@@ -8454,7 +7826,7 @@ static char *dgap_create_config_string(struct board_t *bd, char *string)
                         */
                        speed = p->u.conc.speed;
                        q = p->next;
-                       if ((q != NULL) && (q->type == MNODE) ) {
+                       if ((q != NULL) && (q->type == MNODE)) {
                                *ptr = (p->u.conc.nport + 0x80);
                                ptr++;
                                p = q;