2015-12-11 12:23:10

by Sanidhya Solanki

[permalink] [raw]
Subject: [PATCH] staging: dgnc: Patch includes the checkpatch fixes

>From 1dbe78ce98037da5467d817a9db838d678b338ae Mon Sep 17 00:00:00 2001
From: Sanidhya Solanki <[email protected]>
Date: Fri, 11 Dec 2015 03:08:53 -0500
Subject: [PATCH] staging: dgnc: Patch includes the checkpatch fixes

Patch contains the checkpatch fixes as asked by the TODO.
TODO file is updated as well.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/TODO | 1 -
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 | 163 +++++++++++++++++++++-----
drivers/staging/dgnc/dgnc_tty.c | 197 +++++++++++++++----------------
drivers/staging/dgnc/digi.h | 44 +++----
11 files changed, 464 insertions(+), 314 deletions(-)

diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index 0e0825b..0bdfd26 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,4 +1,3 @@
-* checkpatch fixes
* remove unnecessary comments
* remove unnecessary error messages. Example kzalloc() has its
own error message. Adding an extra one is useless.
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..6600b0b 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,16 @@ static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr,
int count = 0;
int i = 0;

- 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);

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

- 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);

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

- 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);

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

- 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);

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

- 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);

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,8 +254,16 @@ static ssize_t dgnc_ports_iflag_show(struct device *p,
int count = 0;
int i = 0;

- 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);
for (i = 0; i < bd->nasync; i++) {
count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
bd->channels[i]->ch_portnum,
@@ -233,7 +280,16 @@ static ssize_t dgnc_ports_cflag_show(struct device *p,
int count = 0;
int i = 0;

- 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);

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

- 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);

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

- 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);

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

- 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);

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

- 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);

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

- 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);

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


2015-12-11 14:12:15

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes

On Fri, 11 Dec 2015 16:02:33 +0300
Dan Carpenter <[email protected]> wrote:

> > Signed-off-by: Sanidhya Solanki <[email protected]>
> > @@ -110,7 +98,16 @@ static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr,
> > int count = 0;
> > int i = 0;
> >
> > - 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);
>
> Google about why do while(0) loops are used in macros and then redo
> this. Mostly the patch isn't bad, but I suspect I'm going to complain
> about how you split up some of the long lines.

Let me just be completely sure that you and I are on the same page here. The macro was used to replace the do-while loop, I replaced all instances of the macro with the the actual loop. Both pieces were originally part of the code, just using macros in place of do-while statements. Do you still want me to change it? Maybe the original author did it for a specific reason.

Thanks

2015-12-11 13:02:46

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes

On Fri, Dec 11, 2015 at 03:21:49AM -0500, Sanidhya Solanki wrote:
> >From 1dbe78ce98037da5467d817a9db838d678b338ae Mon Sep 17 00:00:00 2001
> From: Sanidhya Solanki <[email protected]>
> Date: Fri, 11 Dec 2015 03:08:53 -0500
> Subject: [PATCH] staging: dgnc: Patch includes the checkpatch fixes


Don't include this stuff.

>
> Patch contains the checkpatch fixes as asked by the TODO.
> TODO file is updated as well.

Fix one type of warning at a time. This will be a series of patches.

>
> Signed-off-by: Sanidhya Solanki <[email protected]>
> @@ -110,7 +98,16 @@ static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr,
> int count = 0;
> int i = 0;
>
> - 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);

Google about why do while(0) loops are used in macros and then redo
this. Mostly the patch isn't bad, but I suspect I'm going to complain
about how you split up some of the long lines.

regards,
dan carpenter

2015-12-11 14:18:59

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes

On Fri, Dec 11, 2015 at 05:10:43AM -0500, Sanidhya Solanki wrote:
> On Fri, 11 Dec 2015 16:02:33 +0300
> Dan Carpenter <[email protected]> wrote:
>
> > > Signed-off-by: Sanidhya Solanki <[email protected]>
> > > @@ -110,7 +98,16 @@ static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr,
> > > int count = 0;
> > > int i = 0;
> > >
> > > - 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);
> >
> > Google about why do while(0) loops are used in macros and then redo
> > this. Mostly the patch isn't bad, but I suspect I'm going to complain
> > about how you split up some of the long lines.
>
> Let me just be completely sure that you and I are on the same page
> here. The macro was used to replace the do-while loop, I replaced all
> instances of the macro with the the actual loop. Both pieces were
> originally part of the code, just using macros in place of do-while
> statements. Do you still want me to change it? Maybe the original
> author did it for a specific reason.
>

https://www.quora.com/What-is-the-purpose-of-using-do-while-0-in-macros

Do while(0) is used to make a macro look like a function. Since we have
deleted the macro we don't need the do while.

regards,
dan carpenter

2015-12-12 06:16:52

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH] staging: dgnc: Update the TODO file

>From ae99848ed2c054e3ec031b3014f4727f6ff94ea3 Mon Sep 17 00:00:00 2001
From: Sanidhya Solanki <[email protected]>
Date: Fri, 11 Dec 2015 21:12:35 -0500
Subject: [PATCH 2/2] staging: dgnc: Update the TODO file

Patch updates the TODO file. Line regarding checkpatch
changes removed.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/TODO | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index 0e0825b..0bdfd26 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,4 +1,3 @@
-* checkpatch fixes
* remove unnecessary comments
* remove unnecessary error messages. Example kzalloc() has its
own error message. Adding an extra one is useless.
--
2.5.0

2015-12-12 06:25:33

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes

On Fri, 11 Dec 2015 16:02:33 +0300
Dan Carpenter <[email protected]> wrote:

> On Fri, Dec 11, 2015 at 03:21:49AM -0500, Sanidhya Solanki wrote:
> > >From 1dbe78ce98037da5467d817a9db838d678b338ae Mon Sep 17 00:00:00 2001
> > From: Sanidhya Solanki <[email protected]>
> > Date: Fri, 11 Dec 2015 03:08:53 -0500
> > Subject: [PATCH] staging: dgnc: Patch includes the checkpatch fixes
>
>
> Don't include this stuff.
Whenever I remove that part, the "git am" command gives me an error that
it cannot detect patch format and the patch application fails.

Thanks for the macro information. I misunderstood initially and thought you
wanted me to get rid of the entire code block included in the do-while,
rather than just replacing the do-while loop with the code. I sent you
an update patch that does just that and a separate patch that includes
the TODO file update.

Any more errors in the code regarding parenthesis alignment are a
checkpatch bug, which you can visually reconfirm.

Also, any more requests by checkpatch to further breakup the remaining
long lines may further degrade readablility due to presence of arrow
pointers.

Thanks

2015-12-12 10:13:49

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes

Thank you everyone for your concern regarding my email client.

Unfortunately, there is a bug in "git send-email" that leads to the gmail
SMTP server rejecting certain patches sent by the git command. If I can
replicate and fix the issue for " git am" (which I do apply after emailing
to myself) I will not send the git header anymore.

This bug is well documented. It presents itself as an error in line 1351/1320
in a gitconfig file. Rest assured you will not see the git header again.

Thanks

2015-12-12 12:00:18

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

>From a1635ea5e75cb2f10728ae4ddf3a21567958e98f Mon Sep 17 00:00:00 2001
From: Sanidhya Solanki <[email protected]>
Date: Sat, 12 Dec 2015 02:20:03 -0500
Subject: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch
fixes

Patch contains the spacing fixes that checkpatch prompted for,
as asked by the TODO.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/dgnc_cls.c | 4 +-
drivers/staging/dgnc/dgnc_driver.h | 8 --
drivers/staging/dgnc/dgnc_neo.c | 235 ++++++++++++++++++++++++-------------
drivers/staging/dgnc/dgnc_neo.h | 22 ++--
drivers/staging/dgnc/dgnc_pci.h | 1 -
drivers/staging/dgnc/dgnc_sysfs.c | 18 ++-
drivers/staging/dgnc/dgnc_tty.c | 46 +++++---
drivers/staging/dgnc/digi.h | 32 ++---
8 files changed, 223 insertions(+), 143 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.h b/drivers/staging/dgnc/dgnc_driver.h
index ce7cd9b..e4be81b 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -88,7 +88,6 @@
#define _POSIX_VDISABLE '\0'
#endif

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

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

-
/*
* Per-board information
*/
@@ -241,7 +238,6 @@ struct dgnc_board {

};

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

-
/************************************************************************
* Device flag definitions for ch_flags.
************************************************************************/
@@ -300,7 +295,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 +303,6 @@ struct un_t {
#define EQUEUESIZE RQUEUESIZE
#define WQUEUESIZE (WQUEUEMASK + 1)

-
/************************************************************************
* Channel information structure.
************************************************************************/
@@ -397,7 +390,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;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 8106f52..2b94b75 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 */
@@ -352,7 +372,7 @@ static inline void neo_clear_break(struct channel_t *ch, int force)
/* Turn break off, and unset some variables */
if (ch->ch_flags & CH_BREAK_SENDING) {
if (time_after_eq(jiffies, ch->ch_stop_sending_break)
- || force) {
+ || force) {
unsigned char temp = readb(&ch->ch_neo_uart->lcr);

writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
@@ -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,9 @@ 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);
@@ -428,7 +451,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
* 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);
@@ -437,7 +460,8 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
flags);
}
} else if (cause == UART_17158_XOFF_DETECT) {
- if (!(brd->channels[port]->ch_flags & CH_STOP)) {
+ if (!(brd->channels[port]->ch_flags &
+ CH_STOP)) {
spin_lock_irqsave(&ch->ch_lock,
flags);
ch->ch_flags |= CH_STOP;
@@ -449,8 +473,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++;
@@ -542,10 +567,11 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port)

if (linestatus & UART_LSR_OE) {
/*
- * 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...
+ * 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.
*/
ch->ch_err_overrun++;
}
@@ -665,8 +691,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 +708,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;
@@ -763,8 +793,9 @@ static void neo_param(struct tty_struct *tty)
ier &= ~(UART_IER_RDI | UART_IER_RLSI);

/*
- * Have the UART interrupt on modem signal changes ONLY when
- * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
+ * Have the UART interrupt on modem signal changes
+ * ONLY when we are in hardware flow control mode,
+ * or CLOCAL/FORCEDCD is not set.
*/
if ((ch->ch_digi.digi_flags & CTSPACE) ||
(ch->ch_digi.digi_flags & RTSPACE) ||
@@ -786,8 +817,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 +832,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);
@@ -808,9 +845,10 @@ static void neo_param(struct tty_struct *tty)
}

/*
- * Adjust the RX FIFO Trigger level if baud is less than 9600.
- * Not exactly elegant, but this is needed because of the Exar chip's
- * delay on firing off the RX FIFO interrupt on slower baud rates.
+ * Adjust the RX FIFO Trigger level if baud is less
+ * than 9600. Not exactly elegant, but this is needed
+ * because of the Exar chip's delay on firing off the
+ * RX FIFO interrupt on slower baud rates.
*/
if (baud < 9600) {
writeb(1, &ch->ch_neo_uart->rfifo);
@@ -845,13 +883,14 @@ static void neo_tasklet(unsigned long data)
spin_unlock_irqrestore(&bd->bd_lock, flags);

/*
- * Do NOT allow the interrupt routine to read the intr registers
- * Until we release this lock.
+ * Do NOT allow the interrupt routine to read the
+ * intr registers. Until we release this lock.
*/
spin_lock_irqsave(&bd->bd_intr_lock, flags);

/*
- * If board is ready, parse deeper to see if there is anything to do.
+ * If board is ready, parse deeper to see if there is
+ * anything to do.
*/
if ((state == BOARD_READY) && (ports > 0)) {
/* Loop on each port */
@@ -938,14 +977,17 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)

/*
* If 0, no interrupts pending.
- * This can happen if the IRQ is shared among a couple Neo/Classic boards.
+ * 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 +1009,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 +1028,9 @@ 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);
@@ -1002,16 +1046,18 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)

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.
+ * 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;
@@ -1026,9 +1072,9 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
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.
+ * It appears the Exar chip, when REALLY bogged down,
+ * will throw these once and awhile. Its harmless,
+ * just ignore it and move on.
*/
continue;
}
@@ -1172,7 +1218,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 +1272,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);
}

@@ -1236,17 +1284,19 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
unsigned char discard;

linestatus = 0;
- memcpy_fromio(&discard, &ch->ch_neo_uart->txrxburst, 1);
+ memcpy_fromio(&discard,
+ &ch->ch_neo_uart->txrxburst, 1);
continue;
}

/*
- * 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.
+ * I decided that I wanted to ditch the oldest data
+ * first, I hope thats okay with everyone? Yes? Good.
*/
while (qleft < 1) {
tail = (tail + 1) & RQUEUEMASK;
@@ -1255,7 +1305,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 +1360,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 +1380,14 @@ 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 +1411,14 @@ 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);
@@ -1405,8 +1463,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
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)) {
@@ -1416,8 +1475,9 @@ 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)) {
@@ -1427,7 +1487,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++;
@@ -1471,8 +1532,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
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)) {
@@ -1483,8 +1545,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
}

