[PATCH] staging: dgnc: Patch includes the checkpatch fixes

From: Sanidhya Solanki
Date: Fri Dec 11 2015 - 21:08:06 EST


Patch contains the checkpatch fixes as asked by the TODO.
Unnecessary do-while() loops are removed as well.

Signed-off-by: Sanidhya Solanki <jpage.lkml@xxxxxxxxx>
---
drivers/staging/dgnc/dgnc_cls.c | 4 +-
drivers/staging/dgnc/dgnc_driver.c | 56 ++++-----
drivers/staging/dgnc/dgnc_driver.h | 33 +++---
drivers/staging/dgnc/dgnc_mgmt.c | 28 ++---
drivers/staging/dgnc/dgnc_neo.c | 229 ++++++++++++++++++++++---------------
drivers/staging/dgnc/dgnc_neo.h | 22 ++--
drivers/staging/dgnc/dgnc_pci.h | 1 -
drivers/staging/dgnc/dgnc_sysfs.c | 140 ++++++++++++++++++-----
drivers/staging/dgnc/dgnc_tty.c | 197 +++++++++++++++----------------
drivers/staging/dgnc/digi.h | 44 +++----
10 files changed, 441 insertions(+), 313 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 75040da..d312d35 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch)
/* Clear out UART and FIFO */
readb(&ch->ch_cls_uart->txrx);

- writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT),
- &ch->ch_cls_uart->isr_fcr);
+ writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
+ UART_FCR_CLEAR_XMIT), &ch->ch_cls_uart->isr_fcr);
udelay(10);

ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
index fc6d298..37fb8f9 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -48,7 +48,7 @@ static void dgnc_do_remap(struct dgnc_board *brd);
/*
* File operations permitted on Control/Management major.
*/
-static const struct file_operations dgnc_BoardFops = {
+static const struct file_operations dgnc_board_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = dgnc_mgmt_ioctl,
.open = dgnc_mgmt_open,
@@ -58,11 +58,11 @@ static const struct file_operations dgnc_BoardFops = {
/*
* Globals
*/
-uint dgnc_NumBoards;
-struct dgnc_board *dgnc_Board[MAXBOARDS];
+uint dgnc_num_boards;
+struct dgnc_board *dgnc_board[MAXBOARDS];
DEFINE_SPINLOCK(dgnc_global_lock);
DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
-uint dgnc_Major;
+uint dgnc_major;
int dgnc_poll_tick = 20; /* Poll interval - 20 ms */

/*
@@ -92,7 +92,7 @@ struct board_id {
unsigned int is_pci_express;
};

-static struct board_id dgnc_Ids[] = {
+static struct board_id dgnc_ids[] = {
{ PCI_DEVICE_CLASSIC_4_PCI_NAME, 4, 0 },
{ PCI_DEVICE_CLASSIC_4_422_PCI_NAME, 4, 0 },
{ PCI_DEVICE_CLASSIC_8_PCI_NAME, 8, 0 },
@@ -144,19 +144,19 @@ static void dgnc_cleanup_module(void)

dgnc_remove_driver_sysfiles(&dgnc_driver);

- device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
+ device_destroy(dgnc_class, MKDEV(dgnc_major, 0));
class_destroy(dgnc_class);
- unregister_chrdev(dgnc_Major, "dgnc");
+ unregister_chrdev(dgnc_major, "dgnc");

- for (i = 0; i < dgnc_NumBoards; ++i) {
- dgnc_remove_ports_sysfiles(dgnc_Board[i]);
- dgnc_tty_uninit(dgnc_Board[i]);
- dgnc_cleanup_board(dgnc_Board[i]);
+ for (i = 0; i < dgnc_num_boards; ++i) {
+ dgnc_remove_ports_sysfiles(dgnc_board[i]);
+ dgnc_tty_uninit(dgnc_board[i]);
+ dgnc_cleanup_board(dgnc_board[i]);
}

dgnc_tty_post_uninit();

- if (dgnc_NumBoards)
+ if (dgnc_num_boards)
pci_unregister_driver(&dgnc_driver);
}

@@ -187,7 +187,7 @@ static int __init dgnc_init_module(void)
*/
if (rc < 0) {
/* Only unregister if it was actually registered. */
- if (dgnc_NumBoards)
+ if (dgnc_num_boards)
pci_unregister_driver(&dgnc_driver);
else
pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n");
@@ -222,12 +222,12 @@ static int dgnc_start(void)
*
* Register management/dpa devices
*/
- rc = register_chrdev(0, "dgnc", &dgnc_BoardFops);
+ rc = register_chrdev(0, "dgnc", &dgnc_board_fops);
if (rc < 0) {
pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc);
return rc;
}
- dgnc_Major = rc;
+ dgnc_major = rc;

dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt");
if (IS_ERR(dgnc_class)) {
@@ -237,7 +237,7 @@ static int dgnc_start(void)
}

dev = device_create(dgnc_class, NULL,
- MKDEV(dgnc_Major, 0),
+ MKDEV(dgnc_major, 0),
NULL, "dgnc_mgmt");
if (IS_ERR(dev)) {
rc = PTR_ERR(dev);
@@ -267,11 +267,11 @@ static int dgnc_start(void)
return 0;

failed_tty:
- device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
+ device_destroy(dgnc_class, MKDEV(dgnc_major, 0));
failed_device:
class_destroy(dgnc_class);
failed_class:
- unregister_chrdev(dgnc_Major, "dgnc");
+ unregister_chrdev(dgnc_major, "dgnc");
return rc;
}

@@ -288,7 +288,7 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
} else {
rc = dgnc_found_board(pdev, ent->driver_data);
if (rc == 0)
- dgnc_NumBoards++;
+ dgnc_num_boards++;
}
return rc;
}
@@ -351,7 +351,7 @@ static void dgnc_cleanup_board(struct dgnc_board *brd)
}
}

- dgnc_Board[brd->boardnum] = NULL;
+ dgnc_board[brd->boardnum] = NULL;

kfree(brd);
}
@@ -370,8 +370,8 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
unsigned long flags;

/* get the board structure and prep it */
- dgnc_Board[dgnc_NumBoards] = kzalloc(sizeof(*brd), GFP_KERNEL);
- brd = dgnc_Board[dgnc_NumBoards];
+ dgnc_board[dgnc_num_boards] = kzalloc(sizeof(*brd), GFP_KERNEL);
+ brd = dgnc_board[dgnc_num_boards];

if (!brd)
return -ENOMEM;
@@ -387,15 +387,15 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)

/* store the info for the board we've found */
brd->magic = DGNC_BOARD_MAGIC;
- brd->boardnum = dgnc_NumBoards;
+ brd->boardnum = dgnc_num_boards;
brd->vendor = dgnc_pci_tbl[id].vendor;
brd->device = dgnc_pci_tbl[id].device;
brd->pdev = pdev;
brd->pci_bus = pdev->bus->number;
brd->pci_slot = PCI_SLOT(pdev->devfn);
- brd->name = dgnc_Ids[id].name;
- brd->maxports = dgnc_Ids[id].maxports;
- if (dgnc_Ids[i].is_pci_express)
+ brd->name = dgnc_ids[id].name;
+ brd->maxports = dgnc_ids[id].maxports;
+ if (dgnc_ids[i].is_pci_express)
brd->bd_flags |= BD_IS_PCI_EXPRESS;
brd->dpastatus = BD_NOFEP;
init_waitqueue_head(&brd->state_wait);
@@ -647,8 +647,8 @@ static void dgnc_poll_handler(ulong dummy)
unsigned long new_time;

