diff options
Diffstat (limited to 'drivers/staging/dgnc')
-rw-r--r-- | drivers/staging/dgnc/Makefile | 2 | ||||
-rw-r--r-- | drivers/staging/dgnc/TODO | 6 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_cls.c | 73 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_cls.h | 53 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_driver.c | 75 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_driver.h | 24 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_kcompat.h | 46 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_mgmt.c | 25 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_mgmt.h | 6 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_neo.c | 88 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_neo.h | 8 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_pci.h | 6 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_sysfs.c | 20 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_sysfs.h | 11 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_tty.c | 80 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_tty.h | 6 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_types.h | 33 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_utils.c | 52 | ||||
-rw-r--r-- | drivers/staging/dgnc/dgnc_utils.h | 1 | ||||
-rw-r--r-- | drivers/staging/dgnc/digi.h | 308 | ||||
-rw-r--r-- | drivers/staging/dgnc/dpacompat.h | 115 |
21 files changed, 167 insertions, 871 deletions
diff --git a/drivers/staging/dgnc/Makefile b/drivers/staging/dgnc/Makefile index b69f7b6b1143..995c874f40eb 100644 --- a/drivers/staging/dgnc/Makefile +++ b/drivers/staging/dgnc/Makefile @@ -1,5 +1,3 @@ -EXTRA_CFLAGS += -DDG_NAME=\"dgnc-1.3-16\" -DDG_PART=\"40002369_F\" - obj-$(CONFIG_DGNC) += dgnc.o dgnc-objs := dgnc_cls.o dgnc_driver.o\ diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO index 22adff1078f3..2b2c6ea03c61 100644 --- a/drivers/staging/dgnc/TODO +++ b/drivers/staging/dgnc/TODO @@ -1,10 +1,10 @@ * checkpatch fixes * remove unecessary comments -* remove unecessary error messages. Example kzalloc() has its +* remove unecessary error messages. Example kzalloc() has its own error message. Adding an extra one is useless. * use goto statements for error handling when appropriate -* there is a lot of unecessary code in the driver. It was +* there is a lot of unecessary code in the driver. It was originally a standalone driver. Remove uneeded code. -Please send patches to Greg Kroah-Hartman <greg@kroah.com> and +Please send patches to Greg Kroah-Hartman <greg@kroah.com> and Cc: Lidza Louina <lidza.louina@gmail.com> diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index bedc5221b6fc..e3564d278d91 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -11,22 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. - * */ #include <linux/kernel.h> @@ -92,14 +76,12 @@ struct board_ops dgnc_cls_ops = { .send_immediate_char = cls_send_immediate_char }; - static inline void cls_set_cts_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -136,14 +118,12 @@ static inline void cls_set_cts_flow_control(struct channel_t *ch) } - static inline void cls_set_ixon_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -184,14 +164,12 @@ static inline void cls_set_ixon_flow_control(struct channel_t *ch) } - static inline void cls_set_no_output_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -230,14 +208,12 @@ static inline void cls_set_no_output_flow_control(struct channel_t *ch) } - static inline void cls_set_rts_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -266,20 +242,17 @@ static inline void cls_set_rts_flow_control(struct channel_t *ch) UART_16654_FCR_TXTRIGGER_16 | UART_FCR_CLEAR_RCVR), &ch->ch_cls_uart->isr_fcr); - ch->ch_r_watermark = 4; ch->ch_r_tlevel = 8; } - static inline void cls_set_ixoff_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -316,14 +289,12 @@ static inline void cls_set_ixoff_flow_control(struct channel_t *ch) } - static inline void cls_set_no_input_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -357,7 +328,6 @@ static inline void cls_set_no_input_flow_control(struct channel_t *ch) } - /* * cls_clear_break. * Determines whether its time to shut off break condition. @@ -393,7 +363,6 @@ static inline void cls_clear_break(struct channel_t *ch, int force) spin_unlock_irqrestore(&ch->ch_lock, flags); } - /* Parse the ISR register for the specific port */ static inline void cls_parse_isr(struct dgnc_board *brd, uint port) { @@ -406,7 +375,7 @@ static inline void cls_parse_isr(struct dgnc_board *brd, uint port) * verified in the interrupt routine. */ - if (port > brd->nasync) + if (port >= brd->nasync) return; ch = brd->channels[port]; @@ -457,7 +426,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, uint port) } } - /* * cls_param() * Send any/all changes to the line to the UART. @@ -711,7 +679,6 @@ static void cls_param(struct tty_struct *tty) cls_parse_modem(ch, readb(&ch->ch_cls_uart->msr)); } - /* * Our board poller function. */ @@ -784,7 +751,6 @@ static void cls_tasklet(unsigned long data) } - /* * cls_intr() * @@ -834,7 +800,6 @@ static irqreturn_t cls_intr(int irq, void *voidbrd) return IRQ_HANDLED; } - static void cls_disable_receiver(struct channel_t *ch) { unsigned char tmp = readb(&ch->ch_cls_uart->ier); @@ -843,7 +808,6 @@ static void cls_disable_receiver(struct channel_t *ch) writeb(tmp, &ch->ch_cls_uart->ier); } - static void cls_enable_receiver(struct channel_t *ch) { unsigned char tmp = readb(&ch->ch_cls_uart->ier); @@ -852,7 +816,6 @@ static void cls_enable_receiver(struct channel_t *ch) writeb(tmp, &ch->ch_cls_uart->ier); } - static void cls_copy_data_from_uart_to_queue(struct channel_t *ch) { int qleft = 0; @@ -942,7 +905,6 @@ static void cls_copy_data_from_uart_to_queue(struct channel_t *ch) spin_unlock_irqrestore(&ch->ch_lock, flags); } - /* * This function basically goes to sleep for secs, or until * it gets signalled that the port has fully drained. @@ -978,7 +940,6 @@ static int cls_drain(struct tty_struct *tty, uint seconds) ((un->un_flags & UN_EMPTY) == 0)); } - /* Channel lock MUST be held before calling this function! */ static void cls_flush_uart_write(struct channel_t *ch) { @@ -992,7 +953,6 @@ static void cls_flush_uart_write(struct channel_t *ch) ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); } - /* Channel lock MUST be held before calling this function! */ static void cls_flush_uart_read(struct channel_t *ch) { @@ -1013,7 +973,6 @@ static void cls_flush_uart_read(struct channel_t *ch) udelay(10); } - static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) { ushort head; @@ -1029,22 +988,16 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) spin_lock_irqsave(&ch->ch_lock, flags); /* No data to write to the UART */ - if (ch->ch_w_tail == ch->ch_w_head) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (ch->ch_w_tail == ch->ch_w_head) + goto exit_unlock; /* If port is "stopped", don't send any data to the UART */ if ((ch->ch_flags & CH_FORCED_STOP) || - (ch->ch_flags & CH_BREAK_SENDING)) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + (ch->ch_flags & CH_BREAK_SENDING)) + goto exit_unlock; - if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM))) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM))) + goto exit_unlock; n = 32; @@ -1094,10 +1047,10 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) if (len_written > 0) ch->ch_flags &= ~(CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); +exit_unlock: spin_unlock_irqrestore(&ch->ch_lock, flags); } - static void cls_parse_modem(struct channel_t *ch, unsigned char signals) { unsigned char msignals = signals; @@ -1162,7 +1115,6 @@ static void cls_parse_modem(struct channel_t *ch, unsigned char signals) spin_unlock_irqrestore(&ch->ch_lock, flags); } - /* Make the UART raise any of the output signals we want up */ static void cls_assert_modem_signals(struct channel_t *ch) { @@ -1182,7 +1134,6 @@ static void cls_assert_modem_signals(struct channel_t *ch) udelay(10); } - static void cls_send_start_character(struct channel_t *ch) { if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) @@ -1194,7 +1145,6 @@ static void cls_send_start_character(struct channel_t *ch) } } - static void cls_send_stop_character(struct channel_t *ch) { if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) @@ -1206,7 +1156,6 @@ static void cls_send_stop_character(struct channel_t *ch) } } - /* Inits UART */ static void cls_uart_init(struct channel_t *ch) { @@ -1244,7 +1193,6 @@ static void cls_uart_init(struct channel_t *ch) readb(&ch->ch_cls_uart->msr); } - /* * Turns off UART. */ @@ -1253,7 +1201,6 @@ static void cls_uart_off(struct channel_t *ch) writeb(0, &ch->ch_cls_uart->ier); } - /* * cls_get_uarts_bytes_left. * Returns 0 is nothing left in the FIFO, returns 1 otherwise. @@ -1283,7 +1230,6 @@ static uint cls_get_uart_bytes_left(struct channel_t *ch) return left; } - /* * cls_send_break. * Starts sending a break thru the UART. @@ -1326,7 +1272,6 @@ static void cls_send_break(struct channel_t *ch, int msecs) } } - /* * cls_send_immediate_char. * Sends a specific character as soon as possible to the UART, @@ -1348,7 +1293,6 @@ static void cls_vpd(struct dgnc_board *brd) u8 __iomem *re_map_vpdbase;/* Remapped memory of the card */ int i = 0; - vpdbase = pci_resource_start(brd->pdev, 3); /* No VPD */ @@ -1370,4 +1314,3 @@ static void cls_vpd(struct dgnc_board *brd) if (re_map_vpdbase) iounmap(re_map_vpdbase); } - diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h index 465d79a6f75f..2597e36d38c4 100644 --- a/drivers/staging/dgnc/dgnc_cls.h +++ b/drivers/staging/dgnc/dgnc_cls.h @@ -11,21 +11,11 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! - * */ #ifndef __DGNC_CLS_H #define __DGNC_CLS_H -#include "dgnc_types.h" - - /************************************************************************ * Per channel/port Classic UART structure * ************************************************************************ @@ -35,15 +25,25 @@ * U = Unused. * ************************************************************************/ +/* + * txrx : WR RHR/THR - Holding reg + * ier : WR IER - Interrupt Enable Reg + * isr_fcr : WR ISR/FCR - Interrupt Status Reg/Fifo Control Reg + * lcr : WR LCR - Line Control Reg + * mcr : WR MCR - Modem Control Reg + * lsr : WR LSR - Line Status Reg + * msr : WR MSG - Modem Status Reg + * spr : WR SPR - Scratch pad Reg + */ struct cls_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 lcr; /* WR LCR - Line Control Reg */ - u8 mcr; /* WR MCR - Modem Control Reg */ - u8 lsr; /* WR LSR - Line Status Reg */ - u8 msr; /* WR MSR - Modem Status Reg */ - u8 spr; /* WR SPR - Scratch Pad Reg */ + u8 txrx; + u8 ier; + u8 isr_fcr; + u8 lcr; + u8 mcr; + u8 lsr; + u8 msr; + u8 spr; }; /* Where to read the interrupt register (8bits) */ @@ -51,18 +51,15 @@ struct cls_uart_struct { #define UART_EXAR654_ENHANCED_REGISTER_SET 0xBF -#define UART_16654_FCR_TXTRIGGER_8 0x0 #define UART_16654_FCR_TXTRIGGER_16 0x10 -#define UART_16654_FCR_TXTRIGGER_32 0x20 -#define UART_16654_FCR_TXTRIGGER_56 0x30 - -#define UART_16654_FCR_RXTRIGGER_8 0x0 #define UART_16654_FCR_RXTRIGGER_16 0x40 #define UART_16654_FCR_RXTRIGGER_56 0x80 -#define UART_16654_FCR_RXTRIGGER_60 0xC0 -#define UART_IIR_CTSRTS 0x20 /* Received CTS/RTS change of state */ -#define UART_IIR_RDI_TIMEOUT 0x0C /* Receiver data TIMEOUT */ +/* Received CTS/RTS change of state */ +#define UART_IIR_CTSRTS 0x20 + +/* Receiver data TIMEOUT */ +#define UART_IIR_RDI_TIMEOUT 0x0C /* * These are the EXTENDED definitions for the Exar 654's Interrupt @@ -73,10 +70,6 @@ struct cls_uart_struct { #define UART_EXAR654_EFR_IXOFF 0x8 /* Transmit Xon1/Xoff1 */ #define UART_EXAR654_EFR_RTSDTR 0x40 /* Auto RTS/DTR Flow Control Enable */ #define UART_EXAR654_EFR_CTSDSR 0x80 /* Auto CTS/DSR Flow COntrol Enable */ - -#define UART_EXAR654_XOFF_DETECT 0x1 /* Indicates whether chip saw an incoming XOFF char */ -#define UART_EXAR654_XON_DETECT 0x2 /* Indicates whether chip saw an incoming XON char */ - #define UART_EXAR654_IER_XOFF 0x20 /* Xoff Interrupt Enable */ #define UART_EXAR654_IER_RTSDTR 0x40 /* Output Interrupt Enable */ #define UART_EXAR654_IER_CTSDSR 0x80 /* Input Interrupt Enable */ diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index f177d3a258c2..805dc617e3a7 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -11,22 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. - * */ @@ -37,7 +21,6 @@ #include <linux/sched.h> #include "dgnc_driver.h" #include "dgnc_pci.h" -#include "dpacompat.h" #include "dgnc_mgmt.h" #include "dgnc_tty.h" #include "dgnc_cls.h" @@ -60,7 +43,8 @@ static void dgnc_init_globals(void); static int dgnc_found_board(struct pci_dev *pdev, int id); static void dgnc_cleanup_board(struct dgnc_board *brd); static void dgnc_poll_handler(ulong dummy); -static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); +static int dgnc_init_one(struct pci_dev *pdev, + const struct pci_device_id *ent); static void dgnc_do_remap(struct dgnc_board *brd); /* @@ -92,8 +76,8 @@ static struct class *dgnc_class; * Poller stuff */ static DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */ -static ulong dgnc_poll_time; /* Time of next poll */ -static uint dgnc_poll_stop; /* Used to tell poller to stop */ +static ulong dgnc_poll_time; /* Time of next poll */ +static uint dgnc_poll_stop; /* Used to tell poller to stop */ static struct timer_list dgnc_poll_timer; @@ -139,14 +123,6 @@ static struct pci_driver dgnc_driver = { .id_table = dgnc_pci_tbl, }; - -char *dgnc_state_text[] = { - "Board Failed", - "Board Found", - "Board READY", -}; - - /************************************************************************ * * Driver load/unload functions @@ -214,7 +190,7 @@ static int __init dgnc_init_module(void) * If something went wrong in the scan, bail out of driver. */ if (rc < 0) { - /* Only unregister the pci driver if it was actually registered. */ + /* Only unregister if it was actually registered. */ if (dgnc_NumBoards) pci_unregister_driver(&dgnc_driver); else @@ -251,9 +227,9 @@ static int dgnc_start(void) * Register management/dpa devices */ rc = register_chrdev(0, "dgnc", &dgnc_BoardFops); - if (rc <= 0) { + if (rc < 0) { pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc); - return -ENXIO; + return rc; } dgnc_Major = rc; @@ -285,9 +261,7 @@ static int dgnc_start(void) /* Start the poller */ spin_lock_irqsave(&dgnc_poll_lock, flags); - init_timer(&dgnc_poll_timer); - dgnc_poll_timer.function = dgnc_poll_handler; - dgnc_poll_timer.data = 0; + setup_timer(&dgnc_poll_timer, dgnc_poll_handler, 0); dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick); dgnc_poll_timer.expires = dgnc_poll_time; spin_unlock_irqrestore(&dgnc_poll_lock, flags); @@ -364,7 +338,7 @@ static void dgnc_cleanup_board(struct dgnc_board *brd) spin_lock_irqsave(&dgnc_global_lock, flags); brd->msgbuf = NULL; - printk("%s", brd->msgbuf_head); + dev_dbg(&brd->pdev->dev, "%s\n", brd->msgbuf_head); kfree(brd->msgbuf_head); brd->msgbuf_head = NULL; spin_unlock_irqrestore(&dgnc_global_lock, flags); @@ -410,7 +384,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) return -ENOMEM; /* make a temporary message buffer for the boot messages */ - brd->msgbuf_head = kzalloc(sizeof(u8) * 8192, GFP_KERNEL); + brd->msgbuf_head = kcalloc(8192, sizeof(u8), GFP_KERNEL); brd->msgbuf = brd->msgbuf_head; if (!brd->msgbuf) { @@ -553,7 +527,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) if (brd->re_map_membase) { - /* After remap is complete, we need to read and store the dvid */ + /* Read and store the dvid after remapping */ brd->dvid = readb(brd->re_map_membase + 0x8D); /* Get and store the board VPD, if it exists */ @@ -574,29 +548,19 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) rc = dgnc_tty_register(brd); if (rc < 0) { - dgnc_tty_uninit(brd); pr_err(DRVSTR ": Can't register tty devices (%d)\n", rc); - brd->state = BOARD_FAILED; - brd->dpastatus = BD_NOFEP; goto failed; } rc = dgnc_finalize_board_init(brd); if (rc < 0) { pr_err(DRVSTR ": Can't finalize board init (%d)\n", rc); - brd->state = BOARD_FAILED; - brd->dpastatus = BD_NOFEP; - goto failed; } rc = dgnc_tty_init(brd); if (rc < 0) { - dgnc_tty_uninit(brd); pr_err(DRVSTR ": Can't init tty devices (%d)\n", rc); - brd->state = BOARD_FAILED; - brd->dpastatus = BD_NOFEP; - goto failed; } @@ -606,11 +570,13 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) dgnc_create_ports_sysfiles(brd); /* init our poll helper tasklet */ - tasklet_init(&brd->helper_tasklet, brd->bd_ops->tasklet, (unsigned long) brd); + tasklet_init(&brd->helper_tasklet, + brd->bd_ops->tasklet, + (unsigned long) brd); spin_lock_irqsave(&dgnc_global_lock, flags); brd->msgbuf = NULL; - printk("%s", brd->msgbuf_head); + dev_dbg(&brd->pdev->dev, "%s\n", brd->msgbuf_head); kfree(brd->msgbuf_head); brd->msgbuf_head = NULL; spin_unlock_irqrestore(&dgnc_global_lock, flags); @@ -628,6 +594,9 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) return 0; failed: + dgnc_tty_uninit(brd); + brd->state = BOARD_FAILED; + brd->dpastatus = BD_NOFEP; return -ENXIO; @@ -708,7 +677,7 @@ static void dgnc_poll_handler(ulong dummy) spin_lock_irqsave(&brd->bd_lock, flags); - /* If board is in a failed state, don't bother scheduling a tasklet */ + /* If board is in a failed state don't schedule a tasklet */ if (brd->state == BOARD_FAILED) { spin_unlock_irqrestore(&brd->bd_lock, flags); continue; @@ -729,11 +698,9 @@ static void dgnc_poll_handler(ulong dummy) new_time = dgnc_poll_time - jiffies; if ((ulong) new_time >= 2 * dgnc_poll_tick) - dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick); + dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick); - init_timer(&dgnc_poll_timer); - dgnc_poll_timer.function = dgnc_poll_handler; - dgnc_poll_timer.data = 0; + setup_timer(&dgnc_poll_timer, dgnc_poll_handler, 0); dgnc_poll_timer.expires = dgnc_poll_time; spin_unlock_irqrestore(&dgnc_poll_lock, flags); diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index a8157eba28da..f77fed57b873 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -12,12 +12,6 @@ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! - * ************************************************************************* * * Driver includes @@ -31,9 +25,7 @@ #include <linux/tty.h> /* To pick up the various tty structs/defines */ #include <linux/interrupt.h> /* For irqreturn_t type */ -#include "dgnc_types.h" /* Additional types needed by the Digi header files */ #include "digi.h" /* Digi specific ioctl header */ -#include "dgnc_kcompat.h" /* Kernel 2.4/2.6 compat includes */ #include "dgnc_sysfs.h" /* Support for SYSFS */ /************************************************************************* @@ -46,6 +38,7 @@ #define PROCSTR "dgnc" /* /proc entries */ #define DEVSTR "/dev/dg/dgnc" /* /dev entries */ #define DRVSTR "dgnc" /* Driver name string */ +#define DG_PART "40002369_F" /* RPM part number */ #define TRC_TO_CONSOLE 1 @@ -211,8 +204,8 @@ struct dgnc_board { struct tty_driver PrintDriver; char PrintName[200]; - uint dgnc_Major_Serial_Registered; - uint dgnc_Major_TransparentPrint_Registered; + bool dgnc_Major_Serial_Registered; + bool dgnc_Major_TransparentPrint_Registered; uint dgnc_Serial_Major; uint dgnc_TransparentPrint_Major; @@ -398,11 +391,10 @@ struct channel_t { /* * Our Global Variables. */ -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 uint dgnc_NumBoards; /* Total number of boards */ -extern struct dgnc_board *dgnc_Board[MAXBOARDS]; /* Array of board structs */ -extern char *dgnc_state_text[]; /* Array of state text */ +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 uint dgnc_NumBoards; /* Total number of boards */ +extern struct dgnc_board *dgnc_Board[MAXBOARDS]; /* Array of board structs */ #endif diff --git a/drivers/staging/dgnc/dgnc_kcompat.h b/drivers/staging/dgnc/dgnc_kcompat.h deleted file mode 100644 index 566cad0d33e7..000000000000 --- a/drivers/staging/dgnc/dgnc_kcompat.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2004 Digi International (www.digi.com) - * Scott H Kilau <Scott_Kilau at digi dot com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! - * - ************************************************************************* - * - * This file is intended to contain all the kernel "differences" between the - * various kernels that we support. - * - *************************************************************************/ - -#ifndef __DGNC_KCOMPAT_H -#define __DGNC_KCOMPAT_H - -#if !defined(TTY_FLIPBUF_SIZE) -# define TTY_FLIPBUF_SIZE 512 -#endif - - -/* Sparse stuff */ -# ifndef __user -# define __user -# define __kernel -# define __safe -# define __force -# define __chk_user_ptr(x) (void)0 -# endif - - -#endif /* ! __DGNC_KCOMPAT_H */ diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c index 5544a8e7f4bc..b13318a82fe1 100644 --- a/drivers/staging/dgnc/dgnc_mgmt.c +++ b/drivers/staging/dgnc/dgnc_mgmt.c @@ -11,22 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. - * */ /************************************************************************ @@ -46,9 +30,7 @@ #include "dgnc_driver.h" #include "dgnc_pci.h" -#include "dgnc_kcompat.h" /* Kernel 2.4/2.6 compat includes */ #include "dgnc_mgmt.h" -#include "dpacompat.h" /* Our "in use" variables, to enforce 1 open only */ @@ -153,8 +135,7 @@ 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) || - (dgnc_NumBoards == 0)) + if (brd < 0 || brd >= dgnc_NumBoards) return -ENODEV; memset(&di, 0, sizeof(di)); @@ -196,11 +177,11 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) channel = ni.channel; /* Verify boundaries on board */ - if ((board > dgnc_NumBoards) || (dgnc_NumBoards == 0)) + if (board >= dgnc_NumBoards) return -ENODEV; /* Verify boundaries on channel */ - if ((channel < 0) || (channel > dgnc_Board[board]->nasync)) + if (channel >= dgnc_Board[board]->nasync) return -ENODEV; ch = dgnc_Board[board]->channels[channel]; diff --git a/drivers/staging/dgnc/dgnc_mgmt.h b/drivers/staging/dgnc/dgnc_mgmt.h index 567f687b18dd..708abe9594d4 100644 --- a/drivers/staging/dgnc/dgnc_mgmt.h +++ b/drivers/staging/dgnc/dgnc_mgmt.h @@ -11,12 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ #ifndef __DGNC_MGMT_H diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index c9a8a9825cfb..f5a4d365115f 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -11,22 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. - * */ @@ -119,7 +103,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch) /* Turn on auto CTS flow control */ #if 1 - ier |= (UART_17158_IER_CTSDSR); + ier |= UART_17158_IER_CTSDSR; #else ier &= ~(UART_17158_IER_CTSDSR); #endif @@ -127,7 +111,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch) efr |= (UART_17158_EFR_ECB | UART_17158_EFR_CTSDSR); /* Turn off auto Xon flow control */ - efr &= ~(UART_17158_EFR_IXON); + efr &= ~UART_17158_EFR_IXON; /* Why? Becuz Exar's spec says we have to zero it out before setting it */ writeb(0, &ch->ch_neo_uart->efr); @@ -155,15 +139,15 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch) /* Turn on auto RTS flow control */ #if 1 - ier |= (UART_17158_IER_RTSDTR); + ier |= UART_17158_IER_RTSDTR; #else ier &= ~(UART_17158_IER_RTSDTR); #endif efr |= (UART_17158_EFR_ECB | UART_17158_EFR_RTSDTR); /* Turn off auto Xoff flow control */ - ier &= ~(UART_17158_IER_XOFF); - efr &= ~(UART_17158_EFR_IXOFF); + 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 */ writeb(0, &ch->ch_neo_uart->efr); @@ -185,7 +169,7 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch) * RTS/DTR# output pin (MCR bit-0 or 1 to logic 1 after * it is enabled. */ - ch->ch_mostat |= (UART_MCR_RTS); + ch->ch_mostat |= UART_MCR_RTS; neo_pci_posting_flush(ch->ch_bd); } @@ -197,8 +181,8 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch) unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto CTS flow control */ - ier &= ~(UART_17158_IER_CTSDSR); - efr &= ~(UART_17158_EFR_CTSDSR); + ier &= ~UART_17158_IER_CTSDSR; + efr &= ~UART_17158_EFR_CTSDSR; /* Turn on auto Xon flow control */ efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXON); @@ -234,11 +218,11 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch) unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto RTS flow control */ - ier &= ~(UART_17158_IER_RTSDTR); - efr &= ~(UART_17158_EFR_RTSDTR); + ier &= ~UART_17158_IER_RTSDTR; + efr &= ~UART_17158_EFR_RTSDTR; /* Turn on auto Xoff flow control */ - ier |= (UART_17158_IER_XOFF); + 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 */ @@ -272,11 +256,11 @@ static inline void neo_set_no_input_flow_control(struct channel_t *ch) unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto RTS flow control */ - ier &= ~(UART_17158_IER_RTSDTR); - efr &= ~(UART_17158_EFR_RTSDTR); + ier &= ~UART_17158_IER_RTSDTR; + efr &= ~UART_17158_EFR_RTSDTR; /* Turn off auto Xoff flow control */ - ier &= ~(UART_17158_IER_XOFF); + ier &= ~UART_17158_IER_XOFF; if (ch->ch_c_iflag & IXON) efr &= ~(UART_17158_EFR_IXOFF); else @@ -312,12 +296,12 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch) unsigned char efr = readb(&ch->ch_neo_uart->efr); /* Turn off auto CTS flow control */ - ier &= ~(UART_17158_IER_CTSDSR); - efr &= ~(UART_17158_EFR_CTSDSR); + ier &= ~UART_17158_IER_CTSDSR; + efr &= ~UART_17158_EFR_CTSDSR; /* Turn off auto Xon flow control */ if (ch->ch_c_iflag & IXOFF) - efr &= ~(UART_17158_EFR_IXON); + efr &= ~UART_17158_EFR_IXON; else efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXON); @@ -407,7 +391,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port) if (!brd || brd->magic != DGNC_BOARD_MAGIC) return; - if (port > brd->maxports) + if (port >= brd->maxports) return; ch = brd->channels[port]; @@ -537,7 +521,7 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port) if (!brd || brd->magic != DGNC_BOARD_MAGIC) return; - if (port > brd->maxports) + if (port >= brd->maxports) return; ch = brd->channels[port]; @@ -1019,7 +1003,7 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) */ /* Verify the port is in range. */ - if (port > brd->nasync) + if (port >= brd->nasync) continue; ch = brd->channels[port]; @@ -1203,7 +1187,7 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch) * IBM pSeries platform. * 15 bytes max appears to be the magic number. */ - n = min((uint) n, (uint) 12); + n = min_t(uint, n, 12); /* * Since we are grabbing the linestatus register, which @@ -1436,16 +1420,13 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) spin_lock_irqsave(&ch->ch_lock, flags); /* No data to write to the UART */ - if (ch->ch_w_tail == ch->ch_w_head) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (ch->ch_w_tail == ch->ch_w_head) + goto exit_unlock; /* If port is "stopped", don't send any data to the UART */ - if ((ch->ch_flags & CH_FORCED_STOP) || (ch->ch_flags & CH_BREAK_SENDING)) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if ((ch->ch_flags & CH_FORCED_STOP) || + (ch->ch_flags & CH_BREAK_SENDING)) + goto exit_unlock; /* * If FIFOs are disabled. Send data directly to txrx register @@ -1486,27 +1467,23 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) ch->ch_w_tail &= WQUEUEMASK; ch->ch_txcount++; } - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; + + goto exit_unlock; } /* * We have to do it this way, because of the EXAR TXFIFO count bug. */ if ((ch->ch_bd->dvid & 0xf0) < UART_XR17E158_DVID) { - if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM))) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM))) + goto exit_unlock; len_written = 0; n = readb(&ch->ch_neo_uart->tfifo); - if ((unsigned int) n > ch->ch_t_tlevel) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if ((unsigned int) n > ch->ch_t_tlevel) + goto exit_unlock; n = UART_17158_TX_FIFOSIZE - ch->ch_t_tlevel; } else { @@ -1570,6 +1547,7 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) ch->ch_flags &= ~(CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); } +exit_unlock: spin_unlock_irqrestore(&ch->ch_lock, flags); } diff --git a/drivers/staging/dgnc/dgnc_neo.h b/drivers/staging/dgnc/dgnc_neo.h index 1a4abb128693..c528df5a0e5a 100644 --- a/drivers/staging/dgnc/dgnc_neo.h +++ b/drivers/staging/dgnc/dgnc_neo.h @@ -11,19 +11,11 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! - * */ #ifndef __DGNC_NEO_H #define __DGNC_NEO_H -#include "dgnc_types.h" #include "dgnc_driver.h" /************************************************************************ diff --git a/drivers/staging/dgnc/dgnc_pci.h b/drivers/staging/dgnc/dgnc_pci.h index 5b6f76d98aa7..617d40d1ec19 100644 --- a/drivers/staging/dgnc/dgnc_pci.h +++ b/drivers/staging/dgnc/dgnc_pci.h @@ -11,12 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ #ifndef __DGNC_PCI_H diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c index 2fd34ca70c59..65551d190515 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.c +++ b/drivers/staging/dgnc/dgnc_sysfs.c @@ -11,22 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. - * */ @@ -91,7 +75,7 @@ void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver) rc |= driver_create_file(driverfs, &driver_attr_maxboards); rc |= driver_create_file(driverfs, &driver_attr_pollrate); if (rc) - printk(KERN_ERR "DGNC: sysfs driver_create_file failed!\n"); + pr_err("DGNC: sysfs driver_create_file failed!\n"); } @@ -360,7 +344,7 @@ void dgnc_create_ports_sysfiles(struct dgnc_board *bd) rc |= device_create_file(&(bd->pdev->dev), &dev_attr_vpd); rc |= device_create_file(&(bd->pdev->dev), &dev_attr_serial_number); if (rc) - printk(KERN_ERR "DGNC: sysfs device_create_file failed!\n"); + dev_err(&bd->pdev->dev, "dgnc: sysfs device_create_file failed!\n"); } diff --git a/drivers/staging/dgnc/dgnc_sysfs.h b/drivers/staging/dgnc/dgnc_sysfs.h index 68c0de5898a4..be0f90a6768b 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.h +++ b/drivers/staging/dgnc/dgnc_sysfs.h @@ -11,20 +11,13 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ #ifndef __DGNC_SYSFS_H #define __DGNC_SYSFS_H -#include "dgnc_driver.h" - #include <linux/device.h> +#include "dgnc_driver.h" struct dgnc_board; struct channel_t; @@ -44,6 +37,4 @@ extern int dgnc_tty_class_destroy(void); extern void dgnc_create_tty_sysfs(struct un_t *un, struct device *c); extern void dgnc_remove_tty_sysfs(struct device *c); - - #endif diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index f81a375f8bc1..ce4187f60cb4 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -11,21 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. */ /************************************************************************ @@ -44,6 +29,7 @@ #include <linux/ctype.h> #include <linux/tty.h> #include <linux/tty_flip.h> +#include <linux/types.h> #include <linux/serial_reg.h> #include <linux/slab.h> #include <linux/delay.h> /* For udelay */ @@ -51,10 +37,8 @@ #include <linux/pci.h> #include "dgnc_driver.h" #include "dgnc_tty.h" -#include "dgnc_types.h" #include "dgnc_neo.h" #include "dgnc_cls.h" -#include "dpacompat.h" #include "dgnc_sysfs.h" #include "dgnc_utils.h" @@ -236,7 +220,7 @@ int dgnc_tty_register(struct dgnc_board *brd) "Can't register tty device (%d)\n", rc); return rc; } - brd->dgnc_Major_Serial_Registered = TRUE; + brd->dgnc_Major_Serial_Registered = true; } /* @@ -286,7 +270,7 @@ int dgnc_tty_register(struct dgnc_board *brd) rc); return rc; } - brd->dgnc_Major_TransparentPrint_Registered = TRUE; + brd->dgnc_Major_TransparentPrint_Registered = true; } dgnc_BoardsByMajor[brd->SerialDriver.major] = brd; @@ -424,7 +408,7 @@ void dgnc_tty_uninit(struct dgnc_board *brd) tty_unregister_device(&brd->SerialDriver, i); } tty_unregister_driver(&brd->SerialDriver); - brd->dgnc_Major_Serial_Registered = FALSE; + brd->dgnc_Major_Serial_Registered = false; } if (brd->dgnc_Major_TransparentPrint_Registered) { @@ -435,7 +419,7 @@ void dgnc_tty_uninit(struct dgnc_board *brd) tty_unregister_device(&brd->PrintDriver, i); } tty_unregister_driver(&brd->PrintDriver); - brd->dgnc_Major_TransparentPrint_Registered = FALSE; + brd->dgnc_Major_TransparentPrint_Registered = false; } kfree(brd->SerialDriver.ttys); @@ -507,7 +491,7 @@ void dgnc_input(struct channel_t *ch) { struct dgnc_board *bd; struct tty_struct *tp; - struct tty_ldisc *ld; + struct tty_ldisc *ld = NULL; uint rmask; ushort head; ushort tail; @@ -539,10 +523,8 @@ void dgnc_input(struct channel_t *ch) tail = ch->ch_r_tail & rmask; data_len = (head - tail) & rmask; - if (data_len == 0) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (data_len == 0) + goto exit_unlock; /* * If the device is not open, or CREAD is off, @@ -556,17 +538,14 @@ void dgnc_input(struct channel_t *ch) /* Force queue flow control to be released, if needed */ dgnc_check_queue_flow_control(ch); - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; + goto exit_unlock; } /* * If we are throttled, simply don't read any data. */ - if (ch->ch_flags & CH_FORCED_STOPI) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (ch->ch_flags & CH_FORCED_STOPI) + goto exit_unlock; flip_len = TTY_FLIPBUF_SIZE; @@ -604,12 +583,8 @@ void dgnc_input(struct channel_t *ch) } } - if (len <= 0) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - if (ld) - tty_ldisc_deref(ld); - return; - } + if (len <= 0) + goto exit_unlock; /* * The tty layer in the kernel has changed in 2.6.16+. @@ -677,6 +652,12 @@ void dgnc_input(struct channel_t *ch) if (ld) tty_ldisc_deref(ld); + return; + +exit_unlock: + spin_unlock_irqrestore(&ch->ch_lock, flags); + if (ld) + tty_ldisc_deref(ld); } @@ -886,10 +867,6 @@ void dgnc_check_queue_flow_control(struct channel_t *ch) ch->ch_stops_sent++; } } - /* No FLOW */ - else { - /* Empty... Can't do anything about the impending overflow... */ - } } /* @@ -1064,7 +1041,7 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file) spin_lock_irqsave(&brd->bd_lock, flags); /* If opened device is greater than our number of ports, bail. */ - if (PORT_NUM(minor) > brd->nasync) { + if (PORT_NUM(minor) >= brd->nasync) { spin_unlock_irqrestore(&brd->bd_lock, flags); return -ENXIO; } @@ -1777,10 +1754,8 @@ static int dgnc_tty_write(struct tty_struct *tty, /* * Bail if no space left. */ - if (count <= 0) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return 0; - } + if (count <= 0) + goto exit_retry; /* * Output the printer ON string, if we are in terminal mode, but @@ -1807,10 +1782,8 @@ static int dgnc_tty_write(struct tty_struct *tty, /* * If there is nothing left to copy, or I can't handle any more data, leave. */ - if (count <= 0) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return 0; - } + if (count <= 0) + goto exit_retry; if (from_user) { @@ -1896,6 +1869,11 @@ static int dgnc_tty_write(struct tty_struct *tty, } return count; + +exit_retry: + + spin_unlock_irqrestore(&ch->ch_lock, flags); + return 0; } diff --git a/drivers/staging/dgnc/dgnc_tty.h b/drivers/staging/dgnc/dgnc_tty.h index 3975f0407143..21d3369b875c 100644 --- a/drivers/staging/dgnc/dgnc_tty.h +++ b/drivers/staging/dgnc/dgnc_tty.h @@ -11,12 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ #ifndef __DGNC_TTY_H diff --git a/drivers/staging/dgnc/dgnc_types.h b/drivers/staging/dgnc/dgnc_types.h deleted file mode 100644 index 3aafcedbb0d9..000000000000 --- a/drivers/staging/dgnc/dgnc_types.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2003 Digi International (www.digi.com) - * Scott H Kilau <Scott_Kilau at digi dot com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! - */ - -#ifndef __DGNC_TYPES_H -#define __DGNC_TYPES_H - -#ifndef TRUE -# define TRUE 1 -#endif - -#ifndef FALSE -# define FALSE 0 -#endif - -#endif diff --git a/drivers/staging/dgnc/dgnc_utils.c b/drivers/staging/dgnc/dgnc_utils.c index 80b51332292c..f76de82908d3 100644 --- a/drivers/staging/dgnc/dgnc_utils.c +++ b/drivers/staging/dgnc/dgnc_utils.c @@ -16,55 +16,3 @@ int dgnc_ms_sleep(ulong ms) schedule_timeout((ms * HZ) / 1000); return signal_pending(current); } - -/* - * dgnc_ioctl_name() : Returns a text version of each ioctl value. - */ -char *dgnc_ioctl_name(int cmd) -{ - switch (cmd) { - - case TCGETA: return "TCGETA"; - case TCGETS: return "TCGETS"; - case TCSETA: return "TCSETA"; - case TCSETS: return "TCSETS"; - case TCSETAW: return "TCSETAW"; - case TCSETSW: return "TCSETSW"; - case TCSETAF: return "TCSETAF"; - case TCSETSF: return "TCSETSF"; - case TCSBRK: return "TCSBRK"; - case TCXONC: return "TCXONC"; - case TCFLSH: return "TCFLSH"; - case TIOCGSID: return "TIOCGSID"; - - case TIOCGETD: return "TIOCGETD"; - case TIOCSETD: return "TIOCSETD"; - case TIOCGWINSZ: return "TIOCGWINSZ"; - case TIOCSWINSZ: return "TIOCSWINSZ"; - - case TIOCMGET: return "TIOCMGET"; - case TIOCMSET: return "TIOCMSET"; - case TIOCMBIS: return "TIOCMBIS"; - case TIOCMBIC: return "TIOCMBIC"; - - /* from digi.h */ - case DIGI_SETA: return "DIGI_SETA"; - case DIGI_SETAW: return "DIGI_SETAW"; - case DIGI_SETAF: return "DIGI_SETAF"; - case DIGI_SETFLOW: return "DIGI_SETFLOW"; - case DIGI_SETAFLOW: return "DIGI_SETAFLOW"; - case DIGI_GETFLOW: return "DIGI_GETFLOW"; - case DIGI_GETAFLOW: return "DIGI_GETAFLOW"; - case DIGI_GETA: return "DIGI_GETA"; - case DIGI_GEDELAY: return "DIGI_GEDELAY"; - case DIGI_SEDELAY: return "DIGI_SEDELAY"; - case DIGI_GETCUSTOMBAUD: return "DIGI_GETCUSTOMBAUD"; - case DIGI_SETCUSTOMBAUD: return "DIGI_SETCUSTOMBAUD"; - case TIOCMODG: return "TIOCMODG"; - case TIOCMODS: return "TIOCMODS"; - case TIOCSDTR: return "TIOCSDTR"; - case TIOCCDTR: return "TIOCCDTR"; - - default: return "unknown"; - } -} diff --git a/drivers/staging/dgnc/dgnc_utils.h b/drivers/staging/dgnc/dgnc_utils.h index cebf60163a26..1164c3a09c6b 100644 --- a/drivers/staging/dgnc/dgnc_utils.h +++ b/drivers/staging/dgnc/dgnc_utils.h @@ -2,6 +2,5 @@ #define __DGNC_UTILS_H int dgnc_ms_sleep(ulong ms); -char *dgnc_ioctl_name(int cmd); #endif diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h index d6e0b9f6b24a..d637a7802168 100644 --- a/drivers/staging/dgnc/digi.h +++ b/drivers/staging/dgnc/digi.h @@ -11,36 +11,11 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! */ #ifndef __DIGI_H #define __DIGI_H -/************************************************************************ - *** Definitions for Digi ditty(1) command. - ************************************************************************/ - - -/* - * Copyright (c) 1988-96 Digi International Inc., All Rights Reserved. - */ - -/************************************************************************ - * This module provides application access to special Digi - * serial line enhancements which are not standard UNIX(tm) features. - ************************************************************************/ - -#if !defined(TIOCMODG) - -#define TIOCMODG (('d'<<8) | 250) /* get modem ctrl state */ -#define TIOCMODS (('d'<<8) | 251) /* set modem ctrl state */ - #ifndef TIOCM_LE #define TIOCM_LE 0x01 /* line enable */ #define TIOCM_DTR 0x02 /* data terminal ready */ @@ -55,8 +30,6 @@ #define TIOCM_CD TIOCM_CAR /* carrier detect (alt) */ #endif -#endif - #if !defined(TIOCMSET) #define TIOCMSET (('d'<<8) | 252) /* set modem ctrl state */ #define TIOCMGET (('d'<<8) | 253) /* set modem ctrl state */ @@ -67,83 +40,24 @@ #define TIOCMBIS (('d'<<8) | 255) /* set modem ctrl state */ #endif - -#if !defined(TIOCSDTR) -#define TIOCSDTR (('e'<<8) | 0) /* set DTR */ -#define TIOCCDTR (('e'<<8) | 1) /* clear DTR */ -#endif - -/************************************************************************ - * Ioctl command arguments for DIGI parameters. - ************************************************************************/ #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_KME (('e'<<8) | 98) /* Read/Write Host */ - /* Adapter Memory */ - -#define DIGI_GETFLOW (('e'<<8) | 99) /* Get startc/stopc flow */ - /* control characters */ -#define DIGI_SETFLOW (('e'<<8) | 100) /* Set startc/stopc flow */ - /* control characters */ -#define DIGI_GETAFLOW (('e'<<8) | 101) /* Get Aux. startc/stopc */ - /* flow control chars */ -#define DIGI_SETAFLOW (('e'<<8) | 102) /* Set Aux. startc/stopc */ - /* flow control chars */ - -#define DIGI_GEDELAY (('d'<<8) | 246) /* Get edelay */ -#define DIGI_SEDELAY (('d'<<8) | 247) /* Set edelay */ - -struct digiflow_t { - unsigned char startc; /* flow cntl start char */ - unsigned char stopc; /* flow cntl stop char */ -}; - - -#ifdef FLOW_2200 -#define F2200_GETA (('e'<<8) | 104) /* Get 2x36 flow cntl flags */ -#define F2200_SETAW (('e'<<8) | 105) /* Set 2x36 flow cntl flags */ -#define F2200_MASK 0x03 /* 2200 flow cntl bit mask */ -#define FCNTL_2200 0x01 /* 2x36 terminal flow cntl */ -#define PCNTL_2200 0x02 /* 2x36 printer flow cntl */ -#define F2200_XON 0xf8 -#define P2200_XON 0xf9 -#define F2200_XOFF 0xfa -#define P2200_XOFF 0xfb - -#define FXOFF_MASK 0x03 /* 2200 flow status mask */ -#define RCVD_FXOFF 0x01 /* 2x36 Terminal XOFF rcvd */ -#define RCVD_PXOFF 0x02 /* 2x36 Printer XOFF rcvd */ -#endif - -/************************************************************************ - * Values for digi_flags - ************************************************************************/ -#define DIGI_IXON 0x0001 /* Handle IXON in the FEP */ +#define DIGI_GET_NI_INFO (('d'<<8) | 250) /* Non-intelligent state info */ +#define DIGI_LOOPBACK (('d'<<8) | 252) /* + * Enable/disable UART + * internal loopback + */ #define DIGI_FAST 0x0002 /* Fast baud rates */ #define RTSPACE 0x0004 /* RTS input flow control */ #define CTSPACE 0x0008 /* CTS output flow control */ -#define DSRPACE 0x0010 /* DSR output flow control */ -#define DCDPACE 0x0020 /* DCD output flow control */ -#define DTRPACE 0x0040 /* DTR input flow control */ #define DIGI_COOK 0x0080 /* Cooked processing done in FEP */ #define DIGI_FORCEDCD 0x0100 /* Force carrier */ #define DIGI_ALTPIN 0x0200 /* Alternate RJ-45 pin config */ -#define DIGI_AIXON 0x0400 /* Aux flow control in fep */ #define DIGI_PRINTER 0x0800 /* Hold port open for flow cntrl*/ -#define DIGI_PP_INPUT 0x1000 /* Change parallel port to input*/ #define DIGI_DTR_TOGGLE 0x2000 /* Support DTR Toggle */ -#define DIGI_422 0x4000 /* for 422/232 selectable panel */ #define DIGI_RTS_TOGGLE 0x8000 /* Support RTS Toggle */ - -/************************************************************************ - * These options are not supported on the comxi. - ************************************************************************/ -#define DIGI_COMXI (DIGI_FAST|DIGI_COOK|DSRPACE|DCDPACE|DTRPACE) - #define DIGI_PLEN 28 /* String length */ #define DIGI_TSIZ 10 /* Terminal string len */ @@ -163,76 +77,6 @@ struct digi_t { }; /************************************************************************ - * KME definitions and structures. - ************************************************************************/ -#define RW_IDLE 0 /* Operation complete */ -#define RW_READ 1 /* Read Concentrator Memory */ -#define RW_WRITE 2 /* Write Concentrator Memory */ - -struct rw_t { - unsigned char rw_req; /* Request type */ - unsigned char rw_board; /* Host Adapter board number */ - unsigned char rw_conc; /* Concentrator number */ - unsigned char rw_reserved; /* Reserved for expansion */ - unsigned int rw_addr; /* Address in concentrator */ - unsigned short rw_size; /* Read/write request length */ - unsigned char rw_data[128]; /* Data to read/write */ -}; - -/*********************************************************************** - * Shrink Buffer and Board Information definitions and structures. - - ************************************************************************/ - /* Board type return codes */ -#define PCXI_TYPE 1 /* Board type at the designated port is a PC/Xi */ -#define PCXM_TYPE 2 /* Board type at the designated port is a PC/Xm */ -#define PCXE_TYPE 3 /* Board type at the designated port is a PC/Xe */ -#define MCXI_TYPE 4 /* Board type at the designated port is a MC/Xi */ -#define COMXI_TYPE 5 /* Board type at the designated port is a COM/Xi */ - - /* Non-Zero Result codes. */ -#define RESULT_NOBDFND 1 /* A Digi product at that port is not config installed */ -#define RESULT_NODESCT 2 /* A memory descriptor was not obtainable */ -#define RESULT_NOOSSIG 3 /* FEP/OS signature was not detected on the board */ -#define RESULT_TOOSML 4 /* Too small an area to shrink. */ -#define RESULT_NOCHAN 5 /* Channel structure for the board was not found */ - -struct shrink_buf_struct { - unsigned int shrink_buf_vaddr; /* Virtual address of board */ - unsigned int shrink_buf_phys; /* Physical address of board */ - unsigned int shrink_buf_bseg; /* Amount of board memory */ - unsigned int shrink_buf_hseg; /* '186 Beginning of Dual-Port */ - - unsigned int shrink_buf_lseg; /* '186 Beginning of freed memory */ - unsigned int shrink_buf_mseg; /* Linear address from start of - dual-port were freed memory - begins, host viewpoint. */ - - unsigned int shrink_buf_bdparam; /* Parameter for xxmemon and - xxmemoff */ - - unsigned int shrink_buf_reserva; /* Reserved */ - unsigned int shrink_buf_reservb; /* Reserved */ - unsigned int shrink_buf_reservc; /* Reserved */ - unsigned int shrink_buf_reservd; /* Reserved */ - - unsigned char shrink_buf_result; /* Reason for call failing - Zero is Good return */ - unsigned char shrink_buf_init; /* Non-Zero if it caused an - xxinit call. */ - - unsigned char shrink_buf_anports; /* Number of async ports */ - unsigned char shrink_buf_snports; /* Number of sync ports */ - unsigned char shrink_buf_type; /* Board type 1 = PC/Xi, - 2 = PC/Xm, - 3 = PC/Xe - 4 = MC/Xi - 5 = COMX/i */ - unsigned char shrink_buf_card; /* Card number */ - -}; - -/************************************************************************ * Structure to get driver status information ************************************************************************/ struct digi_dinfo { @@ -263,52 +107,6 @@ struct digi_info { #define DIGI_GETBD (('d'<<8) | 249) /* get board info */ -struct digi_stat { - unsigned int info_chan; /* Channel number (0 based) */ - unsigned int info_brd; /* Board number (0 based) */ - unsigned int info_cflag; /* cflag for channel */ - unsigned int info_iflag; /* iflag for channel */ - unsigned int info_oflag; /* oflag for channel */ - unsigned int info_mstat; /* mstat for channel */ - unsigned int info_tx_data; /* tx_data for channel */ - unsigned int info_rx_data; /* rx_data for channel */ - unsigned int info_hflow; /* hflow for channel */ - unsigned int info_reserved[8]; /* for future expansion */ -}; - -#define DIGI_GETSTAT (('d'<<8) | 244) /* get board info */ -/************************************************************************ - * - * Structure used with ioctl commands for per-channel information - * - ************************************************************************/ -struct digi_ch { - unsigned int info_bdnum; /* Board number (0 based) */ - unsigned int info_channel; /* Channel index number */ - unsigned int info_ch_cflag; /* Channel cflag */ - unsigned int info_ch_iflag; /* Channel iflag */ - unsigned int info_ch_oflag; /* Channel oflag */ - unsigned int info_chsize; /* Channel structure size */ - unsigned int info_sleep_stat; /* sleep status */ - dev_t info_dev; /* device number */ - unsigned char info_initstate; /* Channel init state */ - unsigned char info_running; /* Channel running state */ - int reserved[8]; /* reserved for future use */ -}; - -/* -* This structure is used with the DIGI_FEPCMD ioctl to -* tell the driver which port to send the command for. -*/ -struct digi_cmd { - int cmd; - int word; - int ncmds; - int chan; /* channel index (zero based) */ - int bdid; /* board index (zero based) */ -}; - - struct digi_getbuffer /* Struct for holding buffer use counts */ { unsigned long tIn; @@ -328,63 +126,9 @@ struct digi_getcounter { unsigned long tbytes; /* number of bytes transmitted fully */ }; -/* -* info_sleep_stat defines -*/ -#define INFO_RUNWAIT 0x0001 -#define INFO_WOPEN 0x0002 -#define INFO_TTIOW 0x0004 -#define INFO_CH_RWAIT 0x0008 -#define INFO_CH_WEMPTY 0x0010 -#define INFO_CH_WLOW 0x0020 -#define INFO_XXBUF_BUSY 0x0040 - -#define DIGI_GETCH (('d'<<8) | 245) /* get board info */ - -/* Board type definitions */ - -#define SUBTYPE 0007 -#define T_PCXI 0000 -#define T_PCXM 0001 -#define T_PCXE 0002 -#define T_PCXR 0003 -#define T_SP 0004 -#define T_SP_PLUS 0005 -# define T_HERC 0000 -# define T_HOU 0001 -# define T_LON 0002 -# define T_CHA 0003 -#define FAMILY 0070 -#define T_COMXI 0000 -#define T_PCXX 0010 -#define T_CX 0020 -#define T_EPC 0030 -#define T_PCLITE 0040 -#define T_SPXX 0050 -#define T_AVXX 0060 -#define T_DXB 0070 -#define T_A2K_4_8 0070 -#define BUSTYPE 0700 -#define T_ISABUS 0000 -#define T_MCBUS 0100 -#define T_EISABUS 0200 -#define T_PCIBUS 0400 - /* Board State Definitions */ - #define BD_RUNNING 0x0 -#define BD_REASON 0x7f -#define BD_NOTFOUND 0x1 -#define BD_NOIOPORT 0x2 -#define BD_NOMEM 0x3 -#define BD_NOBIOS 0x4 #define BD_NOFEP 0x5 -#define BD_FAILED 0x6 -#define BD_ALLOCATED 0x7 -#define BD_TRIBOOT 0x8 -#define BD_BADKME 0x80 - -#define DIGI_SPOLL (('d'<<8) | 254) /* change poller rate */ #define DIGI_SETCUSTOMBAUD _IOW('e', 106, int) /* Set integer baud rate */ #define DIGI_GETCUSTOMBAUD _IOR('e', 107, int) /* Get integer baud rate */ @@ -396,20 +140,40 @@ struct digi_getcounter { #define EV_OPU 0x0001 /* !<Output paused by client */ #define EV_OPS 0x0002 /* !<Output paused by reqular sw flowctrl */ -#define EV_OPX 0x0004 /* !<Output paused by extra sw flowctrl */ -#define EV_OPH 0x0008 /* !<Output paused by hw flowctrl */ -#define EV_OPT 0x0800 /* !<Output paused for RTS Toggle predelay */ - #define EV_IPU 0x0010 /* !<Input paused unconditionally by user */ #define EV_IPS 0x0020 /* !<Input paused by high/low water marks */ -#define EV_IPA 0x0400 /* !<Input paused by pattern alarm module */ - #define EV_TXB 0x0040 /* !<Transmit break pending */ -#define EV_TXI 0x0080 /* !<Transmit immediate pending */ -#define EV_TXF 0x0100 /* !<Transmit flowctrl char pending */ -#define EV_RXB 0x0200 /* !<Break received */ -#define EV_OPALL 0x080f /* !<Output pause flags */ -#define EV_IPALL 0x0430 /* !<Input pause flags */ +/* + * This structure holds data needed for the intelligent <--> nonintelligent + * DPA translation + */ +struct ni_info { + int board; + int channel; + int dtr; + int rts; + int cts; + int dsr; + int ri; + int dcd; + int curtx; + int currx; + unsigned short iflag; + unsigned short oflag; + unsigned short cflag; + unsigned short lflag; + unsigned int mstat; + unsigned char hflow; + unsigned char xmit_stopped; + unsigned char recv_stopped; + unsigned int baud; +}; + +#define T_CLASSIC 0002 +#define T_PCIBUS 0400 +#define T_NEO_EXPRESS 0001 +#define T_NEO 0000 +#define TTY_FLIPBUF_SIZE 512 #endif /* DIGI_H */ diff --git a/drivers/staging/dgnc/dpacompat.h b/drivers/staging/dgnc/dpacompat.h deleted file mode 100644 index 33cb394524b8..000000000000 --- a/drivers/staging/dgnc/dpacompat.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2003 Digi International (www.digi.com) - * Scott H Kilau <Scott_Kilau at digi dot com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!! - */ - - -/* - * This structure holds data needed for the intelligent <--> nonintelligent - * DPA translation - */ -struct ni_info { - int board; - int channel; - int dtr; - int rts; - int cts; - int dsr; - int ri; - int dcd; - int curtx; - int currx; - unsigned short iflag; - unsigned short oflag; - unsigned short cflag; - unsigned short lflag; - - unsigned int mstat; - unsigned char hflow; - - unsigned char xmit_stopped; - unsigned char recv_stopped; - - unsigned int baud; -}; - -#define RW_READ 1 -#define RW_WRITE 2 -#define DIGI_KME (('e'<<8) | 98) /* Read/Write Host */ - -#define SUBTYPE 0007 -#define T_PCXI 0000 -#define T_PCXEM 0001 -#define T_PCXE 0002 -#define T_PCXR 0003 -#define T_SP 0004 -#define T_SP_PLUS 0005 - -#define T_HERC 0000 -#define T_HOU 0001 -#define T_LON 0002 -#define T_CHA 0003 - -#define T_NEO 0000 -#define T_NEO_EXPRESS 0001 -#define T_CLASSIC 0002 - -#define FAMILY 0070 -#define T_COMXI 0000 -#define T_NI 0000 -#define T_PCXX 0010 -#define T_CX 0020 -#define T_EPC 0030 -#define T_PCLITE 0040 -#define T_SPXX 0050 -#define T_AVXX 0060 -#define T_DXB 0070 -#define T_A2K_4_8 0070 - -#define BUSTYPE 0700 -#define T_ISABUS 0000 -#define T_MCBUS 0100 -#define T_EISABUS 0200 -#define T_PCIBUS 0400 - -/* Board State Definitions */ - -#define BD_RUNNING 0x0 -#define BD_REASON 0x7f -#define BD_NOTFOUND 0x1 -#define BD_NOIOPORT 0x2 -#define BD_NOMEM 0x3 -#define BD_NOBIOS 0x4 -#define BD_NOFEP 0x5 -#define BD_FAILED 0x6 -#define BD_ALLOCATED 0x7 -#define BD_TRIBOOT 0x8 -#define BD_BADKME 0x80 - -#define DIGI_AIXON 0x0400 /* Aux flow control in fep */ - -/* Ioctls needed for dpa operation */ - -#define DIGI_GETDD (('d'<<8) | 248) /* get driver info */ -#define DIGI_GETBD (('d'<<8) | 249) /* get board info */ -#define DIGI_GET_NI_INFO (('d'<<8) | 250) /* nonintelligent state snfo */ - -/* Other special ioctls */ -#define DIGI_TIMERIRQ (('d'<<8) | 251) /* Enable/disable RS_TIMER use */ -#define DIGI_LOOPBACK (('d'<<8) | 252) /* Enable/disable UART internal loopback */ |