/*
- * 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)) {
@@ -1494,7 +1557,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 +1611,9 @@ 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 delta's,
+ * which I don't care about.
+ */
msignals &= 0xf0;

if (msignals & UART_MSR_DCD)
@@ -1628,7 +1694,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 +1792,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 +1847,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 nametag (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..db7951f 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -193,12 +193,18 @@ static ssize_t dgnc_ports_msignals_show(struct device *p,
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);
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 48e4b90..d07e168 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -443,15 +443,16 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
brd->PrintDriver.termios = NULL;
}

-/*=======================================================================
+/*==================================================================
*
* 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 +490,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;
@@ -936,7 +938,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_tun.un_tty->ldisc->ops->write_wakeup(ch->ch_tun.un_tty);
+ ch->ch_tun.un_tty->ldisc->ops->write_wakeup
+ (ch->ch_tun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -956,7 +959,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
* the queue and UART is empty, keep RTS low.
*/
if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
- ch->ch_mostat &= ~(UART_MCR_RTS);
+ ch->ch_mostat &=
+ ~(UART_MCR_RTS);
ch->ch_bd->bd_ops->assert_modem_signals(ch);
}

@@ -966,7 +970,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
*/
if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
ch->ch_mostat &= ~(UART_MCR_DTR);
- ch->ch_bd->bd_ops->assert_modem_signals(ch);
+ ch->ch_bd->bd_ops->
+ assert_modem_signals(ch);
}
}
}
@@ -978,7 +983,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_pun.un_tty->ldisc->ops->write_wakeup(ch->ch_pun.un_tty);
+ ch->ch_pun.un_tty->ldisc->ops->write_wakeup
+ (ch->ch_pun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -2520,12 +2526,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,16 +2723,18 @@ 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);
- wake_up_interruptible(&ch->ch_tun.un_flags_wait);
+ ~(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);
- wake_up_interruptible(&ch->ch_pun.un_flags_wait);
+ ~(UN_LOW | UN_EMPTY);
+ wake_up_interruptible
+ (&ch->ch_pun.un_flags_wait);
}
}
}
diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index cf9dcae..e202aac 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
@@ -105,7 +105,7 @@ 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 */
{
@@ -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

2015-12-12 12:01:58

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH 2/3] staging: dgnc: Patch includes the checkpatch fixes

Patch contains the CamelCase fixes & Macro fixes that
checkpatch prompted for, as asked by the TODO.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/dgnc_driver.c | 56 ++++-----
drivers/staging/dgnc/dgnc_driver.h | 25 ++--
drivers/staging/dgnc/dgnc_mgmt.c | 28 ++---
drivers/staging/dgnc/dgnc_neo.c | 226 +++++++++++++++++--------------------
drivers/staging/dgnc/dgnc_sysfs.c | 134 +++++++++++++++++-----
drivers/staging/dgnc/dgnc_tty.c | 197 ++++++++++++++++----------------
drivers/staging/dgnc/digi.h | 20 ++--
7 files changed, 367 insertions(+), 319 deletions(-)

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 e4be81b..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 */
@@ -202,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
@@ -399,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 2b94b75..fead81e 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -77,8 +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
@@ -111,7 +111,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch)
efr &= ~UART_17158_EFR_IXON;

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

@@ -120,7 +120,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

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

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

@@ -157,7 +157,7 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch)
writeb(efr, &ch->ch_neo_uart->efr);

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

writeb(32, &ch->ch_neo_uart->rfifo);
@@ -189,7 +189,7 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch)
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXON);

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

@@ -197,7 +197,7 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch)
writeb(efr, &ch->ch_neo_uart->efr);

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

writeb(32, &ch->ch_neo_uart->rfifo);
@@ -229,7 +229,7 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch)
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXOFF);

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

@@ -238,7 +238,7 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

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

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

@@ -281,7 +281,7 @@ static inline void neo_set_no_input_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

ch->ch_r_watermark = 0;

@@ -312,7 +312,7 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch)
efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXON);

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

@@ -321,7 +321,7 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

ch->ch_r_watermark = 0;

@@ -341,7 +341,7 @@ 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)
+ ch->ch_c_cflag & CRTSCTS)
return;

/* Tell UART what start/stop chars it should be looking for */
@@ -372,7 +372,7 @@ static inline void neo_clear_break(struct channel_t *ch, int force)
/* Turn break off, and unset some variables */
if (ch->ch_flags & CH_BREAK_SENDING) {
if (time_after_eq(jiffies, ch->ch_stop_sending_break)
- || force) {
+ || force) {
unsigned char temp = readb(&ch->ch_neo_uart->lcr);

writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
@@ -413,8 +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);

@@ -424,9 +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);
@@ -447,8 +445,8 @@ 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 */
@@ -460,8 +458,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
flags);
}
} else if (cause == UART_17158_XOFF_DETECT) {
- if (!(brd->channels[port]->ch_flags &
- CH_STOP)) {
+ if (!(brd->channels[port]->ch_flags & CH_STOP)) {
spin_lock_irqsave(&ch->ch_lock,
flags);
ch->ch_flags |= CH_STOP;
@@ -473,9 +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++;
@@ -567,11 +564,10 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port)

if (linestatus & UART_LSR_OE) {
/*
- * 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.
+ * 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.
+ * We should eventually have an orun stat in our driver.
*/
ch->ch_err_overrun++;
}
@@ -692,7 +688,7 @@ static void neo_param(struct tty_struct *tty)
};

/* Only use the TXPrint baud rate if the
- * terminal unit is NOT open.
+ * terminal unit is NOT open
*/
if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
(un->un_type == DGNC_PRINT))
@@ -708,8 +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;
@@ -793,9 +789,8 @@ static void neo_param(struct tty_struct *tty)
ier &= ~(UART_IER_RDI | UART_IER_RLSI);

/*
- * Have the UART interrupt on modem signal changes
- * ONLY when we are in hardware flow control mode,
- * or CLOCAL/FORCEDCD is not set.
+ * Have the UART interrupt on modem signal changes ONLY when
+ * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
*/
if ((ch->ch_digi.digi_flags & CTSPACE) ||
(ch->ch_digi.digi_flags & RTSPACE) ||
@@ -818,7 +813,7 @@ static void neo_param(struct tty_struct *tty)
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.
+ * should disable flow control
*/
if ((ch->ch_startc == _POSIX_VDISABLE) ||
(ch->ch_stopc == _POSIX_VDISABLE))
@@ -832,8 +827,8 @@ 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 start/stop is set to disable, then we
+ * should disable flow control
*/
if ((ch->ch_startc == _POSIX_VDISABLE) ||
(ch->ch_stopc == _POSIX_VDISABLE))
@@ -845,10 +840,9 @@ static void neo_param(struct tty_struct *tty)
}

/*
- * Adjust the RX FIFO Trigger level if baud is less
- * than 9600. Not exactly elegant, but this is needed
- * because of the Exar chip's delay on firing off the
- * RX FIFO interrupt on slower baud rates.
+ * Adjust the RX FIFO Trigger level if baud is less than 9600.
+ * Not exactly elegant, but this is needed because of the Exar chip's
+ * delay on firing off the RX FIFO interrupt on slower baud rates.
*/
if (baud < 9600) {
writeb(1, &ch->ch_neo_uart->rfifo);
@@ -883,14 +877,13 @@ static void neo_tasklet(unsigned long data)
spin_unlock_irqrestore(&bd->bd_lock, flags);

/*
- * Do NOT allow the interrupt routine to read the
- * intr registers. Until we release this lock.
+ * Do NOT allow the interrupt routine to read the intr registers
+ * Until we release this lock.
*/
spin_lock_irqsave(&bd->bd_intr_lock, flags);

/*
- * If board is ready, parse deeper to see if there is
- * anything to do.
+ * If board is ready, parse deeper to see if there is anything to do.
*/
if ((state == BOARD_READY) && (ports > 0)) {
/* Loop on each port */
@@ -975,19 +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;

@@ -1028,9 +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);
@@ -1045,20 +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;

@@ -1070,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;
}
}
@@ -1154,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);

/*
@@ -1273,7 +1260,7 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
*/
if (linestatus & (UART_LSR_THRE | UART_17158_TX_AND_FIFO_CLR)) {
linestatus &= ~(UART_LSR_THRE |
- UART_17158_TX_AND_FIFO_CLR);
+ UART_17158_TX_AND_FIFO_CLR);
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
}

@@ -1284,19 +1271,18 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
unsigned char discard;

linestatus = 0;
- memcpy_fromio(&discard,
- &ch->ch_neo_uart->txrxburst, 1);
+ memcpy_fromio(&discard, &ch->ch_neo_uart->txrxburst, 1);
continue;
}

/*
* 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.
+ * 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.
+ * I decided that I wanted to ditch the oldest data first,
+ * I hope thats okay with everyone? Yes? Good.
*/
while (qleft < 1) {
tail = (tail + 1) & RQUEUEMASK;
@@ -1361,7 +1347,7 @@ 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));
+ ((un->un_flags & UN_EMPTY) == 0));

/* If ret is non-zero, user ctrl-c'ed us */
return rc;
@@ -1385,9 +1371,7 @@ static void neo_flush_uart_write(struct channel_t *ch)
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);
@@ -1416,9 +1400,7 @@ static void neo_flush_uart_read(struct channel_t *ch)
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);
@@ -1462,11 +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);
@@ -1474,11 +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);
@@ -1531,11 +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);
@@ -1544,11 +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);
@@ -1558,7 +1540,7 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
}

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

/* Add and flip queue if needed */
tail = (tail + s) & WQUEUEMASK;
@@ -1611,9 +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)
@@ -1793,7 +1773,7 @@ static void neo_send_immediate_char(struct channel_t *ch, unsigned char c)
}

static unsigned int neo_read_eeprom(unsigned char __iomem *base,
- unsigned int address)
+ unsigned int address)
{
unsigned int enable;
unsigned int bits;
@@ -1853,7 +1833,7 @@ static void neo_vpd(struct dgnc_board *brd)

if (((brd->vpd[0x08] != 0x82) /* long resource name tag */
&& (brd->vpd[0x10] != 0x82))
- /* long resource nametag (PCI-66 files)*/
+ /* 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_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c
index db7951f..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,7 +202,14 @@ 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) {
@@ -194,17 +217,17 @@ static ssize_t dgnc_ports_msignals_show(struct device *p,
"%d %s %s %s %s %s %s\n",
bd->channels[i]->ch_portnum,
(bd->channels[i]->ch_mostat & UART_MCR_RTS)
- ? "RTS" : "",
+ ? "RTS" : "",
(bd->channels[i]->ch_mistat & UART_MSR_CTS)
- ? "CTS" : "",
+ ? "CTS" : "",
(bd->channels[i]->ch_mostat & UART_MCR_DTR)
- ? "DTR" : "",
+ ? "DTR" : "",
(bd->channels[i]->ch_mistat & UART_MSR_DSR)
- ? "DSR" : "",
+ ? "DSR" : "",
(bd->channels[i]->ch_mistat & UART_MSR_DCD)
- ? "DCD" : "",
+ ? "DCD" : "",
(bd->channels[i]->ch_mistat & UART_MSR_RI)
- ? "RI" : "");
+ ? "RI" : "");
} else {
count += snprintf(buf + count, PAGE_SIZE - count,
"%d\n", bd->channels[i]->ch_portnum);
@@ -221,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",
@@ -239,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",
@@ -257,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",
@@ -275,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",
@@ -294,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",
@@ -312,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",
@@ -330,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 d07e168..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,43 +408,43 @@ 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;
}

-/*==================================================================
+/*=======================================================================
*
* dgnc_wmove - Write data to transmit queue.
*
@@ -451,7 +452,7 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
* 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)
{
@@ -490,13 +491,13 @@ 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)
{
@@ -938,8 +939,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_tun.un_tty->ldisc->ops->write_wakeup
- (ch->ch_tun.un_tty);
+ ch->ch_tun.un_tty->ldisc->ops->write_wakeup(ch->ch_tun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -959,8 +959,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
* the queue and UART is empty, keep RTS low.
*/
if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
- ch->ch_mostat &=
- ~(UART_MCR_RTS);
+ ch->ch_mostat &= ~(UART_MCR_RTS);
ch->ch_bd->bd_ops->assert_modem_signals(ch);
}

@@ -970,8 +969,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
*/
if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
ch->ch_mostat &= ~(UART_MCR_DTR);
- ch->ch_bd->bd_ops->
- assert_modem_signals(ch);
+ ch->ch_bd->bd_ops->assert_modem_signals(ch);
}
}
}
@@ -983,8 +981,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_pun.un_tty->ldisc->ops->write_wakeup
- (ch->ch_pun.un_tty);
+ ch->ch_pun.un_tty->ldisc->ops->write_wakeup(ch->ch_pun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -1035,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;

@@ -1625,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;
@@ -1704,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;
@@ -2726,15 +2723,13 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
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);
+ 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);
- wake_up_interruptible
- (&ch->ch_pun.un_flags_wait);
+ wake_up_interruptible(&ch->ch_pun.un_flags_wait);
}
}
}
@@ -2965,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 e202aac..701312f 100644
--- a/drivers/staging/dgnc/digi.h
+++ b/drivers/staging/dgnc/digi.h
@@ -40,10 +40,10 @@
#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_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
@@ -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 */
@@ -109,8 +109,8 @@ struct digi_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;
--
2.5.0