/* Go thru each board, kicking off a tasklet for each if needed */
- for (i = 0; i < dgnc_NumBoards; i++) {
- brd = dgnc_Board[i];
+ for (i = 0; i < dgnc_num_boards; i++) {
+ brd = dgnc_board[i];

spin_lock_irqsave(&brd->bd_lock, flags);

diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h
index ce7cd9b..7bed033 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -24,6 +24,7 @@
#include <linux/types.h>
#include <linux/tty.h>
#include <linux/interrupt.h>
+#include <linux/spinlock_types.h>

#include "digi.h" /* Digi specific ioctl header */
#include "dgnc_sysfs.h" /* Support for SYSFS */
@@ -88,7 +89,6 @@
#define _POSIX_VDISABLE '\0'
#endif

-
/*
* All the possible states the driver can be while being loaded.
*/
@@ -106,7 +106,6 @@ enum {
BOARD_READY
};

-
/*************************************************************************
*
* Structures and closely related defines.
@@ -145,7 +144,6 @@ struct board_ops {
************************************************************************/
#define BD_IS_PCI_EXPRESS 0x0001 /* Is a PCI Express board */

-
/*
* Per-board information
*/
@@ -205,18 +203,18 @@ struct dgnc_board {
* to our channels.
*/

- struct tty_driver SerialDriver;
- char SerialName[200];
- struct tty_driver PrintDriver;
- char PrintName[200];
+ struct tty_driver serial_driver;
+ char serial_name[200];
+ struct tty_driver print_driver;
+ char print_name[200];

- bool dgnc_Major_Serial_Registered;
- bool dgnc_Major_TransparentPrint_Registered;
+ bool dgnc_major_serial_registered;
+ bool dgnc_major_transparent_print_registered;

- uint dgnc_Serial_Major;
- uint dgnc_TransparentPrint_Major;
+ uint dgnc_serial_major;
+ uint dgnc_transparent_print_major;

- uint TtyRefCnt;
+ uint tty_ref_cnt;

u16 dpatype; /* The board "type",
* as defined by DPA
@@ -241,7 +239,6 @@ struct dgnc_board {

};

-
/************************************************************************
* Unit flag definitions for un_flags.
************************************************************************/
@@ -277,7 +274,6 @@ struct un_t {
struct device *un_sysfs;
};

-
/************************************************************************
* Device flag definitions for ch_flags.
************************************************************************/
@@ -300,7 +296,6 @@ struct un_t {
#define CH_FORCED_STOP 0x20000 /* Output is forcibly stopped */
#define CH_FORCED_STOPI 0x40000 /* Input is forcibly stopped */

-
/* Our Read/Error/Write queue sizes */
#define RQUEUEMASK 0x1FFF /* 8 K - 1 */
#define EQUEUEMASK 0x1FFF /* 8 K - 1 */
@@ -309,7 +304,6 @@ struct un_t {
#define EQUEUESIZE RQUEUESIZE
#define WQUEUESIZE (WQUEUEMASK + 1)

-
/************************************************************************
* Channel information structure.
************************************************************************/
@@ -397,7 +391,6 @@ struct channel_t {
ulong ch_intr_tx; /* Count of interrupts */
ulong ch_intr_rx; /* Count of interrupts */

-
/* /proc/<board>/<channel> entries */
struct proc_dir_entry *proc_entry_pointer;
struct dgnc_proc_entry *dgnc_channel_table;
@@ -407,12 +400,12 @@ struct channel_t {
/*
* Our Global Variables.
*/
-extern uint dgnc_Major; /* Our driver/mgmt major */
+extern uint dgnc_major; /* Our driver/mgmt major */
extern int dgnc_poll_tick; /* Poll interval - 20 ms */
extern spinlock_t dgnc_global_lock; /* Driver global spinlock */
extern spinlock_t dgnc_poll_lock; /* Poll scheduling lock */
-extern uint dgnc_NumBoards; /* Total number of boards */
-extern struct dgnc_board *dgnc_Board[MAXBOARDS]; /* Array of board
+extern uint dgnc_num_boards; /* Total number of boards */
+extern struct dgnc_board *dgnc_board[MAXBOARDS]; /* Array of board
* structs
*/

diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c
index 518fbd5..35a9295 100644
--- a/drivers/staging/dgnc/dgnc_mgmt.c
+++ b/drivers/staging/dgnc/dgnc_mgmt.c
@@ -111,7 +111,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
spin_lock_irqsave(&dgnc_global_lock, flags);

memset(&ddi, 0, sizeof(ddi));
- ddi.dinfo_nboards = dgnc_NumBoards;
+ ddi.dinfo_nboards = dgnc_num_boards;
sprintf(ddi.dinfo_version, "%s", DG_PART);

spin_unlock_irqrestore(&dgnc_global_lock, flags);
@@ -131,27 +131,27 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (copy_from_user(&brd, uarg, sizeof(int)))
return -EFAULT;

- if (brd < 0 || brd >= dgnc_NumBoards)
+ if (brd < 0 || brd >= dgnc_num_boards)
return -ENODEV;

memset(&di, 0, sizeof(di));

di.info_bdnum = brd;

- spin_lock_irqsave(&dgnc_Board[brd]->bd_lock, flags);
+ spin_lock_irqsave(&dgnc_board[brd]->bd_lock, flags);

- di.info_bdtype = dgnc_Board[brd]->dpatype;
- di.info_bdstate = dgnc_Board[brd]->dpastatus;
+ di.info_bdtype = dgnc_board[brd]->dpatype;
+ di.info_bdstate = dgnc_board[brd]->dpastatus;
di.info_ioport = 0;
- di.info_physaddr = (ulong)dgnc_Board[brd]->membase;
- di.info_physsize = (ulong)dgnc_Board[brd]->membase
- - dgnc_Board[brd]->membase_end;
- if (dgnc_Board[brd]->state != BOARD_FAILED)
- di.info_nports = dgnc_Board[brd]->nasync;
+ di.info_physaddr = (ulong)dgnc_board[brd]->membase;
+ di.info_physsize = (ulong)dgnc_board[brd]->membase
+ - dgnc_board[brd]->membase_end;
+ if (dgnc_board[brd]->state != BOARD_FAILED)
+ di.info_nports = dgnc_board[brd]->nasync;
else
di.info_nports = 0;

- spin_unlock_irqrestore(&dgnc_Board[brd]->bd_lock, flags);
+ spin_unlock_irqrestore(&dgnc_board[brd]->bd_lock, flags);

if (copy_to_user(uarg, &di, sizeof(di)))
return -EFAULT;
@@ -174,14 +174,14 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
channel = ni.channel;

/* Verify boundaries on board */
- if (board >= dgnc_NumBoards)
+ if (board >= dgnc_num_boards)
return -ENODEV;

/* Verify boundaries on channel */
- if (channel >= dgnc_Board[board]->nasync)
+ if (channel >= dgnc_board[board]->nasync)
return -ENODEV;

- ch = dgnc_Board[board]->channels[channel];
+ ch = dgnc_board[board]->channels[channel];

if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return -ENODEV;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 8106f52..fead81e 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -77,7 +77,8 @@ struct board_ops dgnc_neo_ops = {
.send_immediate_char = neo_send_immediate_char
};

-static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
+static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04,
+ 0x08, 0x10, 0x20, 0x40, 0x80 };

/*
* This function allows calls to ensure that all outstanding
@@ -109,14 +110,17 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch)
/* Turn off auto Xon flow control */
efr &= ~UART_17158_EFR_IXON;

- /* Why? Becuz Exar's spec says we have to zero it out before setting it */
+ /* Why? Becuz Exar's spec says we have to
+ * zero it out before setting it
+ */
writeb(0, &ch->ch_neo_uart->efr);

/* Turn on UART enhanced bits */
writeb(efr, &ch->ch_neo_uart->efr);

/* Turn on table D, with 8 char hi/low watermarks */
- writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), &ch->ch_neo_uart->fctr);
+ writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY),
+ &ch->ch_neo_uart->fctr);

/* Feed the UART our trigger levels */
writeb(8, &ch->ch_neo_uart->tfifo);
@@ -144,13 +148,16 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch)
ier &= ~UART_17158_IER_XOFF;
efr &= ~UART_17158_EFR_IXOFF;

- /* Why? Becuz Exar's spec says we have to zero it out before setting it */
+ /* Why? Becuz Exar's spec says we have to
+ * zero it out before setting it
+ */
writeb(0, &ch->ch_neo_uart->efr);

/* Turn on UART enhanced bits */
writeb(efr, &ch->ch_neo_uart->efr);

- writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), &ch->ch_neo_uart->fctr);
+ writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY),
+ &ch->ch_neo_uart->fctr);
ch->ch_r_watermark = 4;

writeb(32, &ch->ch_neo_uart->rfifo);
@@ -181,13 +188,16 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch)
/* Turn on auto Xon flow control */
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXON);

- /* Why? Becuz Exar's spec says we have to zero it out before setting it */
+ /* Why? Becuz Exar's spec says we have to
+ * zero it out before setting it
+ */
writeb(0, &ch->ch_neo_uart->efr);

/* Turn on UART enhanced bits */
writeb(efr, &ch->ch_neo_uart->efr);

- writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_8DELAY), &ch->ch_neo_uart->fctr);
+ writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_8DELAY),
+ &ch->ch_neo_uart->fctr);
ch->ch_r_watermark = 4;

writeb(32, &ch->ch_neo_uart->rfifo);
@@ -218,14 +228,17 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch)
ier |= UART_17158_IER_XOFF;
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXOFF);

- /* Why? Becuz Exar's spec says we have to zero it out before setting it */
+ /* Why? Becuz Exar's spec says we have to
+ * zero it out before setting it
+ */
writeb(0, &ch->ch_neo_uart->efr);

/* Turn on UART enhanced bits */
writeb(efr, &ch->ch_neo_uart->efr);

/* Turn on table D, with 8 char hi/low watermarks */
- writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_8DELAY), &ch->ch_neo_uart->fctr);
+ writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_8DELAY),
+ &ch->ch_neo_uart->fctr);

writeb(8, &ch->ch_neo_uart->tfifo);
ch->ch_t_tlevel = 8;
@@ -258,14 +271,17 @@ static inline void neo_set_no_input_flow_control(struct channel_t *ch)
else
efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXOFF);

- /* Why? Becuz Exar's spec says we have to zero it out before setting it */
+ /* Why? Becuz Exar's spec says we have to
+ * zero it out before setting it
+ */
writeb(0, &ch->ch_neo_uart->efr);

/* Turn on UART enhanced bits */
writeb(efr, &ch->ch_neo_uart->efr);

/* Turn on table D, with 8 char hi/low watermarks */
- writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_8DELAY), &ch->ch_neo_uart->fctr);
+ writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_8DELAY),
+ &ch->ch_neo_uart->fctr);

ch->ch_r_watermark = 0;

@@ -295,14 +311,17 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch)
else
efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXON);

- /* Why? Becuz Exar's spec says we have to zero it out before setting it */
+ /* Why? Becuz Exar's spec says we have to
+ * zero it out before setting it
+ */
writeb(0, &ch->ch_neo_uart->efr);

/* Turn on UART enhanced bits */
writeb(efr, &ch->ch_neo_uart->efr);

/* Turn on table D, with 8 char hi/low watermarks */
- writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_8DELAY), &ch->ch_neo_uart->fctr);
+ writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_8DELAY),
+ &ch->ch_neo_uart->fctr);

ch->ch_r_watermark = 0;

@@ -321,7 +340,8 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch)
static inline void neo_set_new_start_stop_chars(struct channel_t *ch)
{
/* if hardware flow control is set, then skip this whole thing */
- if (ch->ch_digi.digi_flags & (CTSPACE | RTSPACE) || ch->ch_c_cflag & CRTSCTS)
+ if (ch->ch_digi.digi_flags & (CTSPACE | RTSPACE) ||
+ ch->ch_c_cflag & CRTSCTS)
return;

/* Tell UART what start/stop chars it should be looking for */
@@ -393,7 +413,8 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
break;

/*
- * Yank off the upper 2 bits, which just show that the FIFO's are enabled.
+ * Yank off the upper 2 bits, which just show that
+ * the FIFO's are enabled.
*/
isr &= ~(UART_17158_IIR_FIFO_ENABLED);

@@ -403,7 +424,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
ch->ch_intr_rx++;
neo_copy_data_from_uart_to_queue(ch);

- /* Call our tty layer to enforce queue flow control if needed. */
+ /* Call our tty layer to enforce queue flow control if needed. */
spin_lock_irqsave(&ch->ch_lock, flags);
dgnc_check_queue_flow_control(ch);
spin_unlock_irqrestore(&ch->ch_lock, flags);
@@ -424,11 +445,11 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)

/*
* Since the UART detected either an XON or
- * XOFF match, we need to figure out which
- * one it was, so we can suspend or resume data flow.
+ * XOFF match, we need to figure out which one it
+ * was, so we can suspend or resume data flow.
*/
if (cause == UART_17158_XON_DETECT) {
- /* Is output stopped right now, if so, resume it */
+ /* Is output stopped right now, if so, resume it */
if (brd->channels[port]->ch_flags & CH_STOP) {
spin_lock_irqsave(&ch->ch_lock,
flags);
@@ -449,8 +470,9 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)

if (isr & UART_17158_IIR_HWFLOW_STATE_CHANGE) {
/*
- * If we get here, this means the hardware is doing auto flow control.
- * Check to see whether RTS/DTR or CTS/DSR caused this interrupt.
+ * If we get here, this means the hardware is doing
+ * auto flow control. Check to see whether RTS/DTR or
+ * CTS/DSR caused this interrupt.
*/
brd->intr_modem++;
ch->ch_intr_modem++;
@@ -545,7 +567,7 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port)
* Rx Oruns. Exar says that an orun will NOT corrupt
* the FIFO. It will just replace the holding register
* with this new data byte. So basically just ignore this.
- * Probably we should eventually have an orun stat in our driver...
+ * We should eventually have an orun stat in our driver.
*/
ch->ch_err_overrun++;
}
@@ -665,8 +687,11 @@ static void neo_param(struct tty_struct *tty)
4800, 9600, 19200, 38400 }
};

