Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933133AbbLOEEC (ORCPT ); Mon, 14 Dec 2015 23:04:02 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33725 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933000AbbLOED7 (ORCPT ); Mon, 14 Dec 2015 23:03:59 -0500 Date: Mon, 14 Dec 2015 19:02:38 -0500 From: Sanidhya Solanki To: Greg KH Cc: Dan Carpenter , devel@driverdev.osuosl.org, lidza.louina@gmail.com, driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes Message-ID: <20151214190238.0dfb9304@gmail.com> In-Reply-To: <20151214191451.GA30170@kroah.com> References: <20151211032149.489d90d1@gmail.com> <20151211130233.GJ5284@mwanda> <20151211212416.6238df0d@gmail.com> <20151212085744.GO5284@mwanda> <20151212025850.47738101@gmail.com> <20151214191451.GA30170@kroah.com> X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 53208 Lines: 1595 Patch contains the CamelCase fixes & Macro fixes that checkpatch prompted for, as asked by the TODO. Signed-off-by: Sanidhya Solanki --- 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 #include #include +#include #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, "\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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/