2015-12-12 12:05:17

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH 3/3] staging: dgnc: Patch includes the checkpatch fixes

Patch updates the TODO file.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/TODO | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index 0e0825b..0bdfd26 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,4 +1,3 @@
-* checkpatch fixes
* remove unnecessary comments
* remove unnecessary error messages. Example kzalloc() has its
own error message. Adding an extra one is useless.
--
2.5.0

2015-12-12 12:10:35

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes

Sorry about Patch 1/3 having the header information. The rest should be fine.

I broke up the patches as you requested.

I can also confirm that git am gives me an error if the patch to be applied
does not contain the header information. Specifically, "Patch format detection failed.".
Yes, this is only after I email myself the patch, reset to the cloned git directory,
and then apply the patch. "git apply --check" returns no error in this scenario.

Thanks

2015-12-12 08:57:57

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes

On Fri, Dec 11, 2015 at 09:24:16PM -0500, Sanidhya Solanki wrote:
> On Fri, 11 Dec 2015 16:02:33 +0300
> Dan Carpenter <[email protected]> wrote:
>
> > On Fri, Dec 11, 2015 at 03:21:49AM -0500, Sanidhya Solanki wrote:
> > > >From 1dbe78ce98037da5467d817a9db838d678b338ae Mon Sep 17 00:00:00 2001
> > > From: Sanidhya Solanki <[email protected]>
> > > Date: Fri, 11 Dec 2015 03:08:53 -0500
> > > Subject: [PATCH] staging: dgnc: Patch includes the checkpatch fixes
> >
> >
> > Don't include this stuff.
> Whenever I remove that part, the "git am" command gives me an error that
> it cannot detect patch format and the patch application fails.
>

You first have to email the patch to yourself for git am to work.

Also you need to break the patch up into a patch series that fixes one
type of issue at a time.

regards,
dan carpenter

2015-12-12 10:08:33

by Sudip Mukherjee

[permalink] [raw]
Subject: Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes

On Sat, Dec 12, 2015 at 11:57:45AM +0300, Dan Carpenter wrote:
> On Fri, Dec 11, 2015 at 09:24:16PM -0500, Sanidhya Solanki wrote:
> > On Fri, 11 Dec 2015 16:02:33 +0300
> > Dan Carpenter <[email protected]> wrote:
> >
> > > On Fri, Dec 11, 2015 at 03:21:49AM -0500, Sanidhya Solanki wrote:
> > > > >From 1dbe78ce98037da5467d817a9db838d678b338ae Mon Sep 17 00:00:00 2001
> > > > From: Sanidhya Solanki <[email protected]>
> > > > Date: Fri, 11 Dec 2015 03:08:53 -0500
> > > > Subject: [PATCH] staging: dgnc: Patch includes the checkpatch fixes
> > >
> > >
> > > Don't include this stuff.
> > Whenever I remove that part, the "git am" command gives me an error that
> > it cannot detect patch format and the patch application fails.
> >
>
> You first have to email the patch to yourself for git am to work.

You are not sending using git send-email. That header will be used by
git send-email. Try using that.
If you still want to use claws then remove these header, mail to
yourself and try git am.

regards
sudip

2015-12-12 10:26:54

by Sudip Mukherjee

[permalink] [raw]
Subject: Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes

On Sat, Dec 12, 2015 at 01:12:21AM -0500, Sanidhya Solanki wrote:
> Thank you everyone for your concern regarding my email client.
>
> Unfortunately, there is a bug in "git send-email" that leads to the gmail
> SMTP server rejecting certain patches sent by the git command.

Is it? I am using git send-email from my beginning, never faced any
problem in sending patch through gmail smtp server. Can you please send
me the patch (offlist), so that i can test with my setup.

regards
sudip

2015-12-14 21:38:52

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

On Sat, Dec 12, 2015 at 02:58:50AM -0500, Sanidhya Solanki wrote:
> >From a1635ea5e75cb2f10728ae4ddf3a21567958e98f Mon Sep 17 00:00:00 2001
> From: Sanidhya Solanki <[email protected]>
> Date: Sat, 12 Dec 2015 02:20:03 -0500
> Subject: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch
> fixes
>
> Patch contains the spacing fixes that checkpatch prompted for,
> as asked by the TODO.
>
> Signed-off-by: Sanidhya Solanki <[email protected]>

Please resend all of these patches properly, without the embedded email
headers so that I have a chance to apply them.

thanks,

greg k-h

2015-12-15 04:03:11

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

Patch contains the spacing fixes that checkpatch prompted for,
as asked by the TODO.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/dgnc_cls.c | 4 +-
drivers/staging/dgnc/dgnc_driver.h | 8 --
drivers/staging/dgnc/dgnc_neo.c | 235 ++++++++++++++++++++++++-------------
drivers/staging/dgnc/dgnc_neo.h | 22 ++--
drivers/staging/dgnc/dgnc_pci.h | 1 -
drivers/staging/dgnc/dgnc_sysfs.c | 18 ++-
drivers/staging/dgnc/dgnc_tty.c | 46 +++++---
drivers/staging/dgnc/digi.h | 32 ++---
8 files changed, 223 insertions(+), 143 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.h b/drivers/staging/dgnc/dgnc_driver.h
index ce7cd9b..e4be81b 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -88,7 +88,6 @@
#define _POSIX_VDISABLE '\0'
#endif

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

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

-
/*
* Per-board information
*/
@@ -241,7 +238,6 @@ struct dgnc_board {

};

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

-
/************************************************************************
* Device flag definitions for ch_flags.
************************************************************************/
@@ -300,7 +295,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 +303,6 @@ struct un_t {
#define EQUEUESIZE RQUEUESIZE
#define WQUEUESIZE (WQUEUEMASK + 1)

-
/************************************************************************
* Channel information structure.
************************************************************************/
@@ -397,7 +390,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;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 8106f52..2b94b75 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 */
@@ -352,7 +372,7 @@ static inline void neo_clear_break(struct channel_t *ch, int force)
/* Turn break off, and unset some variables */
if (ch->ch_flags & CH_BREAK_SENDING) {
if (time_after_eq(jiffies, ch->ch_stop_sending_break)
- || force) {
+ || force) {
unsigned char temp = readb(&ch->ch_neo_uart->lcr);

writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
@@ -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,9 @@ 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);
@@ -428,7 +451,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
* 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);
@@ -437,7 +460,8 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
flags);
}
} else if (cause == UART_17158_XOFF_DETECT) {
- if (!(brd->channels[port]->ch_flags & CH_STOP)) {
+ if (!(brd->channels[port]->ch_flags &
+ CH_STOP)) {
spin_lock_irqsave(&ch->ch_lock,
flags);
ch->ch_flags |= CH_STOP;
@@ -449,8 +473,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++;
@@ -542,10 +567,11 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port)

if (linestatus & UART_LSR_OE) {
/*
- * 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...
+ * 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.
*/
ch->ch_err_overrun++;
}
@@ -665,8 +691,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 +708,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;
@@ -763,8 +793,9 @@ static void neo_param(struct tty_struct *tty)
ier &= ~(UART_IER_RDI | UART_IER_RLSI);

/*
- * Have the UART interrupt on modem signal changes ONLY when
- * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
+ * Have the UART interrupt on modem signal changes
+ * ONLY when we are in hardware flow control mode,
+ * or CLOCAL/FORCEDCD is not set.
*/
if ((ch->ch_digi.digi_flags & CTSPACE) ||
(ch->ch_digi.digi_flags & RTSPACE) ||
@@ -786,8 +817,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 +832,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);
@@ -808,9 +845,10 @@ static void neo_param(struct tty_struct *tty)
}

/*
- * Adjust the RX FIFO Trigger level if baud is less than 9600.
- * Not exactly elegant, but this is needed because of the Exar chip's
- * delay on firing off the RX FIFO interrupt on slower baud rates.
+ * Adjust the RX FIFO Trigger level if baud is less
+ * than 9600. Not exactly elegant, but this is needed
+ * because of the Exar chip's delay on firing off the
+ * RX FIFO interrupt on slower baud rates.
*/
if (baud < 9600) {
writeb(1, &ch->ch_neo_uart->rfifo);
@@ -845,13 +883,14 @@ static void neo_tasklet(unsigned long data)
spin_unlock_irqrestore(&bd->bd_lock, flags);

/*
- * Do NOT allow the interrupt routine to read the intr registers
- * Until we release this lock.
+ * Do NOT allow the interrupt routine to read the
+ * intr registers. Until we release this lock.
*/
spin_lock_irqsave(&bd->bd_intr_lock, flags);

/*
- * If board is ready, parse deeper to see if there is anything to do.
+ * If board is ready, parse deeper to see if there is
+ * anything to do.
*/
if ((state == BOARD_READY) && (ports > 0)) {
/* Loop on each port */
@@ -938,14 +977,17 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)

/*
* If 0, no interrupts pending.
- * This can happen if the IRQ is shared among a couple Neo/Classic boards.
+ * 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 +1009,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 +1028,9 @@ 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);
@@ -1002,16 +1046,18 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)

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.
+ * 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;
@@ -1026,9 +1072,9 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
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.
+ * It appears the Exar chip, when REALLY bogged down,
+ * will throw these once and awhile. Its harmless,
+ * just ignore it and move on.
*/
continue;
}
@@ -1172,7 +1218,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 +1272,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);
}

@@ -1236,17 +1284,19 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
unsigned char discard;

linestatus = 0;
- memcpy_fromio(&discard, &ch->ch_neo_uart->txrxburst, 1);
+ memcpy_fromio(&discard,
+ &ch->ch_neo_uart->txrxburst, 1);
continue;
}

/*
- * 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.
+ * I decided that I wanted to ditch the oldest data
+ * first, I hope thats okay with everyone? Yes? Good.
*/
while (qleft < 1) {
tail = (tail + 1) & RQUEUEMASK;
@@ -1255,7 +1305,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 +1360,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 +1380,14 @@ 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 +1411,14 @@ 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);
@@ -1405,8 +1463,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
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)) {
@@ -1416,8 +1475,9 @@ 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)) {
@@ -1427,7 +1487,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++;
@@ -1471,8 +1532,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
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)) {
@@ -1483,8 +1545,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
}

/*
- * 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)) {
@@ -1494,7 +1557,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 +1611,9 @@ 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 delta's,
+ * which I don't care about.
+ */
msignals &= 0xf0;

if (msignals & UART_MSR_DCD)
@@ -1628,7 +1694,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 +1792,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 +1847,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 nametag (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..db7951f 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -193,12 +193,18 @@ static ssize_t dgnc_ports_msignals_show(struct device *p,
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);
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 48e4b90..d07e168 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -443,15 +443,16 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
brd->PrintDriver.termios = NULL;
}

-/*=======================================================================
+/*==================================================================
*
* 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 +490,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;
@@ -936,7 +938,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_tun.un_tty->ldisc->ops->write_wakeup(ch->ch_tun.un_tty);
+ ch->ch_tun.un_tty->ldisc->ops->write_wakeup
+ (ch->ch_tun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -956,7 +959,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
* the queue and UART is empty, keep RTS low.
*/
if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
- ch->ch_mostat &= ~(UART_MCR_RTS);
+ ch->ch_mostat &=
+ ~(UART_MCR_RTS);
ch->ch_bd->bd_ops->assert_modem_signals(ch);
}

@@ -966,7 +970,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
*/
if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
ch->ch_mostat &= ~(UART_MCR_DTR);
- ch->ch_bd->bd_ops->assert_modem_signals(ch);
+ ch->ch_bd->bd_ops->
+ assert_modem_signals(ch);
}
}
}
@@ -978,7 +983,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_pun.un_tty->ldisc->ops->write_wakeup(ch->ch_pun.un_tty);
+ ch->ch_pun.un_tty->ldisc->ops->write_wakeup
+ (ch->ch_pun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -2520,12 +2526,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,16 +2723,18 @@ 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);
- wake_up_interruptible(&ch->ch_tun.un_flags_wait);
+ ~(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);
- wake_up_interruptible(&ch->ch_pun.un_flags_wait);
+ ~(UN_LOW | UN_EMPTY);
+ wake_up_interruptible
+ (&ch->ch_pun.un_flags_wait);
}
}
}
diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index cf9dcae..e202aac 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
@@ -105,7 +105,7 @@ 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 */
{
@@ -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

2015-12-15 04:04:02

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

Patch contains the CamelCase fixes & Macro fixes that
checkpatch prompted for, as asked by the TODO.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/dgnc_driver.c | 56 ++++-----
drivers/staging/dgnc/dgnc_driver.h | 25 ++--
drivers/staging/dgnc/dgnc_mgmt.c | 28 ++---
drivers/staging/dgnc/dgnc_neo.c | 226 +++++++++++++++++--------------------
drivers/staging/dgnc/dgnc_sysfs.c | 134 +++++++++++++++++-----
drivers/staging/dgnc/dgnc_tty.c | 197 ++++++++++++++++----------------
drivers/staging/dgnc/digi.h | 20 ++--
7 files changed, 367 insertions(+), 319 deletions(-)

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 e4be81b..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 */
@@ -202,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
@@ -399,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 2b94b75..fead81e 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -77,8 +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
@@ -111,7 +111,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch)
efr &= ~UART_17158_EFR_IXON;

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