- /* Only use the TXPrint baud rate if the terminal unit is NOT open */
- if (!(ch->ch_tun.un_flags & UN_ISOPEN) && (un->un_type == DGNC_PRINT))
+ /* Only use the TXPrint baud rate if the
+ * terminal unit is NOT open
+ */
+ if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
+ (un->un_type == DGNC_PRINT))
baud = C_BAUD(ch->ch_pun.un_tty) & 0xff;
else
baud = C_BAUD(ch->ch_tun.un_tty) & 0xff;
@@ -679,7 +704,8 @@ static void neo_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
baud = 0;
@@ -786,8 +812,11 @@ static void neo_param(struct tty_struct *tty)
if (ch->ch_digi.digi_flags & CTSPACE || ch->ch_c_cflag & CRTSCTS) {
neo_set_cts_flow_control(ch);
} else if (ch->ch_c_iflag & IXON) {
- /* If start/stop is set to disable, then we should disable flow control */
- if ((ch->ch_startc == _POSIX_VDISABLE) || (ch->ch_stopc == _POSIX_VDISABLE))
+ /* If start/stop is set to disable, then we
+ * should disable flow control
+ */
+ if ((ch->ch_startc == _POSIX_VDISABLE) ||
+ (ch->ch_stopc == _POSIX_VDISABLE))
neo_set_no_output_flow_control(ch);
else
neo_set_ixon_flow_control(ch);
@@ -798,8 +827,11 @@ static void neo_param(struct tty_struct *tty)
if (ch->ch_digi.digi_flags & RTSPACE || ch->ch_c_cflag & CRTSCTS) {
neo_set_rts_flow_control(ch);
} else if (ch->ch_c_iflag & IXOFF) {
- /* If start/stop is set to disable, then we should disable flow control */
- if ((ch->ch_startc == _POSIX_VDISABLE) || (ch->ch_stopc == _POSIX_VDISABLE))
+ /* If start/stop is set to disable, then we
+ * should disable flow control
+ */
+ if ((ch->ch_startc == _POSIX_VDISABLE) ||
+ (ch->ch_stopc == _POSIX_VDISABLE))
neo_set_no_input_flow_control(ch);
else
neo_set_ixoff_flow_control(ch);
@@ -936,16 +968,16 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
*/
uart_poll = readl(brd->re_map_membase + UART_17158_POLL_ADDR_OFFSET);

- /*
- * If 0, no interrupts pending.
- * This can happen if the IRQ is shared among a couple Neo/Classic boards.
- */
+/*
+ * If 0, no interrupts pending.
+ * This can happen if the IRQ is shared among a couple Neo/Classic boards.
+ */
if (!uart_poll) {
spin_unlock_irqrestore(&brd->bd_intr_lock, flags);
return IRQ_NONE;
}

- /* At this point, we have at least SOMETHING to service, dig further... */
+/* At this point, we have at least SOMETHING to service, dig further.*/

current_port = 0;

@@ -967,7 +999,7 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
uart_poll &= ~(dgnc_offset_table[port]);

if (!type) {
- /* If no type, just ignore it, and move onto next port */
+ /* If no type, just ignore it, and move onto next port */
continue;
}

@@ -986,7 +1018,7 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
ch = brd->channels[port];
neo_copy_data_from_uart_to_queue(ch);

- /* Call our tty layer to enforce queue flow control if needed. */
+ /* Call our tty layer to enforce queue flow control if needed. */
spin_lock_irqsave(&ch->ch_lock, flags2);
dgnc_check_queue_flow_control(ch);
spin_unlock_irqrestore(&ch->ch_lock, flags2);
@@ -1001,18 +1033,19 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
continue;

case UART_17158_TXRDY:
- /*
- * TXRDY interrupt clears after reading ISR register for the UART channel.
- */
+ /*
+ * TXRDY interrupt clears after reading ISR
+ * register for the UART channel.
+ */

- /*
- * Yes, this is odd...
- * Why would I check EVERY possibility of type of
- * interrupt, when we know its TXRDY???
- * Becuz for some reason, even tho we got triggered for TXRDY,
- * it seems to be occasionally wrong. Instead of TX, which
- * it should be, I was getting things like RXDY too. Weird.
- */
+ /*
+ * Yes, this is odd...
+ * Why would I check EVERY possibility of type of
+ * interrupt, when we know its TXRDY???
+ * Becuz for some reason, even tho we got triggered for TXRDY,
+ * it seems to be occasionally wrong. Instead of TX, which
+ * it should be, I was getting things like RXDY too. Weird.
+ */
neo_parse_isr(brd, port);
continue;

@@ -1024,12 +1057,12 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
continue;

default:
- /*
- * The UART triggered us with a bogus interrupt type.
- * It appears the Exar chip, when REALLY bogged down, will throw
- * these once and awhile.
- * Its harmless, just ignore it and move on.
- */
+ /*
+ * The UART triggered us with a bogus interrupt type.
+ * It appears the Exar chip, when REALLY bogged down,
+ * will throw these once and awhile.
+ * Its harmless, just ignore it and move on.
+ */
continue;
}
}
@@ -1108,9 +1141,9 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
* On the other hand, if the UART IS in FIFO mode, then ask
* the UART to give us an approximation of data it has RX'ed.
*/
- if (!(ch->ch_flags & CH_FIFO_ENABLED))
+ if (!(ch->ch_flags & CH_FIFO_ENABLED)) {
total = 0;
- else {
+ } else {
total = readb(&ch->ch_neo_uart->rfifo);

/*
@@ -1172,7 +1205,8 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
linestatus = 0;

/* Copy data from uart to the queue */
- memcpy_fromio(ch->ch_rqueue + head, &ch->ch_neo_uart->txrxburst, n);
+ memcpy_fromio(ch->ch_rqueue + head,
+ &ch->ch_neo_uart->txrxburst, n);

/*
* Since RX_FIFO_DATA_ERROR was 0, we are guaranteed
@@ -1225,7 +1259,8 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
* we don't miss our TX FIFO emptys.
*/
if (linestatus & (UART_LSR_THRE | UART_17158_TX_AND_FIFO_CLR)) {
- linestatus &= ~(UART_LSR_THRE | UART_17158_TX_AND_FIFO_CLR);
+ linestatus &= ~(UART_LSR_THRE |
+ UART_17158_TX_AND_FIFO_CLR);
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
}

@@ -1241,9 +1276,10 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
}

/*
- * If our queue is full, we have no choice but to drop some data.
- * The assumption is that HWFLOW or SWFLOW should have stopped
- * things way way before we got to this point.
+ * If our queue is full, we have no choice but to
+ * drop some data. The assumption is that HWFLOW or
+ * SWFLOW should have stopped things way way before
+ * we got to this point.
*
* I decided that I wanted to ditch the oldest data first,
* I hope thats okay with everyone? Yes? Good.
@@ -1255,7 +1291,8 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
qleft++;
}

- memcpy_fromio(ch->ch_rqueue + head, &ch->ch_neo_uart->txrxburst, 1);
+ memcpy_fromio(ch->ch_rqueue + head,
+ &ch->ch_neo_uart->txrxburst, 1);
ch->ch_equeue[head] = (unsigned char)linestatus;

/* Ditch any remaining linestatus value. */
@@ -1309,7 +1346,8 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
*
* NOTE: TODO: Do something with time passed in.
*/
- rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
+ rc = wait_event_interruptible(un->un_flags_wait,
+ ((un->un_flags & UN_EMPTY) == 0));

/* If ret is non-zero, user ctrl-c'ed us */
return rc;
@@ -1328,11 +1366,12 @@ static void neo_flush_uart_write(struct channel_t *ch)
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return;

- writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT), &ch->ch_neo_uart->isr_fcr);
+ writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT),
+ &ch->ch_neo_uart->isr_fcr);
neo_pci_posting_flush(ch->ch_bd);

for (i = 0; i < 10; i++) {
- /* Check to see if the UART feels it completely flushed the FIFO. */
+/* Check to see if the UART feels it completely flushed the FIFO. */
tmp = readb(&ch->ch_neo_uart->isr_fcr);
if (tmp & 4)
udelay(10);
@@ -1356,11 +1395,12 @@ static void neo_flush_uart_read(struct channel_t *ch)
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return;

- writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR), &ch->ch_neo_uart->isr_fcr);
+ writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR),
+ &ch->ch_neo_uart->isr_fcr);
neo_pci_posting_flush(ch->ch_bd);

for (i = 0; i < 10; i++) {
- /* Check to see if the UART feels it completely flushed the FIFO. */
+/* Check to see if the UART feels it completely flushed the FIFO. */
tmp = readb(&ch->ch_neo_uart->isr_fcr);
if (tmp & 2)
udelay(10);
@@ -1404,10 +1444,11 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
if (ch->ch_cached_lsr & UART_LSR_THRE) {
ch->ch_cached_lsr &= ~(UART_LSR_THRE);

- /*
- * If RTS Toggle mode is on, turn on RTS now if not already set,
- * and make sure we get an event when the data transfer has completed.
- */
+ /*
+ * If RTS Toggle mode is on, turn on RTS now if
+ * not already set, and make sure we get an event
+ * when the data transfer has completed.
+ */
if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
if (!(ch->ch_mostat & UART_MCR_RTS)) {
ch->ch_mostat |= (UART_MCR_RTS);
@@ -1415,10 +1456,11 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
}
ch->ch_tun.un_flags |= (UN_EMPTY);
}
- /*
- * If DTR Toggle mode is on, turn on DTR now if not already set,
- * and make sure we get an event when the data transfer has completed.
- */
+ /*
+ * If DTR Toggle mode is on, turn on DTR now if not
+ * already set, and make sure we get an event when the
+ * data transfer has completed.
+ */
if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
if (!(ch->ch_mostat & UART_MCR_DTR)) {
ch->ch_mostat |= (UART_MCR_DTR);
@@ -1427,7 +1469,8 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
ch->ch_tun.un_flags |= (UN_EMPTY);
}

- writeb(ch->ch_wqueue[ch->ch_w_tail], &ch->ch_neo_uart->txrx);
+ writeb(ch->ch_wqueue[ch->ch_w_tail],
+ &ch->ch_neo_uart->txrx);
ch->ch_w_tail++;
ch->ch_w_tail &= WQUEUEMASK;
ch->ch_txcount++;
@@ -1470,10 +1513,11 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
if (s <= 0)
break;

- /*
- * If RTS Toggle mode is on, turn on RTS now if not already set,
- * and make sure we get an event when the data transfer has completed.
- */
+ /*
+ * If RTS Toggle mode is on, turn on RTS now if not
+ * already set, and make sure we get an event when
+ * the data transfer has completed.
+ */
if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
if (!(ch->ch_mostat & UART_MCR_RTS)) {
ch->ch_mostat |= (UART_MCR_RTS);
@@ -1482,10 +1526,11 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
ch->ch_tun.un_flags |= (UN_EMPTY);
}

- /*
- * If DTR Toggle mode is on, turn on DTR now if not already set,
- * and make sure we get an event when the data transfer has completed.
- */
+ /*
+ * If DTR Toggle mode is on, turn on DTR now if not
+ * already set, and make sure we get an event when the
+ * data transfer has completed.
+ */
if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
if (!(ch->ch_mostat & UART_MCR_DTR)) {
ch->ch_mostat |= (UART_MCR_DTR);
@@ -1494,7 +1539,8 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
ch->ch_tun.un_flags |= (UN_EMPTY);
}

- memcpy_toio(&ch->ch_neo_uart->txrxburst, ch->ch_wqueue + tail, s);
+ memcpy_toio(&ch->ch_neo_uart->txrxburst,
+ ch->ch_wqueue + tail, s);

/* Add and flip queue if needed */
tail = (tail + s) & WQUEUEMASK;
@@ -1547,7 +1593,7 @@ static void neo_parse_modem(struct channel_t *ch, unsigned char signals)
}
}