@@ -120,7 +120,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

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

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

@@ -157,7 +157,7 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch)
writeb(efr, &ch->ch_neo_uart->efr);

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

writeb(32, &ch->ch_neo_uart->rfifo);
@@ -189,7 +189,7 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch)
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXON);

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

@@ -197,7 +197,7 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch)
writeb(efr, &ch->ch_neo_uart->efr);

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

writeb(32, &ch->ch_neo_uart->rfifo);
@@ -229,7 +229,7 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch)
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXOFF);

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

@@ -238,7 +238,7 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

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

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

@@ -281,7 +281,7 @@ static inline void neo_set_no_input_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

ch->ch_r_watermark = 0;

@@ -312,7 +312,7 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch)
efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXON);

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

@@ -321,7 +321,7 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

ch->ch_r_watermark = 0;

@@ -341,7 +341,7 @@ 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)
+ ch->ch_c_cflag & CRTSCTS)
return;

/* Tell UART what start/stop chars it should be looking for */
@@ -372,7 +372,7 @@ static inline void neo_clear_break(struct channel_t *ch, int force)
/* Turn break off, and unset some variables */
if (ch->ch_flags & CH_BREAK_SENDING) {
if (time_after_eq(jiffies, ch->ch_stop_sending_break)
- || force) {
+ || force) {
unsigned char temp = readb(&ch->ch_neo_uart->lcr);

writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
@@ -413,8 +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);

@@ -424,9 +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);
@@ -447,8 +445,8 @@ 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 */
@@ -460,8 +458,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
flags);
}
} else if (cause == UART_17158_XOFF_DETECT) {
- if (!(brd->channels[port]->ch_flags &
- CH_STOP)) {
+ if (!(brd->channels[port]->ch_flags & CH_STOP)) {
spin_lock_irqsave(&ch->ch_lock,
flags);
ch->ch_flags |= CH_STOP;
@@ -473,9 +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++;
@@ -567,11 +564,10 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port)

if (linestatus & UART_LSR_OE) {
/*
- * 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.
+ * 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.
+ * We should eventually have an orun stat in our driver.
*/
ch->ch_err_overrun++;
}
@@ -692,7 +688,7 @@ static void neo_param(struct tty_struct *tty)
};

/* Only use the TXPrint baud rate if the
- * terminal unit is NOT open.
+ * terminal unit is NOT open
*/
if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
(un->un_type == DGNC_PRINT))
@@ -708,8 +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;
@@ -793,9 +789,8 @@ static void neo_param(struct tty_struct *tty)
ier &= ~(UART_IER_RDI | UART_IER_RLSI);

/*
- * Have the UART interrupt on modem signal changes
- * ONLY when we are in hardware flow control mode,
- * or CLOCAL/FORCEDCD is not set.
+ * Have the UART interrupt on modem signal changes ONLY when
+ * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
*/
if ((ch->ch_digi.digi_flags & CTSPACE) ||
(ch->ch_digi.digi_flags & RTSPACE) ||
@@ -818,7 +813,7 @@ static void neo_param(struct tty_struct *tty)
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.
+ * should disable flow control
*/
if ((ch->ch_startc == _POSIX_VDISABLE) ||
(ch->ch_stopc == _POSIX_VDISABLE))
@@ -832,8 +827,8 @@ 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 start/stop is set to disable, then we
+ * should disable flow control
*/
if ((ch->ch_startc == _POSIX_VDISABLE) ||
(ch->ch_stopc == _POSIX_VDISABLE))
@@ -845,10 +840,9 @@ static void neo_param(struct tty_struct *tty)
}

/*
- * Adjust the RX FIFO Trigger level if baud is less
- * than 9600. Not exactly elegant, but this is needed
- * because of the Exar chip's delay on firing off the
- * RX FIFO interrupt on slower baud rates.
+ * Adjust the RX FIFO Trigger level if baud is less than 9600.
+ * Not exactly elegant, but this is needed because of the Exar chip's
+ * delay on firing off the RX FIFO interrupt on slower baud rates.
*/
if (baud < 9600) {
writeb(1, &ch->ch_neo_uart->rfifo);
@@ -883,14 +877,13 @@ static void neo_tasklet(unsigned long data)
spin_unlock_irqrestore(&bd->bd_lock, flags);

/*
- * Do NOT allow the interrupt routine to read the
- * intr registers. Until we release this lock.
+ * Do NOT allow the interrupt routine to read the intr registers
+ * Until we release this lock.
*/
spin_lock_irqsave(&bd->bd_intr_lock, flags);

/*
- * If board is ready, parse deeper to see if there is
- * anything to do.
+ * If board is ready, parse deeper to see if there is anything to do.
*/
if ((state == BOARD_READY) && (ports > 0)) {
/* Loop on each port */
@@ -975,19 +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;

@@ -1028,9 +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);
@@ -1045,20 +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;

@@ -1070,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;
}
}
@@ -1154,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);

/*
@@ -1273,7 +1260,7 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
*/
if (linestatus & (UART_LSR_THRE | UART_17158_TX_AND_FIFO_CLR)) {
linestatus &= ~(UART_LSR_THRE |
- UART_17158_TX_AND_FIFO_CLR);
+ UART_17158_TX_AND_FIFO_CLR);
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
}

@@ -1284,19 +1271,18 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
unsigned char discard;

linestatus = 0;
- memcpy_fromio(&discard,
- &ch->ch_neo_uart->txrxburst, 1);
+ memcpy_fromio(&discard, &ch->ch_neo_uart->txrxburst, 1);
continue;
}

/*
* 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.
+ * 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.
+ * I decided that I wanted to ditch the oldest data first,
+ * I hope thats okay with everyone? Yes? Good.
*/
while (qleft < 1) {
tail = (tail + 1) & RQUEUEMASK;
@@ -1361,7 +1347,7 @@ 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));
+ ((un->un_flags & UN_EMPTY) == 0));

/* If ret is non-zero, user ctrl-c'ed us */
return rc;
@@ -1385,9 +1371,7 @@ static void neo_flush_uart_write(struct channel_t *ch)
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);
@@ -1416,9 +1400,7 @@ static void neo_flush_uart_read(struct channel_t *ch)
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);
@@ -1462,11 +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);
@@ -1474,11 +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);
@@ -1531,11 +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);
@@ -1544,11 +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);
@@ -1558,7 +1540,7 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
}

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

/* Add and flip queue if needed */
tail = (tail + s) & WQUEUEMASK;
@@ -1611,9 +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)
@@ -1793,7 +1773,7 @@ static void neo_send_immediate_char(struct channel_t *ch, unsigned char c)
}

static unsigned int neo_read_eeprom(unsigned char __iomem *base,
- unsigned int address)
+ unsigned int address)
{
unsigned int enable;
unsigned int bits;
@@ -1853,7 +1833,7 @@ static void neo_vpd(struct dgnc_board *brd)

if (((brd->vpd[0x08] != 0x82) /* long resource name tag */
&& (brd->vpd[0x10] != 0x82))
- /* long resource nametag (PCI-66 files)*/
+ /* 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_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c
index db7951f..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,7 +202,14 @@ 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) {
@@ -194,17 +217,17 @@ static ssize_t dgnc_ports_msignals_show(struct device *p,
"%d %s %s %s %s %s %s\n",
bd->channels[i]->ch_portnum,
(bd->channels[i]->ch_mostat & UART_MCR_RTS)
- ? "RTS" : "",
+ ? "RTS" : "",
(bd->channels[i]->ch_mistat & UART_MSR_CTS)
- ? "CTS" : "",
+ ? "CTS" : "",
(bd->channels[i]->ch_mostat & UART_MCR_DTR)
- ? "DTR" : "",
+ ? "DTR" : "",
(bd->channels[i]->ch_mistat & UART_MSR_DSR)
- ? "DSR" : "",
+ ? "DSR" : "",
(bd->channels[i]->ch_mistat & UART_MSR_DCD)
- ? "DCD" : "",
+ ? "DCD" : "",
(bd->channels[i]->ch_mistat & UART_MSR_RI)
- ? "RI" : "");
+ ? "RI" : "");
} else {
count += snprintf(buf + count, PAGE_SIZE - count,
"%d\n", bd->channels[i]->ch_portnum);
@@ -221,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",
@@ -239,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",
@@ -257,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",
@@ -275,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",
@@ -294,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",
@@ -312,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",
@@ -330,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 d07e168..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,43 +408,43 @@ 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;
}

-/*==================================================================
+/*=======================================================================
*
* dgnc_wmove - Write data to transmit queue.
*
@@ -451,7 +452,7 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
* 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)
{
@@ -490,13 +491,13 @@ 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)
{
@@ -938,8 +939,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_tun.un_tty->ldisc->ops->write_wakeup
- (ch->ch_tun.un_tty);
+ ch->ch_tun.un_tty->ldisc->ops->write_wakeup(ch->ch_tun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -959,8 +959,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
* the queue and UART is empty, keep RTS low.
*/
if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
- ch->ch_mostat &=
- ~(UART_MCR_RTS);
+ ch->ch_mostat &= ~(UART_MCR_RTS);
ch->ch_bd->bd_ops->assert_modem_signals(ch);
}

@@ -970,8 +969,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
*/
if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
ch->ch_mostat &= ~(UART_MCR_DTR);
- ch->ch_bd->bd_ops->
- assert_modem_signals(ch);
+ ch->ch_bd->bd_ops->assert_modem_signals(ch);
}
}
}
@@ -983,8 +981,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_pun.un_tty->ldisc->ops->write_wakeup
- (ch->ch_pun.un_tty);
+ ch->ch_pun.un_tty->ldisc->ops->write_wakeup(ch->ch_pun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -1035,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;

@@ -1625,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;
@@ -1704,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;
@@ -2726,15 +2723,13 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
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);
+ 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);
- wake_up_interruptible
- (&ch->ch_pun.un_flags_wait);
+ wake_up_interruptible(&ch->ch_pun.un_flags_wait);
}
}
}
@@ -2965,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 e202aac..701312f 100644
--- a/drivers/staging/dgnc/digi.h
+++ b/drivers/staging/dgnc/digi.h
@@ -40,10 +40,10 @@
#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_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
@@ -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 */
@@ -109,8 +109,8 @@ struct digi_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;
--
2.5.0

2015-12-15 04:04:48

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

Patch updates the TODO file.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/TODO | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index 0e0825b..0bdfd26 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,4 +1,3 @@
-* checkpatch fixes
* remove unnecessary comments
* remove unnecessary error messages. Example kzalloc() has its
own error message. Adding an extra one is useless.
--
2.5.0

2015-12-15 04:46:42

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

Can you tell me what was incorrect about them?
I thought you requested the dgnc patches to be resent without the
headers.
There are 3 of them because Dan Carpenter asked my patch to be broken
up so each one does only one thing. I also resent you the skein
subsystem patches, as I did not hear anything from you for almost a
week.
Thanks

2015-12-15 05:24:08

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH FIXED 1/3] staging: dgnc: Patch includes the checkpatch fixes

Patch contains the spacing fixes that checkpatch prompted for,
as asked by the TODO.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/dgnc_cls.c | 4 +-
drivers/staging/dgnc/dgnc_driver.h | 8 --
drivers/staging/dgnc/dgnc_neo.c | 235 ++++++++++++++++++++++++-------------
drivers/staging/dgnc/dgnc_neo.h | 22 ++--
drivers/staging/dgnc/dgnc_pci.h | 1 -
drivers/staging/dgnc/dgnc_sysfs.c | 18 ++-
drivers/staging/dgnc/dgnc_tty.c | 46 +++++---
drivers/staging/dgnc/digi.h | 32 ++---
8 files changed, 223 insertions(+), 143 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.h b/drivers/staging/dgnc/dgnc_driver.h
index ce7cd9b..e4be81b 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -88,7 +88,6 @@
#define _POSIX_VDISABLE '\0'
#endif

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

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

-
/*
* Per-board information
*/
@@ -241,7 +238,6 @@ struct dgnc_board {

};

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

-
/************************************************************************
* Device flag definitions for ch_flags.
************************************************************************/
@@ -300,7 +295,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 +303,6 @@ struct un_t {
#define EQUEUESIZE RQUEUESIZE
#define WQUEUESIZE (WQUEUEMASK + 1)

-
/************************************************************************
* Channel information structure.
************************************************************************/
@@ -397,7 +390,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;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 8106f52..2b94b75 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 */
@@ -352,7 +372,7 @@ static inline void neo_clear_break(struct channel_t *ch, int force)
/* Turn break off, and unset some variables */
if (ch->ch_flags & CH_BREAK_SENDING) {
if (time_after_eq(jiffies, ch->ch_stop_sending_break)
- || force) {
+ || force) {
unsigned char temp = readb(&ch->ch_neo_uart->lcr);

writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
@@ -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,9 @@ 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);
@@ -428,7 +451,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
* 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);
@@ -437,7 +460,8 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
flags);
}
} else if (cause == UART_17158_XOFF_DETECT) {
- if (!(brd->channels[port]->ch_flags & CH_STOP)) {
+ if (!(brd->channels[port]->ch_flags &
+ CH_STOP)) {
spin_lock_irqsave(&ch->ch_lock,
flags);
ch->ch_flags |= CH_STOP;
@@ -449,8 +473,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++;
@@ -542,10 +567,11 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port)

if (linestatus & UART_LSR_OE) {
/*
- * 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...
+ * 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.
*/
ch->ch_err_overrun++;
}
@@ -665,8 +691,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 +708,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;
@@ -763,8 +793,9 @@ static void neo_param(struct tty_struct *tty)
ier &= ~(UART_IER_RDI | UART_IER_RLSI);

/*
- * Have the UART interrupt on modem signal changes ONLY when
- * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
+ * Have the UART interrupt on modem signal changes
+ * ONLY when we are in hardware flow control mode,
+ * or CLOCAL/FORCEDCD is not set.
*/
if ((ch->ch_digi.digi_flags & CTSPACE) ||
(ch->ch_digi.digi_flags & RTSPACE) ||
@@ -786,8 +817,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 +832,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);
@@ -808,9 +845,10 @@ static void neo_param(struct tty_struct *tty)
}

/*
- * Adjust the RX FIFO Trigger level if baud is less than 9600.
- * Not exactly elegant, but this is needed because of the Exar chip's
- * delay on firing off the RX FIFO interrupt on slower baud rates.
+ * Adjust the RX FIFO Trigger level if baud is less
+ * than 9600. Not exactly elegant, but this is needed
+ * because of the Exar chip's delay on firing off the
+ * RX FIFO interrupt on slower baud rates.
*/
if (baud < 9600) {
writeb(1, &ch->ch_neo_uart->rfifo);
@@ -845,13 +883,14 @@ static void neo_tasklet(unsigned long data)
spin_unlock_irqrestore(&bd->bd_lock, flags);

/*
- * Do NOT allow the interrupt routine to read the intr registers
- * Until we release this lock.
+ * Do NOT allow the interrupt routine to read the
+ * intr registers. Until we release this lock.
*/
spin_lock_irqsave(&bd->bd_intr_lock, flags);

/*
- * If board is ready, parse deeper to see if there is anything to do.
+ * If board is ready, parse deeper to see if there is
+ * anything to do.
*/
if ((state == BOARD_READY) && (ports > 0)) {
/* Loop on each port */
@@ -938,14 +977,17 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)

/*
* If 0, no interrupts pending.
- * This can happen if the IRQ is shared among a couple Neo/Classic boards.
+ * 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 +1009,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 +1028,9 @@ 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);
@@ -1002,16 +1046,18 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)

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.
+ * 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;
@@ -1026,9 +1072,9 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
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.
+ * It appears the Exar chip, when REALLY bogged down,
+ * will throw these once and awhile. Its harmless,
+ * just ignore it and move on.
*/
continue;
}
@@ -1172,7 +1218,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 +1272,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);
}

@@ -1236,17 +1284,19 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
unsigned char discard;

linestatus = 0;
- memcpy_fromio(&discard, &ch->ch_neo_uart->txrxburst, 1);
+ memcpy_fromio(&discard,
+ &ch->ch_neo_uart->txrxburst, 1);
continue;
}

/*
- * 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.
+ * I decided that I wanted to ditch the oldest data
+ * first, I hope thats okay with everyone? Yes? Good.
*/
while (qleft < 1) {
tail = (tail + 1) & RQUEUEMASK;
@@ -1255,7 +1305,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 +1360,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 +1380,14 @@ 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 +1411,14 @@ 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);
@@ -1405,8 +1463,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
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)) {
@@ -1416,8 +1475,9 @@ 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)) {
@@ -1427,7 +1487,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++;
@@ -1471,8 +1532,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
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)) {
@@ -1483,8 +1545,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
}

/*
- * 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)) {
@@ -1494,7 +1557,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 +1611,9 @@ 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 delta's,
+ * which I don't care about.
+ */
msignals &= 0xf0;

if (msignals & UART_MSR_DCD)
@@ -1628,7 +1694,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 +1792,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 +1847,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 nametag (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..db7951f 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -193,12 +193,18 @@ static ssize_t dgnc_ports_msignals_show(struct device *p,
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);
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 48e4b90..d07e168 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -443,15 +443,16 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
brd->PrintDriver.termios = NULL;
}

-/*=======================================================================
+/*==================================================================
*
* 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 +490,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;
@@ -936,7 +938,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_tun.un_tty->ldisc->ops->write_wakeup(ch->ch_tun.un_tty);
+ ch->ch_tun.un_tty->ldisc->ops->write_wakeup
+ (ch->ch_tun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -956,7 +959,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
* the queue and UART is empty, keep RTS low.
*/
if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
- ch->ch_mostat &= ~(UART_MCR_RTS);
+ ch->ch_mostat &=
+ ~(UART_MCR_RTS);
ch->ch_bd->bd_ops->assert_modem_signals(ch);
}

@@ -966,7 +970,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
*/
if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
ch->ch_mostat &= ~(UART_MCR_DTR);
- ch->ch_bd->bd_ops->assert_modem_signals(ch);
+ ch->ch_bd->bd_ops->
+ assert_modem_signals(ch);
}
}
}
@@ -978,7 +983,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_pun.un_tty->ldisc->ops->write_wakeup(ch->ch_pun.un_tty);
+ ch->ch_pun.un_tty->ldisc->ops->write_wakeup
+ (ch->ch_pun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -2520,12 +2526,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,16 +2723,18 @@ 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);
- wake_up_interruptible(&ch->ch_tun.un_flags_wait);
+ ~(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);
- wake_up_interruptible(&ch->ch_pun.un_flags_wait);
+ ~(UN_LOW | UN_EMPTY);
+ wake_up_interruptible
+ (&ch->ch_pun.un_flags_wait);
}
}
}
diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index cf9dcae..e202aac 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
@@ -105,7 +105,7 @@ 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 */
{
@@ -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

2015-12-15 05:25:21

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH FIXED 2/3] staging: dgnc: Patch for CamelCase fixes

Patch contains the CamelCase fixes & Macro fixes that
checkpatch prompted for, as asked by the TODO.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/dgnc_driver.c | 56 ++++-----
drivers/staging/dgnc/dgnc_driver.h | 25 ++--
drivers/staging/dgnc/dgnc_mgmt.c | 28 ++---
drivers/staging/dgnc/dgnc_neo.c | 226 +++++++++++++++++--------------------
drivers/staging/dgnc/dgnc_sysfs.c | 134 +++++++++++++++++-----
drivers/staging/dgnc/dgnc_tty.c | 197 ++++++++++++++++----------------
drivers/staging/dgnc/digi.h | 20 ++--
7 files changed, 367 insertions(+), 319 deletions(-)

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 e4be81b..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 */
@@ -202,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
@@ -399,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 2b94b75..fead81e 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -77,8 +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
@@ -111,7 +111,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch)
efr &= ~UART_17158_EFR_IXON;

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

@@ -120,7 +120,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

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

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

@@ -157,7 +157,7 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch)
writeb(efr, &ch->ch_neo_uart->efr);

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

writeb(32, &ch->ch_neo_uart->rfifo);
@@ -189,7 +189,7 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch)
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXON);

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

@@ -197,7 +197,7 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch)
writeb(efr, &ch->ch_neo_uart->efr);

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

writeb(32, &ch->ch_neo_uart->rfifo);
@@ -229,7 +229,7 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch)
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXOFF);

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

@@ -238,7 +238,7 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

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

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

@@ -281,7 +281,7 @@ static inline void neo_set_no_input_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

ch->ch_r_watermark = 0;

@@ -312,7 +312,7 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch)
efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXON);

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

@@ -321,7 +321,7 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

ch->ch_r_watermark = 0;

@@ -341,7 +341,7 @@ 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)
+ ch->ch_c_cflag & CRTSCTS)
return;

/* Tell UART what start/stop chars it should be looking for */
@@ -372,7 +372,7 @@ static inline void neo_clear_break(struct channel_t *ch, int force)
/* Turn break off, and unset some variables */
if (ch->ch_flags & CH_BREAK_SENDING) {
if (time_after_eq(jiffies, ch->ch_stop_sending_break)
- || force) {
+ || force) {
unsigned char temp = readb(&ch->ch_neo_uart->lcr);

writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
@@ -413,8 +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);

@@ -424,9 +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);
@@ -447,8 +445,8 @@ 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 */
@@ -460,8 +458,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
flags);
}
} else if (cause == UART_17158_XOFF_DETECT) {
- if (!(brd->channels[port]->ch_flags &
- CH_STOP)) {
+ if (!(brd->channels[port]->ch_flags & CH_STOP)) {
spin_lock_irqsave(&ch->ch_lock,
flags);
ch->ch_flags |= CH_STOP;
@@ -473,9 +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++;
@@ -567,11 +564,10 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port)

if (linestatus & UART_LSR_OE) {
/*
- * 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.
+ * 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.
+ * We should eventually have an orun stat in our driver.
*/
ch->ch_err_overrun++;
}
@@ -692,7 +688,7 @@ static void neo_param(struct tty_struct *tty)
};

/* Only use the TXPrint baud rate if the
- * terminal unit is NOT open.
+ * terminal unit is NOT open
*/
if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
(un->un_type == DGNC_PRINT))
@@ -708,8 +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;
@@ -793,9 +789,8 @@ static void neo_param(struct tty_struct *tty)
ier &= ~(UART_IER_RDI | UART_IER_RLSI);

/*
- * Have the UART interrupt on modem signal changes
- * ONLY when we are in hardware flow control mode,
- * or CLOCAL/FORCEDCD is not set.
+ * Have the UART interrupt on modem signal changes ONLY when
+ * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
*/
if ((ch->ch_digi.digi_flags & CTSPACE) ||
(ch->ch_digi.digi_flags & RTSPACE) ||
@@ -818,7 +813,7 @@ static void neo_param(struct tty_struct *tty)
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.
+ * should disable flow control
*/
if ((ch->ch_startc == _POSIX_VDISABLE) ||
(ch->ch_stopc == _POSIX_VDISABLE))
@@ -832,8 +827,8 @@ 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 start/stop is set to disable, then we
+ * should disable flow control
*/
if ((ch->ch_startc == _POSIX_VDISABLE) ||
(ch->ch_stopc == _POSIX_VDISABLE))
@@ -845,10 +840,9 @@ static void neo_param(struct tty_struct *tty)
}

/*
- * Adjust the RX FIFO Trigger level if baud is less
- * than 9600. Not exactly elegant, but this is needed
- * because of the Exar chip's delay on firing off the
- * RX FIFO interrupt on slower baud rates.
+ * Adjust the RX FIFO Trigger level if baud is less than 9600.
+ * Not exactly elegant, but this is needed because of the Exar chip's
+ * delay on firing off the RX FIFO interrupt on slower baud rates.
*/
if (baud < 9600) {
writeb(1, &ch->ch_neo_uart->rfifo);
@@ -883,14 +877,13 @@ static void neo_tasklet(unsigned long data)
spin_unlock_irqrestore(&bd->bd_lock, flags);

/*
- * Do NOT allow the interrupt routine to read the
- * intr registers. Until we release this lock.
+ * Do NOT allow the interrupt routine to read the intr registers
+ * Until we release this lock.
*/
spin_lock_irqsave(&bd->bd_intr_lock, flags);

/*
- * If board is ready, parse deeper to see if there is
- * anything to do.
+ * If board is ready, parse deeper to see if there is anything to do.
*/
if ((state == BOARD_READY) && (ports > 0)) {
/* Loop on each port */
@@ -975,19 +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;

@@ -1028,9 +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);
@@ -1045,20 +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;

@@ -1070,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;
}
}
@@ -1154,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);

/*
@@ -1273,7 +1260,7 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
*/
if (linestatus & (UART_LSR_THRE | UART_17158_TX_AND_FIFO_CLR)) {
linestatus &= ~(UART_LSR_THRE |
- UART_17158_TX_AND_FIFO_CLR);
+ UART_17158_TX_AND_FIFO_CLR);
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
}

@@ -1284,19 +1271,18 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
unsigned char discard;