- /* Scrub off lower bits. They signify delta's, which I don't care about */
+ /* Scrub off lower bits. They signify deltas */
msignals &= 0xf0;

if (msignals & UART_MSR_DCD)
@@ -1628,7 +1674,8 @@ static void neo_uart_init(struct channel_t *ch)

/* Clear out UART and FIFO */
readb(&ch->ch_neo_uart->txrx);
- writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT), &ch->ch_neo_uart->isr_fcr);
+ writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR
+ | UART_FCR_CLEAR_XMIT), &ch->ch_neo_uart->isr_fcr);
readb(&ch->ch_neo_uart->lsr);
readb(&ch->ch_neo_uart->msr);

@@ -1725,7 +1772,8 @@ static void neo_send_immediate_char(struct channel_t *ch, unsigned char c)
neo_pci_posting_flush(ch->ch_bd);
}

-static unsigned int neo_read_eeprom(unsigned char __iomem *base, unsigned int address)
+static unsigned int neo_read_eeprom(unsigned char __iomem *base,
+ unsigned int address)
{
unsigned int enable;
unsigned int bits;
@@ -1779,12 +1827,13 @@ static void neo_vpd(struct dgnc_board *brd)
/* Store the VPD into our buffer */
for (i = 0; i < NEO_VPD_IMAGESIZE; i++) {
a = neo_read_eeprom(brd->re_map_membase, i);
- brd->vpd[i*2] = a & 0xff;
- brd->vpd[(i*2)+1] = (a >> 8) & 0xff;
+ brd->vpd[i * 2] = a & 0xff;
+ brd->vpd[(i * 2) + 1] = (a >> 8) & 0xff;
}

if (((brd->vpd[0x08] != 0x82) /* long resource name tag */
- && (brd->vpd[0x10] != 0x82)) /* long resource name tag (PCI-66 files)*/
+ && (brd->vpd[0x10] != 0x82))
+ /* long resource name tag (PCI-66 files)*/
|| (brd->vpd[0x7F] != 0x78)) { /* small resource end tag */

memset(brd->vpd, '\0', NEO_VPD_IMAGESIZE);
diff --git a/drivers/staging/dgnc/dgnc_neo.h b/drivers/staging/dgnc/dgnc_neo.h
index c528df5..5be232f 100644
--- a/drivers/staging/dgnc/dgnc_neo.h
+++ b/drivers/staging/dgnc/dgnc_neo.h
@@ -30,7 +30,8 @@
struct neo_uart_struct {
u8 txrx; /* WR RHR/THR - Holding Reg */
u8 ier; /* WR IER - Interrupt Enable Reg */
- u8 isr_fcr; /* WR ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
+ u8 isr_fcr;
+ /* WR ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
u8 lcr; /* WR LCR - Line Control Reg */
u8 mcr; /* WR MCR - Modem Control Reg */
u8 lsr; /* WR LSR - Line Status Reg */
@@ -65,8 +66,8 @@ struct neo_uart_struct {
#define NEO_EEDO 0x80 /* Data Out is an Input Pin */
#define NEO_EEREG 0x8E /* offset to EEPROM control reg */

-
-#define NEO_VPD_IMAGESIZE 0x40 /* size of image to read from EEPROM in words */
+#define NEO_VPD_IMAGESIZE 0x40
+/* size of image to read from EEPROM in words */
#define NEO_VPD_IMAGEBYTES (NEO_VPD_IMAGESIZE * 2)

/*
@@ -109,7 +110,8 @@ struct neo_uart_struct {
/* 17158 Extended IIR's */
#define UART_17158_IIR_RDI_TIMEOUT 0x0C /* Receiver data TIMEOUT */
#define UART_17158_IIR_XONXOFF 0x10 /* Received an XON/XOFF char */
-#define UART_17158_IIR_HWFLOW_STATE_CHANGE 0x20 /* CTS/DSR or RTS/DTR state change */
+#define UART_17158_IIR_HWFLOW_STATE_CHANGE 0x20
+/* CTS/DSR or RTS/DTR state change */
#define UART_17158_IIR_FIFO_ENABLED 0xC0 /* 16550 FIFOs are Enabled */

/*
@@ -120,8 +122,10 @@ struct neo_uart_struct {
#define UART_17158_RXRDY_TIMEOUT 0x2 /* RX Ready Timeout */
#define UART_17158_TXRDY 0x3 /* TX Ready */
#define UART_17158_MSR 0x4 /* Modem State Change */
-#define UART_17158_TX_AND_FIFO_CLR 0x40 /* Transmitter Holding Reg Empty */
-#define UART_17158_RX_FIFO_DATA_ERROR 0x80 /* UART detected an RX FIFO Data error */
+#define UART_17158_TX_AND_FIFO_CLR 0x40
+/* Transmitter Holding Reg Empty */
+#define UART_17158_RX_FIFO_DATA_ERROR 0x80
+/* UART detected an RX FIFO Data error */

/*
* These are the EXTENDED definitions for the 17C158's Interrupt
@@ -133,8 +137,10 @@ struct neo_uart_struct {
#define UART_17158_EFR_RTSDTR 0x40 /* Auto RTS/DTR Flow Control Enable */
#define UART_17158_EFR_CTSDSR 0x80 /* Auto CTS/DSR Flow COntrol Enable */

-#define UART_17158_XOFF_DETECT 0x1 /* Indicates whether chip saw an incoming XOFF char */
-#define UART_17158_XON_DETECT 0x2 /* Indicates whether chip saw an incoming XON char */
+#define UART_17158_XOFF_DETECT 0x1
+/* Indicates whether chip saw an incoming XOFF char */
+#define UART_17158_XON_DETECT 0x2
+/* Indicates whether chip saw an incoming XON char */

#define UART_17158_IER_RSVD1 0x10 /* Reserved by Exar */
#define UART_17158_IER_XOFF 0x20 /* Xoff Interrupt Enable */
diff --git a/drivers/staging/dgnc/dgnc_pci.h b/drivers/staging/dgnc/dgnc_pci.h
index 617d40d..4e170c4 100644
--- a/drivers/staging/dgnc/dgnc_pci.h
+++ b/drivers/staging/dgnc/dgnc_pci.h
@@ -59,7 +59,6 @@
#define PCI_DEVICE_NEO_EXPRESS_8RJ45_PCI_NAME "Neo 8 PCI Express RJ45"
#define PCI_DEVICE_NEO_EXPRESS_4_IBM_PCI_NAME "Neo 4 PCI Express IBM"

-
/* Size of Memory and I/O for PCI (4 K) */
#define PCI_RAM_SIZE 0x1000

diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c
index 74a0725..76fca62 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -33,7 +33,7 @@ static DRIVER_ATTR(version, S_IRUSR, dgnc_driver_version_show, NULL);

static ssize_t dgnc_driver_boards_show(struct device_driver *ddp, char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%d\n", dgnc_NumBoards);
+ return snprintf(buf, PAGE_SIZE, "%d\n", dgnc_num_boards);
}
static DRIVER_ATTR(boards, S_IRUSR, dgnc_driver_boards_show, NULL);

@@ -91,18 +91,6 @@ void dgnc_remove_driver_sysfiles(struct pci_driver *dgnc_driver)
driver_remove_file(driverfs, &driver_attr_pollrate);
}

-#define DGNC_VERIFY_BOARD(p, bd) \
- do { \
- if (!p) \
- return 0; \
- \
- bd = dev_get_drvdata(p); \
- if (!bd || bd->magic != DGNC_BOARD_MAGIC) \
- return 0; \
- if (bd->state != BOARD_READY) \
- return 0; \
- } while (0)
-
static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr,
char *buf)
{
@@ -110,7 +98,14 @@ static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr,
int count = 0;
int i = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

count += sprintf(buf + count,
"\n 0 1 2 3 4 5 6 7 8 9 A B C D E F");
@@ -131,7 +126,14 @@ static ssize_t dgnc_serial_number_show(struct device *p,
struct dgnc_board *bd;
int count = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

if (bd->serial_num[0] == '\0')
count += sprintf(buf + count, "<UNKNOWN>\n");
@@ -149,7 +151,14 @@ static ssize_t dgnc_ports_state_show(struct device *p,
int count = 0;
int i = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

for (i = 0; i < bd->nasync; i++) {
count += snprintf(buf + count, PAGE_SIZE - count,
@@ -167,7 +176,14 @@ static ssize_t dgnc_ports_baud_show(struct device *p,
int count = 0;
int i = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

for (i = 0; i < bd->nasync; i++) {
count += snprintf(buf + count, PAGE_SIZE - count,
@@ -186,19 +202,32 @@ static ssize_t dgnc_ports_msignals_show(struct device *p,
int count = 0;
int i = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

for (i = 0; i < bd->nasync; i++) {
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" : "",
- (bd->channels[i]->ch_mistat & UART_MSR_CTS) ? "CTS" : "",
- (bd->channels[i]->ch_mostat & UART_MCR_DTR) ? "DTR" : "",
- (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" : "");
+ (bd->channels[i]->ch_mostat & UART_MCR_RTS)
+ ? "RTS" : "",
+ (bd->channels[i]->ch_mistat & UART_MSR_CTS)
+ ? "CTS" : "",
+ (bd->channels[i]->ch_mostat & UART_MCR_DTR)
+ ? "DTR" : "",
+ (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 {
count += snprintf(buf + count, PAGE_SIZE - count,
"%d\n", bd->channels[i]->ch_portnum);
@@ -215,7 +244,14 @@ static ssize_t dgnc_ports_iflag_show(struct device *p,
int count = 0;
int i = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

for (i = 0; i < bd->nasync; i++) {
count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -233,7 +269,14 @@ static ssize_t dgnc_ports_cflag_show(struct device *p,
int count = 0;
int i = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

for (i = 0; i < bd->nasync; i++) {
count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -251,7 +294,14 @@ static ssize_t dgnc_ports_oflag_show(struct device *p,
int count = 0;
int i = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

for (i = 0; i < bd->nasync; i++) {
count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -269,7 +319,14 @@ static ssize_t dgnc_ports_lflag_show(struct device *p,
int count = 0;
int i = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

for (i = 0; i < bd->nasync; i++) {
count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -288,7 +345,14 @@ static ssize_t dgnc_ports_digi_flag_show(struct device *p,
int count = 0;
int i = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

for (i = 0; i < bd->nasync; i++) {
count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -306,7 +370,14 @@ static ssize_t dgnc_ports_rxcount_show(struct device *p,
int count = 0;
int i = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

for (i = 0; i < bd->nasync; i++) {
count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n",
@@ -324,7 +395,14 @@ static ssize_t dgnc_ports_txcount_show(struct device *p,
int count = 0;
int i = 0;

- DGNC_VERIFY_BOARD(p, bd);
+ if (!p)
+ return 0;
+
+ bd = dev_get_drvdata(p);
+ if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ return 0;
+ if (bd->state != BOARD_READY)
+ return 0;

for (i = 0; i < bd->nasync; i++) {
count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n",
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 48e4b90..53976c0 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -45,8 +45,8 @@
/*
* internal variables
*/
-static struct dgnc_board *dgnc_BoardsByMajor[256];
-static unsigned char *dgnc_TmpWriteBuf;
+static struct dgnc_board *dgnc_boards_by_major[256];
+static unsigned char *dgnc_tmp_write_buf;

/*
* Default transparent print information.
@@ -70,7 +70,7 @@ static struct digi_t dgnc_digi_init = {
* This defines a raw port at 9600 baud, 8 data bits, no parity,
* 1 stop bit.
*/
-static struct ktermios DgncDefaultTermios = {
+static struct ktermios dgnc_default_termios = {
.c_iflag = (DEFAULT_IFLAGS), /* iflags */
.c_oflag = (DEFAULT_OFLAGS), /* oflags */
.c_cflag = (DEFAULT_CFLAGS), /* cflags */
@@ -161,9 +161,9 @@ int dgnc_tty_preinit(void)
* is only called during module load, (not in interrupt context),
* and with no locks held.
*/
- dgnc_TmpWriteBuf = kmalloc(WRITEBUFLEN, GFP_KERNEL);
+ dgnc_tmp_write_buf = kmalloc(WRITEBUFLEN, GFP_KERNEL);

- if (!dgnc_TmpWriteBuf)
+ if (!dgnc_tmp_write_buf)
return -ENOMEM;

return 0;
@@ -178,20 +178,21 @@ int dgnc_tty_register(struct dgnc_board *brd)
{
int rc = 0;

- brd->SerialDriver.magic = TTY_DRIVER_MAGIC;
-
- snprintf(brd->SerialName, MAXTTYNAMELEN, "tty_dgnc_%d_", brd->boardnum);
-
- brd->SerialDriver.name = brd->SerialName;
- brd->SerialDriver.name_base = 0;
- brd->SerialDriver.major = 0;
- brd->SerialDriver.minor_start = 0;
- brd->SerialDriver.num = brd->maxports;
- brd->SerialDriver.type = TTY_DRIVER_TYPE_SERIAL;
- brd->SerialDriver.subtype = SERIAL_TYPE_NORMAL;
- brd->SerialDriver.init_termios = DgncDefaultTermios;
- brd->SerialDriver.driver_name = DRVSTR;
- brd->SerialDriver.flags = (TTY_DRIVER_REAL_RAW |
+ brd->serial_driver.magic = TTY_DRIVER_MAGIC;
+
+ snprintf(brd->serial_name, MAXTTYNAMELEN,
+ "tty_dgnc_%d_", brd->boardnum);
+
+ brd->serial_driver.name = brd->serial_name;
+ brd->serial_driver.name_base = 0;
+ brd->serial_driver.major = 0;
+ brd->serial_driver.minor_start = 0;
+ brd->serial_driver.num = brd->maxports;
+ brd->serial_driver.type = TTY_DRIVER_TYPE_SERIAL;
+ brd->serial_driver.subtype = SERIAL_TYPE_NORMAL;
+ brd->serial_driver.init_termios = dgnc_default_termios;
+ brd->serial_driver.driver_name = DRVSTR;
+ brd->serial_driver.flags = (TTY_DRIVER_REAL_RAW |
TTY_DRIVER_DYNAMIC_DEV |
TTY_DRIVER_HARDWARE_BREAK);

@@ -199,34 +200,34 @@ int dgnc_tty_register(struct dgnc_board *brd)
* The kernel wants space to store pointers to
* tty_struct's and termios's.
*/
- brd->SerialDriver.ttys = kcalloc(brd->maxports,
- sizeof(*brd->SerialDriver.ttys),
+ brd->serial_driver.ttys = kcalloc(brd->maxports,
+ sizeof(*brd->serial_driver.ttys),
GFP_KERNEL);
- if (!brd->SerialDriver.ttys)
+ if (!brd->serial_driver.ttys)
return -ENOMEM;

- kref_init(&brd->SerialDriver.kref);
- brd->SerialDriver.termios = kcalloc(brd->maxports,
- sizeof(*brd->SerialDriver.termios),
+ kref_init(&brd->serial_driver.kref);
+ brd->serial_driver.termios = kcalloc(brd->maxports,
+ sizeof(*brd->serial_driver.termios),
GFP_KERNEL);
- if (!brd->SerialDriver.termios)
+ if (!brd->serial_driver.termios)
return -ENOMEM;

/*
* Entry points for driver. Called by the kernel from
* tty_io.c and n_tty.c.
*/
- tty_set_operations(&brd->SerialDriver, &dgnc_tty_ops);
+ tty_set_operations(&brd->serial_driver, &dgnc_tty_ops);

- if (!brd->dgnc_Major_Serial_Registered) {
+ if (!brd->dgnc_major_serial_registered) {
/* Register tty devices */
- rc = tty_register_driver(&brd->SerialDriver);
+ rc = tty_register_driver(&brd->serial_driver);
if (rc < 0) {
dev_dbg(&brd->pdev->dev,
"Can't register tty device (%d)\n", rc);
return rc;
}
- brd->dgnc_Major_Serial_Registered = true;
+ brd->dgnc_major_serial_registered = true;
}

/*
@@ -234,19 +235,19 @@ int dgnc_tty_register(struct dgnc_board *brd)
* again, separately so we don't get the LD confused about what major
* we are when we get into the dgnc_tty_open() routine.
*/
- brd->PrintDriver.magic = TTY_DRIVER_MAGIC;
- snprintf(brd->PrintName, MAXTTYNAMELEN, "pr_dgnc_%d_", brd->boardnum);
-
- brd->PrintDriver.name = brd->PrintName;
- brd->PrintDriver.name_base = 0;
- brd->PrintDriver.major = brd->SerialDriver.major;
- brd->PrintDriver.minor_start = 0x80;
- brd->PrintDriver.num = brd->maxports;
- brd->PrintDriver.type = TTY_DRIVER_TYPE_SERIAL;
- brd->PrintDriver.subtype = SERIAL_TYPE_NORMAL;
- brd->PrintDriver.init_termios = DgncDefaultTermios;
- brd->PrintDriver.driver_name = DRVSTR;
- brd->PrintDriver.flags = (TTY_DRIVER_REAL_RAW |
+ brd->print_driver.magic = TTY_DRIVER_MAGIC;
+ snprintf(brd->print_name, MAXTTYNAMELEN, "pr_dgnc_%d_", brd->boardnum);
+
+ brd->print_driver.name = brd->print_name;
+ brd->print_driver.name_base = 0;
+ brd->print_driver.major = brd->serial_driver.major;
+ brd->print_driver.minor_start = 0x80;
+ brd->print_driver.num = brd->maxports;
+ brd->print_driver.type = TTY_DRIVER_TYPE_SERIAL;
+ brd->print_driver.subtype = SERIAL_TYPE_NORMAL;
+ brd->print_driver.init_termios = dgnc_default_termios;
+ brd->print_driver.driver_name = DRVSTR;
+ brd->print_driver.flags = (TTY_DRIVER_REAL_RAW |
TTY_DRIVER_DYNAMIC_DEV |
TTY_DRIVER_HARDWARE_BREAK);

@@ -255,39 +256,39 @@ int dgnc_tty_register(struct dgnc_board *brd)
* tty_struct's and termios's. Must be separated from
* the Serial Driver so we don't get confused
*/
- brd->PrintDriver.ttys = kcalloc(brd->maxports,
- sizeof(*brd->PrintDriver.ttys),
+ brd->print_driver.ttys = kcalloc(brd->maxports,
+ sizeof(*brd->print_driver.ttys),
GFP_KERNEL);
- if (!brd->PrintDriver.ttys)
+ if (!brd->print_driver.ttys)
return -ENOMEM;
- kref_init(&brd->PrintDriver.kref);
- brd->PrintDriver.termios = kcalloc(brd->maxports,
- sizeof(*brd->PrintDriver.termios),
+ kref_init(&brd->print_driver.kref);
+ brd->print_driver.termios = kcalloc(brd->maxports,
+ sizeof(*brd->print_driver.termios),
GFP_KERNEL);
- if (!brd->PrintDriver.termios)
+ if (!brd->print_driver.termios)
return -ENOMEM;

/*
* Entry points for driver. Called by the kernel from
* tty_io.c and n_tty.c.
*/
- tty_set_operations(&brd->PrintDriver, &dgnc_tty_ops);
+ tty_set_operations(&brd->print_driver, &dgnc_tty_ops);

- if (!brd->dgnc_Major_TransparentPrint_Registered) {
+ if (!brd->dgnc_major_transparent_print_registered) {
/* Register Transparent Print devices */
- rc = tty_register_driver(&brd->PrintDriver);
+ rc = tty_register_driver(&brd->print_driver);
if (rc < 0) {
dev_dbg(&brd->pdev->dev,
"Can't register Transparent Print device(%d)\n",
rc);
return rc;
}
- brd->dgnc_Major_TransparentPrint_Registered = true;
+ brd->dgnc_major_transparent_print_registered = true;
}

- dgnc_BoardsByMajor[brd->SerialDriver.major] = brd;
- brd->dgnc_Serial_Major = brd->SerialDriver.major;
- brd->dgnc_TransparentPrint_Major = brd->PrintDriver.major;
+ dgnc_boards_by_major[brd->serial_driver.major] = brd;
+ brd->dgnc_serial_major = brd->serial_driver.major;
+ brd->dgnc_transparent_print_major = brd->print_driver.major;

return rc;
}
@@ -364,12 +365,12 @@ int dgnc_tty_init(struct dgnc_board *brd)
{
struct device *classp;

- classp = tty_register_device(&brd->SerialDriver, i,
+ classp = tty_register_device(&brd->serial_driver, i,
&ch->ch_bd->pdev->dev);
ch->ch_tun.un_sysfs = classp;
dgnc_create_tty_sysfs(&ch->ch_tun, classp);

- classp = tty_register_device(&brd->PrintDriver, i,
+ classp = tty_register_device(&brd->print_driver, i,
&ch->ch_bd->pdev->dev);
ch->ch_pun.un_sysfs = classp;
dgnc_create_tty_sysfs(&ch->ch_pun, classp);
@@ -393,8 +394,8 @@ err_free_channels:
*/
void dgnc_tty_post_uninit(void)
{
- kfree(dgnc_TmpWriteBuf);
- dgnc_TmpWriteBuf = NULL;
+ kfree(dgnc_tmp_write_buf);
+ dgnc_tmp_write_buf = NULL;
}

/*
@@ -407,40 +408,40 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
{
int i = 0;

- if (brd->dgnc_Major_Serial_Registered) {
- dgnc_BoardsByMajor[brd->SerialDriver.major] = NULL;
- brd->dgnc_Serial_Major = 0;
+ if (brd->dgnc_major_serial_registered) {
+ dgnc_boards_by_major[brd->serial_driver.major] = NULL;
+ brd->dgnc_serial_major = 0;
for (i = 0; i < brd->nasync; i++) {
if (brd->channels[i])
dgnc_remove_tty_sysfs(brd->channels[i]->
ch_tun.un_sysfs);
- tty_unregister_device(&brd->SerialDriver, i);
+ tty_unregister_device(&brd->serial_driver, i);
}
- tty_unregister_driver(&brd->SerialDriver);
- brd->dgnc_Major_Serial_Registered = false;
+ tty_unregister_driver(&brd->serial_driver);
+ brd->dgnc_major_serial_registered = false;
}

- if (brd->dgnc_Major_TransparentPrint_Registered) {
- dgnc_BoardsByMajor[brd->PrintDriver.major] = NULL;
- brd->dgnc_TransparentPrint_Major = 0;
+ if (brd->dgnc_major_transparent_print_registered) {
+ dgnc_boards_by_major[brd->print_driver.major] = NULL;
+ brd->dgnc_transparent_print_major = 0;
for (i = 0; i < brd->nasync; i++) {
if (brd->channels[i])
dgnc_remove_tty_sysfs(brd->channels[i]->
ch_pun.un_sysfs);
- tty_unregister_device(&brd->PrintDriver, i);
+ tty_unregister_device(&brd->print_driver, i);
}
- tty_unregister_driver(&brd->PrintDriver);
- brd->dgnc_Major_TransparentPrint_Registered = false;
+ tty_unregister_driver(&brd->print_driver);
+ brd->dgnc_major_transparent_print_registered = false;
}

- kfree(brd->SerialDriver.ttys);
- brd->SerialDriver.ttys = NULL;
- kfree(brd->SerialDriver.termios);
- brd->SerialDriver.termios = NULL;
- kfree(brd->PrintDriver.ttys);
- brd->PrintDriver.ttys = NULL;
- kfree(brd->PrintDriver.termios);
- brd->PrintDriver.termios = NULL;
+ kfree(brd->serial_driver.ttys);
+ brd->serial_driver.ttys = NULL;
+ kfree(brd->serial_driver.termios);
+ brd->serial_driver.termios = NULL;
+ kfree(brd->print_driver.ttys);
+ brd->print_driver.ttys = NULL;
+ kfree(brd->print_driver.termios);
+ brd->print_driver.termios = NULL;
}

/*=======================================================================
@@ -448,10 +449,11 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
* dgnc_wmove - Write data to transmit queue.
*
* ch - Pointer to channel structure.
- * buf - Poiter to characters to be moved.
+ * buf - Pointer to characters to be moved.
* n - Number of characters to move.
*
- *=======================================================================*/
+ *=======================================================================
+ */
static void dgnc_wmove(struct channel_t *ch, char *buf, uint n)
{
int remain;
@@ -489,13 +491,14 @@ static void dgnc_wmove(struct channel_t *ch, char *buf, uint n)
ch->ch_w_head = head;
}

-/*=======================================================================
+/*==================================================================
*
* dgnc_input - Process received data.
*
* ch - Pointer to channel structure.
*
- *=======================================================================*/
+ *==================================================================
+ */
void dgnc_input(struct channel_t *ch)
{
struct dgnc_board *bd;
@@ -1029,7 +1032,7 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
return -ENXIO;

/* Get board pointer from our array of majors we have allocated */
- brd = dgnc_BoardsByMajor[major];
+ brd = dgnc_boards_by_major[major];
if (!brd)
return -ENXIO;

@@ -1619,7 +1622,7 @@ static int dgnc_tty_write_room(struct tty_struct *tty)
int ret = 0;
unsigned long flags;

- if (!tty || !dgnc_TmpWriteBuf)
+ if (!tty || !dgnc_tmp_write_buf)
return 0;

un = tty->driver_data;
@@ -1698,7 +1701,7 @@ static int dgnc_tty_write(struct tty_struct *tty,
ushort tmask;
uint remain;

- if (!tty || !dgnc_TmpWriteBuf)
+ if (!tty || !dgnc_tmp_write_buf)
return 0;

un = tty->driver_data;
@@ -2520,12 +2523,12 @@ static void dgnc_tty_flush_buffer(struct tty_struct *tty)
/* Flush UARTs transmit FIFO */
ch->ch_bd->bd_ops->flush_uart_write(ch);

- if (ch->ch_tun.un_flags & (UN_LOW|UN_EMPTY)) {
- ch->ch_tun.un_flags &= ~(UN_LOW|UN_EMPTY);
+ if (ch->ch_tun.un_flags & (UN_LOW | UN_EMPTY)) {
+ ch->ch_tun.un_flags &= ~(UN_LOW | UN_EMPTY);
wake_up_interruptible(&ch->ch_tun.un_flags_wait);
}
- if (ch->ch_pun.un_flags & (UN_LOW|UN_EMPTY)) {
- ch->ch_pun.un_flags &= ~(UN_LOW|UN_EMPTY);
+ if (ch->ch_pun.un_flags & (UN_LOW | UN_EMPTY)) {
+ ch->ch_pun.un_flags &= ~(UN_LOW | UN_EMPTY);
wake_up_interruptible(&ch->ch_pun.un_flags_wait);
}

@@ -2717,15 +2720,15 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
ch->ch_w_head = ch->ch_w_tail;
ch->ch_bd->bd_ops->flush_uart_write(ch);

- if (ch->ch_tun.un_flags & (UN_LOW|UN_EMPTY)) {
+ if (ch->ch_tun.un_flags & (UN_LOW | UN_EMPTY)) {
ch->ch_tun.un_flags &=
- ~(UN_LOW|UN_EMPTY);
+ ~(UN_LOW | UN_EMPTY);
wake_up_interruptible(&ch->ch_tun.un_flags_wait);
}

- if (ch->ch_pun.un_flags & (UN_LOW|UN_EMPTY)) {
+ if (ch->ch_pun.un_flags & (UN_LOW | UN_EMPTY)) {
ch->ch_pun.un_flags &=
- ~(UN_LOW|UN_EMPTY);
+ ~(UN_LOW | UN_EMPTY);
wake_up_interruptible(&ch->ch_pun.un_flags_wait);
}
}
@@ -2957,7 +2960,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
* Figure out how much data the RealPort Server believes should
* be in our TX queue.
*/
- tdist = (buf.tIn - buf.tOut) & 0xffff;
+ tdist = (buf.t_in - buf.t_out) & 0xffff;

/*
* If we have more data than the RealPort Server believes we
diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index cf9dcae..701312f 100644
--- a/drivers/staging/dgnc/digi.h
+++ b/drivers/staging/dgnc/digi.h
@@ -31,21 +31,21 @@
#endif

#if !defined(TIOCMSET)
-#define TIOCMSET (('d'<<8) | 252) /* set modem ctrl state */
-#define TIOCMGET (('d'<<8) | 253) /* set modem ctrl state */
+#define TIOCMSET (('d' << 8) | 252) /* set modem ctrl state */
+#define TIOCMGET (('d' << 8) | 253) /* set modem ctrl state */
#endif

#if !defined(TIOCMBIC)
-#define TIOCMBIC (('d'<<8) | 254) /* set modem ctrl state */
-#define TIOCMBIS (('d'<<8) | 255) /* set modem ctrl state */
+#define TIOCMBIC (('d' << 8) | 254) /* set modem ctrl state */
+#define TIOCMBIS (('d' << 8) | 255) /* set modem ctrl state */
#endif

-#define DIGI_GETA (('e'<<8) | 94) /* Read params */
-#define DIGI_SETA (('e'<<8) | 95) /* Set params */
-#define DIGI_SETAW (('e'<<8) | 96) /* Drain & set params */
-#define DIGI_SETAF (('e'<<8) | 97) /* Drain, flush & set params */
-#define DIGI_GET_NI_INFO (('d'<<8) | 250) /* Non-intelligent state info */
-#define DIGI_LOOPBACK (('d'<<8) | 252) /*
+#define DIGI_GETA (('e' << 8) | 94) /* Read params */
+#define DIGI_SETA (('e' << 8) | 95) /* Set params */
+#define DIGI_SETAW (('e' << 8) | 96) /* Drain & set params */
+#define DIGI_SETAF (('e' << 8) | 97) /* Drain, flush & set params */
+#define DIGI_GET_NI_INFO (('d' << 8) | 250) /* Non-intelligent state info */
+#define DIGI_LOOPBACK (('d' << 8) | 252) /*
* Enable/disable UART
* internal loopback
*/
@@ -85,7 +85,7 @@ struct digi_dinfo {
char dinfo_version[16]; /* driver version */
};

-#define DIGI_GETDD (('d'<<8) | 248) /* get driver info */
+#define DIGI_GETDD (('d' << 8) | 248) /* get driver info */

/************************************************************************
* Structure used with ioctl commands for per-board information
@@ -94,10 +94,10 @@ struct digi_dinfo {
************************************************************************/
struct digi_info {
unsigned int info_bdnum; /* Board number (0 based) */
- unsigned int info_ioport; /* io port address */
- unsigned int info_physaddr; /* memory address */
- unsigned int info_physsize; /* Size of host mem window */
- unsigned int info_memsize; /* Amount of dual-port mem */
+ unsigned int info_ioport; /* io port address */
+ unsigned int info_physaddr; /* memory address */
+ unsigned int info_physsize; /* Size of host mem window */
+ unsigned int info_memsize; /* Amount of dual-port mem */
/* on board */
unsigned short info_bdtype; /* Board type */
unsigned short info_nports; /* number of ports */
@@ -105,12 +105,12 @@ struct digi_info {
char info_reserved[7]; /* for future expansion */
};

-#define DIGI_GETBD (('d'<<8) | 249) /* get board info */
+#define DIGI_GETBD (('d' << 8) | 249) /* get board info */

struct digi_getbuffer /* Struct for holding buffer use counts */
{
- unsigned long tIn;
- unsigned long tOut;
+ unsigned long t_in;
+ unsigned long t_out;
unsigned long rxbuf;
unsigned long txbuf;
unsigned long txdone;
@@ -133,10 +133,10 @@ struct digi_getcounter {
#define DIGI_SETCUSTOMBAUD _IOW('e', 106, int) /* Set integer baud rate */
#define DIGI_GETCUSTOMBAUD _IOR('e', 107, int) /* Get integer baud rate */

-#define DIGI_REALPORT_GETBUFFERS (('e'<<8) | 108)
-#define DIGI_REALPORT_SENDIMMEDIATE (('e'<<8) | 109)
-#define DIGI_REALPORT_GETCOUNTERS (('e'<<8) | 110)
-#define DIGI_REALPORT_GETEVENTS (('e'<<8) | 111)
+#define DIGI_REALPORT_GETBUFFERS (('e' << 8) | 108)
+#define DIGI_REALPORT_SENDIMMEDIATE (('e' << 8) | 109)
+#define DIGI_REALPORT_GETCOUNTERS (('e' << 8) | 110)
+#define DIGI_REALPORT_GETEVENTS (('e' << 8) | 111)

#define EV_OPU 0x0001 /* !<Output paused by client */
#define EV_OPS 0x0002 /* !<Output paused by reqular sw flowctrl */
--
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/