linestatus = 0;
- memcpy_fromio(&discard,
- &ch->ch_neo_uart->txrxburst, 1);
+ memcpy_fromio(&discard, &ch->ch_neo_uart->txrxburst, 1);
continue;
}

/*
* 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.
+ * 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.
+ * I decided that I wanted to ditch the oldest data first,
+ * I hope thats okay with everyone? Yes? Good.
*/
while (qleft < 1) {
tail = (tail + 1) & RQUEUEMASK;
@@ -1361,7 +1347,7 @@ 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));
+ ((un->un_flags & UN_EMPTY) == 0));

/* If ret is non-zero, user ctrl-c'ed us */
return rc;
@@ -1385,9 +1371,7 @@ static void neo_flush_uart_write(struct channel_t *ch)
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);
@@ -1416,9 +1400,7 @@ static void neo_flush_uart_read(struct channel_t *ch)
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);
@@ -1462,11 +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);
@@ -1474,11 +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);
@@ -1531,11 +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);
@@ -1544,11 +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);
@@ -1558,7 +1540,7 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
}

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

/* Add and flip queue if needed */
tail = (tail + s) & WQUEUEMASK;
@@ -1611,9 +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)
@@ -1793,7 +1773,7 @@ static void neo_send_immediate_char(struct channel_t *ch, unsigned char c)
}

static unsigned int neo_read_eeprom(unsigned char __iomem *base,
- unsigned int address)
+ unsigned int address)
{
unsigned int enable;
unsigned int bits;
@@ -1853,7 +1833,7 @@ static void neo_vpd(struct dgnc_board *brd)

if (((brd->vpd[0x08] != 0x82) /* long resource name tag */
&& (brd->vpd[0x10] != 0x82))
- /* long resource nametag (PCI-66 files)*/
+ /* 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_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c
index db7951f..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,7 +202,14 @@ 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) {
@@ -194,17 +217,17 @@ static ssize_t dgnc_ports_msignals_show(struct device *p,
"%d %s %s %s %s %s %s\n",
bd->channels[i]->ch_portnum,
(bd->channels[i]->ch_mostat & UART_MCR_RTS)
- ? "RTS" : "",
+ ? "RTS" : "",
(bd->channels[i]->ch_mistat & UART_MSR_CTS)
- ? "CTS" : "",
+ ? "CTS" : "",
(bd->channels[i]->ch_mostat & UART_MCR_DTR)
- ? "DTR" : "",
+ ? "DTR" : "",
(bd->channels[i]->ch_mistat & UART_MSR_DSR)
- ? "DSR" : "",
+ ? "DSR" : "",
(bd->channels[i]->ch_mistat & UART_MSR_DCD)
- ? "DCD" : "",
+ ? "DCD" : "",
(bd->channels[i]->ch_mistat & UART_MSR_RI)
- ? "RI" : "");
+ ? "RI" : "");
} else {
count += snprintf(buf + count, PAGE_SIZE - count,
"%d\n", bd->channels[i]->ch_portnum);
@@ -221,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",
@@ -239,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",
@@ -257,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",
@@ -275,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",
@@ -294,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",
@@ -312,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",
@@ -330,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 d07e168..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,43 +408,43 @@ 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;
}

-/*==================================================================
+/*=======================================================================
*
* dgnc_wmove - Write data to transmit queue.
*
@@ -451,7 +452,7 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
* 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)
{
@@ -490,13 +491,13 @@ 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)
{
@@ -938,8 +939,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_tun.un_tty->ldisc->ops->write_wakeup
- (ch->ch_tun.un_tty);
+ ch->ch_tun.un_tty->ldisc->ops->write_wakeup(ch->ch_tun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -959,8 +959,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
* the queue and UART is empty, keep RTS low.
*/
if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
- ch->ch_mostat &=
- ~(UART_MCR_RTS);
+ ch->ch_mostat &= ~(UART_MCR_RTS);
ch->ch_bd->bd_ops->assert_modem_signals(ch);
}

@@ -970,8 +969,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
*/
if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
ch->ch_mostat &= ~(UART_MCR_DTR);
- ch->ch_bd->bd_ops->
- assert_modem_signals(ch);
+ ch->ch_bd->bd_ops->assert_modem_signals(ch);
}
}
}
@@ -983,8 +981,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_pun.un_tty->ldisc->ops->write_wakeup
- (ch->ch_pun.un_tty);
+ ch->ch_pun.un_tty->ldisc->ops->write_wakeup(ch->ch_pun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -1035,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;

@@ -1625,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;
@@ -1704,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;
@@ -2726,15 +2723,13 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
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);
+ 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);
- wake_up_interruptible
- (&ch->ch_pun.un_flags_wait);
+ wake_up_interruptible(&ch->ch_pun.un_flags_wait);
}
}
}
@@ -2965,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 e202aac..701312f 100644
--- a/drivers/staging/dgnc/digi.h
+++ b/drivers/staging/dgnc/digi.h
@@ -40,10 +40,10 @@
#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_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
@@ -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 */
@@ -109,8 +109,8 @@ struct digi_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;
--
2.5.0

2015-12-15 05:26:43

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH FIXED 3/3] staging: dgnc: Patch updates the TODO file

Patch updates the TODO file.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/TODO | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index 0e0825b..0bdfd26 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,4 +1,3 @@
-* checkpatch fixes
* remove unnecessary comments
* remove unnecessary error messages. Example kzalloc() has its
own error message. Adding an extra one is useless.
--
2.5.0

2015-12-15 05:58:13

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH FIXED 1/3] staging: dgnc: Patch includes spacing fixes

Patch contains the spacing fixes that led to checkpatch.pl warnings.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/dgnc_cls.c | 4 +-
drivers/staging/dgnc/dgnc_driver.h | 8 --
drivers/staging/dgnc/dgnc_neo.c | 235 ++++++++++++++++++++++++-------------
drivers/staging/dgnc/dgnc_neo.h | 22 ++--
drivers/staging/dgnc/dgnc_pci.h | 1 -
drivers/staging/dgnc/dgnc_sysfs.c | 18 ++-
drivers/staging/dgnc/dgnc_tty.c | 46 +++++---
drivers/staging/dgnc/digi.h | 32 ++---
8 files changed, 223 insertions(+), 143 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.h b/drivers/staging/dgnc/dgnc_driver.h
index ce7cd9b..e4be81b 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -88,7 +88,6 @@
#define _POSIX_VDISABLE '\0'
#endif

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

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

-
/*
* Per-board information
*/
@@ -241,7 +238,6 @@ struct dgnc_board {

};

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

-
/************************************************************************
* Device flag definitions for ch_flags.
************************************************************************/
@@ -300,7 +295,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 +303,6 @@ struct un_t {
#define EQUEUESIZE RQUEUESIZE
#define WQUEUESIZE (WQUEUEMASK + 1)

-
/************************************************************************
* Channel information structure.
************************************************************************/
@@ -397,7 +390,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;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 8106f52..2b94b75 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 */
@@ -352,7 +372,7 @@ static inline void neo_clear_break(struct channel_t *ch, int force)
/* Turn break off, and unset some variables */
if (ch->ch_flags & CH_BREAK_SENDING) {
if (time_after_eq(jiffies, ch->ch_stop_sending_break)
- || force) {
+ || force) {
unsigned char temp = readb(&ch->ch_neo_uart->lcr);

writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
@@ -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,9 @@ 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);
@@ -428,7 +451,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
* 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);
@@ -437,7 +460,8 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
flags);
}
} else if (cause == UART_17158_XOFF_DETECT) {
- if (!(brd->channels[port]->ch_flags & CH_STOP)) {
+ if (!(brd->channels[port]->ch_flags &
+ CH_STOP)) {
spin_lock_irqsave(&ch->ch_lock,
flags);
ch->ch_flags |= CH_STOP;
@@ -449,8 +473,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++;
@@ -542,10 +567,11 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port)

if (linestatus & UART_LSR_OE) {
/*
- * 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...
+ * 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.
*/
ch->ch_err_overrun++;
}
@@ -665,8 +691,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 +708,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;
@@ -763,8 +793,9 @@ static void neo_param(struct tty_struct *tty)
ier &= ~(UART_IER_RDI | UART_IER_RLSI);

/*
- * Have the UART interrupt on modem signal changes ONLY when
- * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
+ * Have the UART interrupt on modem signal changes
+ * ONLY when we are in hardware flow control mode,
+ * or CLOCAL/FORCEDCD is not set.
*/
if ((ch->ch_digi.digi_flags & CTSPACE) ||
(ch->ch_digi.digi_flags & RTSPACE) ||
@@ -786,8 +817,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 +832,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);
@@ -808,9 +845,10 @@ static void neo_param(struct tty_struct *tty)
}

/*
- * Adjust the RX FIFO Trigger level if baud is less than 9600.
- * Not exactly elegant, but this is needed because of the Exar chip's
- * delay on firing off the RX FIFO interrupt on slower baud rates.
+ * Adjust the RX FIFO Trigger level if baud is less
+ * than 9600. Not exactly elegant, but this is needed
+ * because of the Exar chip's delay on firing off the
+ * RX FIFO interrupt on slower baud rates.
*/
if (baud < 9600) {
writeb(1, &ch->ch_neo_uart->rfifo);
@@ -845,13 +883,14 @@ static void neo_tasklet(unsigned long data)
spin_unlock_irqrestore(&bd->bd_lock, flags);

/*
- * Do NOT allow the interrupt routine to read the intr registers
- * Until we release this lock.
+ * Do NOT allow the interrupt routine to read the
+ * intr registers. Until we release this lock.
*/
spin_lock_irqsave(&bd->bd_intr_lock, flags);

/*
- * If board is ready, parse deeper to see if there is anything to do.
+ * If board is ready, parse deeper to see if there is
+ * anything to do.
*/
if ((state == BOARD_READY) && (ports > 0)) {
/* Loop on each port */
@@ -938,14 +977,17 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)

/*
* If 0, no interrupts pending.
- * This can happen if the IRQ is shared among a couple Neo/Classic boards.
+ * 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 +1009,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 +1028,9 @@ 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);
@@ -1002,16 +1046,18 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)

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.
+ * 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;
@@ -1026,9 +1072,9 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
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.
+ * It appears the Exar chip, when REALLY bogged down,
+ * will throw these once and awhile. Its harmless,
+ * just ignore it and move on.
*/
continue;
}
@@ -1172,7 +1218,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 +1272,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);
}

@@ -1236,17 +1284,19 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
unsigned char discard;

linestatus = 0;
- memcpy_fromio(&discard, &ch->ch_neo_uart->txrxburst, 1);
+ memcpy_fromio(&discard,
+ &ch->ch_neo_uart->txrxburst, 1);
continue;
}

/*
- * 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.
+ * I decided that I wanted to ditch the oldest data
+ * first, I hope thats okay with everyone? Yes? Good.
*/
while (qleft < 1) {
tail = (tail + 1) & RQUEUEMASK;
@@ -1255,7 +1305,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 +1360,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 +1380,14 @@ 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 +1411,14 @@ 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);
@@ -1405,8 +1463,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
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)) {
@@ -1416,8 +1475,9 @@ 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)) {
@@ -1427,7 +1487,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++;
@@ -1471,8 +1532,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
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)) {
@@ -1483,8 +1545,9 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
}

/*
- * 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)) {
@@ -1494,7 +1557,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 +1611,9 @@ 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 delta's,
+ * which I don't care about.
+ */
msignals &= 0xf0;

if (msignals & UART_MSR_DCD)
@@ -1628,7 +1694,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 +1792,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 +1847,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 nametag (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..db7951f 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -193,12 +193,18 @@ static ssize_t dgnc_ports_msignals_show(struct device *p,
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);
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 48e4b90..d07e168 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -443,15 +443,16 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
brd->PrintDriver.termios = NULL;
}

-/*=======================================================================
+/*==================================================================
*
* 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 +490,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;
@@ -936,7 +938,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_tun.un_tty->ldisc->ops->write_wakeup(ch->ch_tun.un_tty);
+ ch->ch_tun.un_tty->ldisc->ops->write_wakeup
+ (ch->ch_tun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -956,7 +959,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
* the queue and UART is empty, keep RTS low.
*/
if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
- ch->ch_mostat &= ~(UART_MCR_RTS);
+ ch->ch_mostat &=
+ ~(UART_MCR_RTS);
ch->ch_bd->bd_ops->assert_modem_signals(ch);
}

@@ -966,7 +970,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
*/
if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
ch->ch_mostat &= ~(UART_MCR_DTR);
- ch->ch_bd->bd_ops->assert_modem_signals(ch);
+ ch->ch_bd->bd_ops->
+ assert_modem_signals(ch);
}
}
}
@@ -978,7 +983,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_pun.un_tty->ldisc->ops->write_wakeup(ch->ch_pun.un_tty);
+ ch->ch_pun.un_tty->ldisc->ops->write_wakeup
+ (ch->ch_pun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -2520,12 +2526,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,16 +2723,18 @@ 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);
- wake_up_interruptible(&ch->ch_tun.un_flags_wait);
+ ~(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);
- wake_up_interruptible(&ch->ch_pun.un_flags_wait);
+ ~(UN_LOW | UN_EMPTY);
+ wake_up_interruptible
+ (&ch->ch_pun.un_flags_wait);
}
}
}
diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index cf9dcae..e202aac 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
@@ -105,7 +105,7 @@ 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 */
{
@@ -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

2015-12-15 05:59:49

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

Patch contains the spacing fixes that led to checkpatch.pl warnings.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/dgnc_cls.c | 4 +-
drivers/staging/dgnc/dgnc_driver.h | 8 --
drivers/staging/dgnc/dgnc_neo.c | 235
++++++++++++++++++++++++-------------
drivers/staging/dgnc/dgnc_neo.h | 22 ++--
drivers/staging/dgnc/dgnc_pci.h | 1 -
drivers/staging/dgnc/dgnc_sysfs.c | 18 ++-
drivers/staging/dgnc/dgnc_tty.c | 46 +++++---
drivers/staging/dgnc/digi.h | 32 ++--- 8 files changed, 223
insertions(+), 143 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.h
b/drivers/staging/dgnc/dgnc_driver.h index ce7cd9b..e4be81b 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -88,7 +88,6 @@
#define _POSIX_VDISABLE '\0'
#endif

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

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

};

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

-
/************************************************************************
* Device flag definitions for ch_flags.
************************************************************************/
@@ -300,7 +295,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 +303,6 @@ struct un_t {
#define EQUEUESIZE RQUEUESIZE
#define WQUEUESIZE (WQUEUEMASK + 1)

-
/************************************************************************
* Channel information structure.
************************************************************************/
@@ -397,7 +390,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;
diff --git a/drivers/staging/dgnc/dgnc_neo.c
b/drivers/staging/dgnc/dgnc_neo.c index 8106f52..2b94b75 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 */
@@ -352,7 +372,7 @@ static inline void neo_clear_break(struct channel_t
*ch, int force) /* Turn break off, and unset some variables */
if (ch->ch_flags & CH_BREAK_SENDING) {
if (time_after_eq(jiffies, ch->ch_stop_sending_break)
- || force) {
+ || force) {
unsigned char temp =
readb(&ch->ch_neo_uart->lcr);
writeb((temp & ~UART_LCR_SBC),
&ch->ch_neo_uart->lcr); @@ -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,9 @@ 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);
@@ -428,7 +451,7 @@ static inline void neo_parse_isr(struct dgnc_board
*brd, uint port)
* 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);
@@ -437,7 +460,8 @@ static inline void neo_parse_isr(struct dgnc_board
*brd, uint port) flags);
}
} else if (cause == UART_17158_XOFF_DETECT) {
- if (!(brd->channels[port]->ch_flags &
CH_STOP)) {
+ if (!(brd->channels[port]->ch_flags &
+ CH_STOP)) {
spin_lock_irqsave(&ch->ch_lock,
flags);
ch->ch_flags |= CH_STOP;
@@ -449,8 +473,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++;
@@ -542,10 +567,11 @@ static inline void neo_parse_lsr(struct
dgnc_board *brd, uint port)
if (linestatus & UART_LSR_OE) {
/*
- * 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...
+ * 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.
*/
ch->ch_err_overrun++;
}
@@ -665,8 +691,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 +708,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;
@@ -763,8 +793,9 @@ static void neo_param(struct tty_struct *tty)
ier &= ~(UART_IER_RDI | UART_IER_RLSI);

/*
- * Have the UART interrupt on modem signal changes ONLY when
- * we are in hardware flow control mode, or CLOCAL/FORCEDCD is
not set.
+ * Have the UART interrupt on modem signal changes
+ * ONLY when we are in hardware flow control mode,
+ * or CLOCAL/FORCEDCD is not set.
*/
if ((ch->ch_digi.digi_flags & CTSPACE) ||
(ch->ch_digi.digi_flags & RTSPACE) ||
@@ -786,8 +817,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 +832,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);
@@ -808,9 +845,10 @@ static void neo_param(struct tty_struct *tty)
}

/*
- * Adjust the RX FIFO Trigger level if baud is less than 9600.
- * Not exactly elegant, but this is needed because of the Exar
chip's
- * delay on firing off the RX FIFO interrupt on slower baud
rates.
+ * Adjust the RX FIFO Trigger level if baud is less
+ * than 9600. Not exactly elegant, but this is needed
+ * because of the Exar chip's delay on firing off the
+ * RX FIFO interrupt on slower baud rates.
*/
if (baud < 9600) {
writeb(1, &ch->ch_neo_uart->rfifo);
@@ -845,13 +883,14 @@ static void neo_tasklet(unsigned long data)
spin_unlock_irqrestore(&bd->bd_lock, flags);

/*
- * Do NOT allow the interrupt routine to read the intr
registers
- * Until we release this lock.
+ * Do NOT allow the interrupt routine to read the
+ * intr registers. Until we release this lock.
*/
spin_lock_irqsave(&bd->bd_intr_lock, flags);

/*
- * If board is ready, parse deeper to see if there is anything
to do.
+ * If board is ready, parse deeper to see if there is
+ * anything to do.
*/
if ((state == BOARD_READY) && (ports > 0)) {
/* Loop on each port */
@@ -938,14 +977,17 @@ static irqreturn_t neo_intr(int irq, void
*voidbrd)
/*
* If 0, no interrupts pending.
- * This can happen if the IRQ is shared among a couple
Neo/Classic boards.
+ * 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 +1009,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 +1028,9 @@ 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);
@@ -1002,16 +1046,18 @@ static irqreturn_t neo_intr(int irq, void
*voidbrd)
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.
+ * 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;
@@ -1026,9 +1072,9 @@ static irqreturn_t neo_intr(int irq, void
*voidbrd) 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.
+ * It appears the Exar chip, when REALLY
bogged down,
+ * will throw these once and awhile. Its
harmless,
+ * just ignore it and move on.
*/
continue;
}
@@ -1172,7 +1218,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 +1272,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); }

@@ -1236,17 +1284,19 @@ static void
neo_copy_data_from_uart_to_queue(struct channel_t *ch) unsigned char
discard;
linestatus = 0;
- memcpy_fromio(&discard,
&ch->ch_neo_uart->txrxburst, 1);
+ memcpy_fromio(&discard,
+ &ch->ch_neo_uart->txrxburst,
1); continue;
}

/*
- * 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.
+ * I decided that I wanted to ditch the oldest data
+ * first, I hope thats okay with everyone? Yes? Good.
*/
while (qleft < 1) {
tail = (tail + 1) & RQUEUEMASK;
@@ -1255,7 +1305,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 +1360,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 +1380,14 @@ 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 +1411,14 @@ 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);
@@ -1405,8 +1463,9 @@ static void
neo_copy_data_from_queue_to_uart(struct channel_t *ch)
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)) {
@@ -1416,8 +1475,9 @@ 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)) {
@@ -1427,7 +1487,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++;
@@ -1471,8 +1532,9 @@ static void
neo_copy_data_from_queue_to_uart(struct channel_t *ch) 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)) {
@@ -1483,8 +1545,9 @@ static void
neo_copy_data_from_queue_to_uart(struct channel_t *ch) }

/*
- * 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)) {
@@ -1494,7 +1557,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 +1611,9 @@ 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 delta's,
+ * which I don't care about.
+ */
msignals &= 0xf0;

if (msignals & UART_MSR_DCD)
@@ -1628,7 +1694,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 +1792,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 +1847,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 nametag (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..db7951f 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -193,12 +193,18 @@ static ssize_t dgnc_ports_msignals_show(struct
device *p, 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);
diff --git a/drivers/staging/dgnc/dgnc_tty.c
b/drivers/staging/dgnc/dgnc_tty.c index 48e4b90..d07e168 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -443,15 +443,16 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
brd->PrintDriver.termios = NULL;
}

-/*=======================================================================
+/*==================================================================
*
* 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 +490,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;
@@ -936,7 +938,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_tun.un_tty->flags & (1 <<
TTY_DO_WRITE_WAKEUP)) && ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
-
ch->ch_tun.un_tty->ldisc->ops->write_wakeup(ch->ch_tun.un_tty);
+ ch->ch_tun.un_tty->ldisc->ops->write_wakeup
+ (ch->ch_tun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -956,7 +959,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
* the queue and UART is empty, keep
RTS low. */
if (ch->ch_digi.digi_flags &
DIGI_RTS_TOGGLE) {
- ch->ch_mostat &=
~(UART_MCR_RTS);
+ ch->ch_mostat &=
+
~(UART_MCR_RTS); ch->ch_bd->bd_ops->assert_modem_signals(ch);
}

@@ -966,7 +970,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
*/
if (ch->ch_digi.digi_flags &
DIGI_DTR_TOGGLE) { ch->ch_mostat &= ~(UART_MCR_DTR);
-
ch->ch_bd->bd_ops->assert_modem_signals(ch);
+ ch->ch_bd->bd_ops->
+
assert_modem_signals(ch); }
}
}
@@ -978,7 +983,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_pun.un_tty->flags & (1 <<
TTY_DO_WRITE_WAKEUP)) && ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
-
ch->ch_pun.un_tty->ldisc->ops->write_wakeup(ch->ch_pun.un_tty);
+ ch->ch_pun.un_tty->ldisc->ops->write_wakeup
+ (ch->ch_pun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -2520,12 +2526,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,16 +2723,18 @@ 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);
-
wake_up_interruptible(&ch->ch_tun.un_flags_wait);
+ ~(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);
-
wake_up_interruptible(&ch->ch_pun.un_flags_wait);
+ ~(UN_LOW | UN_EMPTY);
+ wake_up_interruptible
+
(&ch->ch_pun.un_flags_wait); }
}
}
diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index cf9dcae..e202aac 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
@@ -105,7 +105,7 @@ 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 */
{
@@ -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

2015-12-15 06:01:37

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH 2/3] staging: dgnc: Patch includes CamelCase & Macro fixes

Patch contains the CamelCase fixes & Macro fixes that led to
checkpatch.pl errors.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/dgnc_driver.c | 56 ++++-----
drivers/staging/dgnc/dgnc_driver.h | 25 ++--
drivers/staging/dgnc/dgnc_mgmt.c | 28 ++---
drivers/staging/dgnc/dgnc_neo.c | 226 +++++++++++++++++--------------------
drivers/staging/dgnc/dgnc_sysfs.c | 134 +++++++++++++++++-----
drivers/staging/dgnc/dgnc_tty.c | 197 ++++++++++++++++----------------
drivers/staging/dgnc/digi.h | 20 ++--
7 files changed, 367 insertions(+), 319 deletions(-)

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 e4be81b..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 */
@@ -202,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
@@ -399,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 2b94b75..fead81e 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -77,8 +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
@@ -111,7 +111,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch)
efr &= ~UART_17158_EFR_IXON;

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

@@ -120,7 +120,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

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

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

@@ -157,7 +157,7 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch)
writeb(efr, &ch->ch_neo_uart->efr);

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

writeb(32, &ch->ch_neo_uart->rfifo);
@@ -189,7 +189,7 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch)
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXON);

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

@@ -197,7 +197,7 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch)
writeb(efr, &ch->ch_neo_uart->efr);

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

writeb(32, &ch->ch_neo_uart->rfifo);
@@ -229,7 +229,7 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch)
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXOFF);

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

@@ -238,7 +238,7 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

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

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

@@ -281,7 +281,7 @@ static inline void neo_set_no_input_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

ch->ch_r_watermark = 0;

@@ -312,7 +312,7 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch)
efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXON);

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

@@ -321,7 +321,7 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch)

/* 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);
+ &ch->ch_neo_uart->fctr);

ch->ch_r_watermark = 0;

@@ -341,7 +341,7 @@ 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)
+ ch->ch_c_cflag & CRTSCTS)
return;

/* Tell UART what start/stop chars it should be looking for */
@@ -372,7 +372,7 @@ static inline void neo_clear_break(struct channel_t *ch, int force)
/* Turn break off, and unset some variables */
if (ch->ch_flags & CH_BREAK_SENDING) {
if (time_after_eq(jiffies, ch->ch_stop_sending_break)
- || force) {
+ || force) {
unsigned char temp = readb(&ch->ch_neo_uart->lcr);

writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
@@ -413,8 +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);

@@ -424,9 +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);
@@ -447,8 +445,8 @@ 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 */
@@ -460,8 +458,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
flags);
}
} else if (cause == UART_17158_XOFF_DETECT) {
- if (!(brd->channels[port]->ch_flags &
- CH_STOP)) {
+ if (!(brd->channels[port]->ch_flags & CH_STOP)) {
spin_lock_irqsave(&ch->ch_lock,
flags);
ch->ch_flags |= CH_STOP;
@@ -473,9 +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++;
@@ -567,11 +564,10 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port)

if (linestatus & UART_LSR_OE) {
/*
- * 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.
+ * 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.
+ * We should eventually have an orun stat in our driver.
*/
ch->ch_err_overrun++;
}
@@ -692,7 +688,7 @@ static void neo_param(struct tty_struct *tty)
};

/* Only use the TXPrint baud rate if the
- * terminal unit is NOT open.
+ * terminal unit is NOT open
*/
if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
(un->un_type == DGNC_PRINT))
@@ -708,8 +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;
@@ -793,9 +789,8 @@ static void neo_param(struct tty_struct *tty)
ier &= ~(UART_IER_RDI | UART_IER_RLSI);

/*
- * Have the UART interrupt on modem signal changes
- * ONLY when we are in hardware flow control mode,
- * or CLOCAL/FORCEDCD is not set.
+ * Have the UART interrupt on modem signal changes ONLY when
+ * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
*/
if ((ch->ch_digi.digi_flags & CTSPACE) ||
(ch->ch_digi.digi_flags & RTSPACE) ||
@@ -818,7 +813,7 @@ static void neo_param(struct tty_struct *tty)
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.
+ * should disable flow control
*/
if ((ch->ch_startc == _POSIX_VDISABLE) ||
(ch->ch_stopc == _POSIX_VDISABLE))
@@ -832,8 +827,8 @@ 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 start/stop is set to disable, then we
+ * should disable flow control
*/
if ((ch->ch_startc == _POSIX_VDISABLE) ||
(ch->ch_stopc == _POSIX_VDISABLE))
@@ -845,10 +840,9 @@ static void neo_param(struct tty_struct *tty)
}

/*
- * Adjust the RX FIFO Trigger level if baud is less
- * than 9600. Not exactly elegant, but this is needed
- * because of the Exar chip's delay on firing off the
- * RX FIFO interrupt on slower baud rates.
+ * Adjust the RX FIFO Trigger level if baud is less than 9600.
+ * Not exactly elegant, but this is needed because of the Exar chip's
+ * delay on firing off the RX FIFO interrupt on slower baud rates.
*/
if (baud < 9600) {
writeb(1, &ch->ch_neo_uart->rfifo);
@@ -883,14 +877,13 @@ static void neo_tasklet(unsigned long data)
spin_unlock_irqrestore(&bd->bd_lock, flags);

/*
- * Do NOT allow the interrupt routine to read the
- * intr registers. Until we release this lock.
+ * Do NOT allow the interrupt routine to read the intr registers
+ * Until we release this lock.
*/
spin_lock_irqsave(&bd->bd_intr_lock, flags);

/*
- * If board is ready, parse deeper to see if there is
- * anything to do.
+ * If board is ready, parse deeper to see if there is anything to do.
*/
if ((state == BOARD_READY) && (ports > 0)) {
/* Loop on each port */
@@ -975,19 +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;

@@ -1028,9 +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);
@@ -1045,20 +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;

@@ -1070,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;
}
}
@@ -1154,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);

/*
@@ -1273,7 +1260,7 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
*/
if (linestatus & (UART_LSR_THRE | UART_17158_TX_AND_FIFO_CLR)) {
linestatus &= ~(UART_LSR_THRE |
- UART_17158_TX_AND_FIFO_CLR);
+ UART_17158_TX_AND_FIFO_CLR);
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
}

@@ -1284,19 +1271,18 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
unsigned char discard;

linestatus = 0;
- memcpy_fromio(&discard,
- &ch->ch_neo_uart->txrxburst, 1);
+ memcpy_fromio(&discard, &ch->ch_neo_uart->txrxburst, 1);
continue;
}

/*
* 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.
+ * 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.
+ * I decided that I wanted to ditch the oldest data first,
+ * I hope thats okay with everyone? Yes? Good.
*/
while (qleft < 1) {
tail = (tail + 1) & RQUEUEMASK;
@@ -1361,7 +1347,7 @@ 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));
+ ((un->un_flags & UN_EMPTY) == 0));

/* If ret is non-zero, user ctrl-c'ed us */
return rc;
@@ -1385,9 +1371,7 @@ static void neo_flush_uart_write(struct channel_t *ch)
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);
@@ -1416,9 +1400,7 @@ static void neo_flush_uart_read(struct channel_t *ch)
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);
@@ -1462,11 +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);
@@ -1474,11 +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);
@@ -1531,11 +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);
@@ -1544,11 +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);
@@ -1558,7 +1540,7 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
}

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

/* Add and flip queue if needed */
tail = (tail + s) & WQUEUEMASK;
@@ -1611,9 +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)
@@ -1793,7 +1773,7 @@ static void neo_send_immediate_char(struct channel_t *ch, unsigned char c)
}

static unsigned int neo_read_eeprom(unsigned char __iomem *base,
- unsigned int address)
+ unsigned int address)
{
unsigned int enable;
unsigned int bits;
@@ -1853,7 +1833,7 @@ static void neo_vpd(struct dgnc_board *brd)

if (((brd->vpd[0x08] != 0x82) /* long resource name tag */
&& (brd->vpd[0x10] != 0x82))
- /* long resource nametag (PCI-66 files)*/
+ /* 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_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c
index db7951f..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,7 +202,14 @@ 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) {
@@ -194,17 +217,17 @@ static ssize_t dgnc_ports_msignals_show(struct device *p,
"%d %s %s %s %s %s %s\n",
bd->channels[i]->ch_portnum,
(bd->channels[i]->ch_mostat & UART_MCR_RTS)
- ? "RTS" : "",
+ ? "RTS" : "",
(bd->channels[i]->ch_mistat & UART_MSR_CTS)
- ? "CTS" : "",
+ ? "CTS" : "",
(bd->channels[i]->ch_mostat & UART_MCR_DTR)
- ? "DTR" : "",
+ ? "DTR" : "",
(bd->channels[i]->ch_mistat & UART_MSR_DSR)
- ? "DSR" : "",
+ ? "DSR" : "",
(bd->channels[i]->ch_mistat & UART_MSR_DCD)
- ? "DCD" : "",
+ ? "DCD" : "",
(bd->channels[i]->ch_mistat & UART_MSR_RI)
- ? "RI" : "");
+ ? "RI" : "");
} else {
count += snprintf(buf + count, PAGE_SIZE - count,
"%d\n", bd->channels[i]->ch_portnum);
@@ -221,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",
@@ -239,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",
@@ -257,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",
@@ -275,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",
@@ -294,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",
@@ -312,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",
@@ -330,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 d07e168..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,43 +408,43 @@ 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;
}

-/*==================================================================
+/*=======================================================================
*
* dgnc_wmove - Write data to transmit queue.
*
@@ -451,7 +452,7 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
* 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)
{
@@ -490,13 +491,13 @@ 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)
{
@@ -938,8 +939,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_tun.un_tty->ldisc->ops->write_wakeup
- (ch->ch_tun.un_tty);
+ ch->ch_tun.un_tty->ldisc->ops->write_wakeup(ch->ch_tun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -959,8 +959,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
* the queue and UART is empty, keep RTS low.
*/
if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
- ch->ch_mostat &=
- ~(UART_MCR_RTS);
+ ch->ch_mostat &= ~(UART_MCR_RTS);
ch->ch_bd->bd_ops->assert_modem_signals(ch);
}

@@ -970,8 +969,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
*/
if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
ch->ch_mostat &= ~(UART_MCR_DTR);
- ch->ch_bd->bd_ops->
- assert_modem_signals(ch);
+ ch->ch_bd->bd_ops->assert_modem_signals(ch);
}
}
}
@@ -983,8 +981,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
spin_unlock_irqrestore(&ch->ch_lock, flags);
- ch->ch_pun.un_tty->ldisc->ops->write_wakeup
- (ch->ch_pun.un_tty);
+ ch->ch_pun.un_tty->ldisc->ops->write_wakeup(ch->ch_pun.un_tty);
spin_lock_irqsave(&ch->ch_lock, flags);
}

@@ -1035,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;

@@ -1625,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;
@@ -1704,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;
@@ -2726,15 +2723,13 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
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);
+ 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);
- wake_up_interruptible
- (&ch->ch_pun.un_flags_wait);
+ wake_up_interruptible(&ch->ch_pun.un_flags_wait);
}
}
}
@@ -2965,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 e202aac..701312f 100644
--- a/drivers/staging/dgnc/digi.h
+++ b/drivers/staging/dgnc/digi.h
@@ -40,10 +40,10 @@
#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_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
@@ -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 */
@@ -109,8 +109,8 @@ struct digi_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;
--
2.5.0

2015-12-15 06:02:30

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH 3/3] staging: dgnc: Patch updates the TODO file

Patch updates the TODO file.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
drivers/staging/dgnc/TODO | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index 0e0825b..0bdfd26 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,4 +1,3 @@
-* checkpatch fixes
* remove unnecessary comments
* remove unnecessary error messages. Example kzalloc() has its
own error message. Adding an extra one is useless.
--
2.5.0

2015-12-15 04:34:42

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

On Mon, Dec 14, 2015 at 07:03:31PM -0500, Sanidhya Solanki wrote:
> Patch updates the TODO file.
>
> Signed-off-by: Sanidhya Solanki <[email protected]>
> ---
> drivers/staging/dgnc/TODO | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
> index 0e0825b..0bdfd26 100644
> --- a/drivers/staging/dgnc/TODO
> +++ b/drivers/staging/dgnc/TODO
> @@ -1,4 +1,3 @@
> -* checkpatch fixes
> * remove unnecessary comments
> * remove unnecessary error messages. Example kzalloc() has its
> own error message. Adding an extra one is useless.
> --
> 2.5.0

You sent me 3 patches, all with the same Subject: line, and all of them
incorrect, so I've dropped them all :(

2015-12-15 05:21:55

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

On Mon, Dec 14, 2015 at 07:45:25PM -0500, Sanidhya Solanki wrote:
> Can you tell me what was incorrect about them?

The subjects are all wrong, go look at them... PATCH twice? 1/3 for
every message? Same string for every message?

> I thought you requested the dgnc patches to be resent without the
> headers.

I did, but that doesn't mean you send incorrect ones :)

> There are 3 of them because Dan Carpenter asked my patch to be broken
> up so each one does only one thing. I also resent you the skein
> subsystem patches, as I did not hear anything from you for almost a
> week.

My queue of pending staging patches is over 1000 right now, they are
burried somewhere in there, be patient.

greg k-h

2015-12-15 05:46:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH FIXED 1/3] staging: dgnc: Patch includes the checkpatch fixes

On Mon, Dec 14, 2015 at 08:22:47PM -0500, Sanidhya Solanki wrote:
> Patch contains the spacing fixes that checkpatch prompted for,
> as asked by the TODO.
>
> Signed-off-by: Sanidhya Solanki <[email protected]>

What is the FIXED doing in the subject?

And the subject is horrid, please make it sane...

2015-12-15 06:37:09

by Amitoj Kaur Chawla

[permalink] [raw]
Subject: Re: [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

On Tue, Dec 15, 2015 at 7:28 AM, Sanidhya Solanki <[email protected]> wrote:
>
> Patch contains the spacing fixes that led to checkpatch.pl warnings.
>
> Signed-off-by: Sanidhya Solanki <[email protected]>
> ---
> drivers/staging/dgnc/dgnc_cls.c | 4 +-
> drivers/staging/dgnc/dgnc_driver.h | 8 --
> drivers/staging/dgnc/dgnc_neo.c | 235
> ++++++++++++++++++++++++-------------
> drivers/staging/dgnc/dgnc_neo.h | 22 ++--
> drivers/staging/dgnc/dgnc_pci.h | 1 -
> drivers/staging/dgnc/dgnc_sysfs.c | 18 ++-
> drivers/staging/dgnc/dgnc_tty.c | 46 +++++---
> drivers/staging/dgnc/digi.h | 32 ++--- 8 files changed, 223
> insertions(+), 143 deletions(-)
>

Hi Sanidhya,

Just to help you out since you're struggling some.

Subject line should be something like "Fix checkpatch warnings".
Better yet would be a subject specifying what you fixed to silence
checkpatch warnings. For example, "Fixed comments formatting" or
"Removed unnecessary spaces"

And the commit message should not be vague like "Patch contains the
spacing fixes that led to checkpatch.pl warnings." You should write
what you did to fix the warnings.
For example: Fixed checkpatch warning *write warning here* by
correcting *whatever change you did*

Regards,
Amitoj

2015-12-15 06:38:42

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

Why is the "Re:" in the Subject?

Why is "Patch" in the subject"?

The Subject doesn't even make sense.

On Mon, Dec 14, 2015 at 08:58:30PM -0500, Sanidhya Solanki wrote:
> Patch contains the spacing fixes that led to checkpatch.pl warnings.
>
> Signed-off-by: Sanidhya Solanki <[email protected]>
> ---
> drivers/staging/dgnc/dgnc_cls.c | 4 +-
> drivers/staging/dgnc/dgnc_driver.h | 8 --
> drivers/staging/dgnc/dgnc_neo.c | 235
> ++++++++++++++++++++++++-------------


Patch is line-wrapped and doesn't even apply :(

Please take a day, relax, and fix up all 3 of these and resend them
tomorrow. There's no rush here.

greg k-h