From 940f3be4058e0aff0505fd6f68e29e547e10e552 Mon Sep 17 00:00:00 2001 From: Vasiliy Kulikov Date: Mon, 17 Jan 2011 13:08:52 +0300 Subject: [PATCH 01/76] tty: serial: bfin_sport_uart: fix signedness error sport->port.irq is unsigned, check for <0 doesn't make sense. Explicitly cast it to int to check for error. Signed-off-by: Vasiliy Kulikov Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/bfin_sport_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/bfin_sport_uart.c b/drivers/tty/serial/bfin_sport_uart.c index e95c524d9d18..c3ec0a61d859 100644 --- a/drivers/tty/serial/bfin_sport_uart.c +++ b/drivers/tty/serial/bfin_sport_uart.c @@ -788,7 +788,7 @@ static int __devinit sport_uart_probe(struct platform_device *pdev) sport->port.mapbase = res->start; sport->port.irq = platform_get_irq(pdev, 0); - if (sport->port.irq < 0) { + if ((int)sport->port.irq < 0) { dev_err(&pdev->dev, "No sport RX/TX IRQ specified\n"); ret = -ENOENT; goto out_error_unmap; From a5f4dbf0ae972510faca799a809d3771fab323b7 Mon Sep 17 00:00:00 2001 From: Feng Tang Date: Wed, 12 Jan 2011 15:03:42 +0800 Subject: [PATCH 02/76] serial: mfd: remove the timeout workaround for A0 This is kind of a revert for commit 669b7a0938e "hsu: add a periodic timer to check dma rx channel", which is a workaround for a bug in A0 stepping silicon, where a dma rx data timeout is missing for some case. Since new silicon has fixed it and the old version is phasing out, no need to carry on it any more. Signed-off-by: Feng Tang Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/mfd.c | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c index d40010a22ecd..776777462937 100644 --- a/drivers/tty/serial/mfd.c +++ b/drivers/tty/serial/mfd.c @@ -51,8 +51,6 @@ #define mfd_readl(obj, offset) readl(obj->reg + offset) #define mfd_writel(obj, offset, val) writel(val, obj->reg + offset) -#define HSU_DMA_TIMEOUT_CHECK_FREQ (HZ/10) - struct hsu_dma_buffer { u8 *buf; dma_addr_t dma_addr; @@ -65,7 +63,6 @@ struct hsu_dma_chan { enum dma_data_direction dirt; struct uart_hsu_port *uport; void __iomem *reg; - struct timer_list rx_timer; /* only needed by RX channel */ }; struct uart_hsu_port { @@ -355,8 +352,6 @@ void hsu_dma_start_rx_chan(struct hsu_dma_chan *rxc, struct hsu_dma_buffer *dbuf | (0x1 << 24) /* timeout bit, see HSU Errata 1 */ ); chan_writel(rxc, HSU_CH_CR, 0x3); - - mod_timer(&rxc->rx_timer, jiffies + HSU_DMA_TIMEOUT_CHECK_FREQ); } /* Protected by spin_lock_irqsave(port->lock) */ @@ -420,7 +415,6 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts) chan_writel(chan, HSU_CH_CR, 0x3); return; } - del_timer(&chan->rx_timer); dma_sync_single_for_cpu(port->dev, dbuf->dma_addr, dbuf->dma_size, DMA_FROM_DEVICE); @@ -448,8 +442,6 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts) tty_flip_buffer_push(tty); chan_writel(chan, HSU_CH_CR, 0x3); - chan->rx_timer.expires = jiffies + HSU_DMA_TIMEOUT_CHECK_FREQ; - add_timer(&chan->rx_timer); } @@ -870,8 +862,6 @@ static void serial_hsu_shutdown(struct uart_port *port) container_of(port, struct uart_hsu_port, port); unsigned long flags; - del_timer_sync(&up->rxc->rx_timer); - /* Disable interrupts from this port */ up->ier = 0; serial_out(up, UART_IER, 0); @@ -1343,28 +1333,6 @@ err_disable: return ret; } -static void hsu_dma_rx_timeout(unsigned long data) -{ - struct hsu_dma_chan *chan = (void *)data; - struct uart_hsu_port *up = chan->uport; - struct hsu_dma_buffer *dbuf = &up->rxbuf; - int count = 0; - unsigned long flags; - - spin_lock_irqsave(&up->port.lock, flags); - - count = chan_readl(chan, HSU_CH_D0SAR) - dbuf->dma_addr; - - if (!count) { - mod_timer(&chan->rx_timer, jiffies + HSU_DMA_TIMEOUT_CHECK_FREQ); - goto exit; - } - - hsu_dma_rx(up, 0); -exit: - spin_unlock_irqrestore(&up->port.lock, flags); -} - static void hsu_global_init(void) { struct hsu_port *hsu; @@ -1427,12 +1395,6 @@ static void hsu_global_init(void) dchan->reg = hsu->reg + HSU_DMA_CHANS_REG_OFFSET + i * HSU_DMA_CHANS_REG_LENGTH; - /* Work around for RX */ - if (dchan->dirt == DMA_FROM_DEVICE) { - init_timer(&dchan->rx_timer); - dchan->rx_timer.function = hsu_dma_rx_timeout; - dchan->rx_timer.data = (unsigned long)dchan; - } dchan++; } From 2f1522eccb09188f0008168f75420bc2fedc9cae Mon Sep 17 00:00:00 2001 From: Russ Gorby Date: Wed, 2 Feb 2011 12:56:58 -0800 Subject: [PATCH 03/76] serial: ifx6x60: expanded info available from platform data Some platform attributes (e.g. max_hz, use_dma) were being intuited from the modem type. These things should be specified by the platform data. Added max_hz, use_dma to ifx_modem_platform_data definition, replaced is_6160 w/ modem_type, and changed clients accordingly Signed-off-by: Russ Gorby Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/ifx6x60.c | 33 +++++++++++++++++---------------- drivers/tty/serial/ifx6x60.h | 4 +++- include/linux/spi/ifx_modem.h | 19 ++++++++++++------- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index ab93763862d5..c42de7152eea 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c @@ -8,7 +8,7 @@ * Jan Dumon * * Copyright (C) 2009, 2010 Intel Corp - * Russ Gorby + * Russ Gorby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -732,7 +732,7 @@ static void ifx_spi_io(unsigned long data) /* * setup dma pointers */ - if (ifx_dev->is_6160) { + if (ifx_dev->use_dma) { ifx_dev->spi_msg.is_dma_mapped = 1; ifx_dev->tx_dma = ifx_dev->tx_bus; ifx_dev->rx_dma = ifx_dev->rx_bus; @@ -960,7 +960,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi) { int ret; int srdy; - struct ifx_modem_platform_data *pl_data = NULL; + struct ifx_modem_platform_data *pl_data; struct ifx_spi_device *ifx_dev; if (saved_ifx_dev) { @@ -968,6 +968,12 @@ static int ifx_spi_spi_probe(struct spi_device *spi) return -ENODEV; } + pl_data = (struct ifx_modem_platform_data *)spi->dev.platform_data; + if (!pl_data) { + dev_err(&spi->dev, "missing platform data!"); + return -ENODEV; + } + /* initialize structure to hold our device variables */ ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL); if (!ifx_dev) { @@ -983,7 +989,9 @@ static int ifx_spi_spi_probe(struct spi_device *spi) init_timer(&ifx_dev->spi_timer); ifx_dev->spi_timer.function = ifx_spi_timeout; ifx_dev->spi_timer.data = (unsigned long)ifx_dev; - ifx_dev->is_6160 = pl_data->is_6160; + ifx_dev->modem = pl_data->modem_type; + ifx_dev->use_dma = pl_data->use_dma; + ifx_dev->max_hz = pl_data->max_hz; /* ensure SPI protocol flags are initialized to enable transfer */ ifx_dev->spi_more = 0; @@ -1025,18 +1033,11 @@ static int ifx_spi_spi_probe(struct spi_device *spi) goto error_ret; } - pl_data = (struct ifx_modem_platform_data *)spi->dev.platform_data; - if (pl_data) { - ifx_dev->gpio.reset = pl_data->rst_pmu; - ifx_dev->gpio.po = pl_data->pwr_on; - ifx_dev->gpio.mrdy = pl_data->mrdy; - ifx_dev->gpio.srdy = pl_data->srdy; - ifx_dev->gpio.reset_out = pl_data->rst_out; - } else { - dev_err(&spi->dev, "missing platform data!"); - ret = -ENODEV; - goto error_ret; - } + ifx_dev->gpio.reset = pl_data->rst_pmu; + ifx_dev->gpio.po = pl_data->pwr_on; + ifx_dev->gpio.mrdy = pl_data->mrdy; + ifx_dev->gpio.srdy = pl_data->srdy; + ifx_dev->gpio.reset_out = pl_data->rst_out; dev_info(&spi->dev, "gpios %d, %d, %d, %d, %d", ifx_dev->gpio.reset, ifx_dev->gpio.po, ifx_dev->gpio.mrdy, diff --git a/drivers/tty/serial/ifx6x60.h b/drivers/tty/serial/ifx6x60.h index deb7b8d977dc..0ec39b58ccc4 100644 --- a/drivers/tty/serial/ifx6x60.h +++ b/drivers/tty/serial/ifx6x60.h @@ -88,7 +88,9 @@ struct ifx_spi_device { dma_addr_t rx_dma; dma_addr_t tx_dma; - int is_6160; /* Modem type */ + int modem; /* Modem type */ + int use_dma; /* provide dma-able addrs in SPI msg */ + long max_hz; /* max SPI frequency */ spinlock_t write_lock; int write_pending; diff --git a/include/linux/spi/ifx_modem.h b/include/linux/spi/ifx_modem.h index a68f3b19d112..394fec9e7722 100644 --- a/include/linux/spi/ifx_modem.h +++ b/include/linux/spi/ifx_modem.h @@ -2,13 +2,18 @@ #define LINUX_IFX_MODEM_H struct ifx_modem_platform_data { - unsigned short rst_out; /* modem reset out */ - unsigned short pwr_on; /* power on */ - unsigned short rst_pmu; /* reset modem */ - unsigned short tx_pwr; /* modem power threshold */ - unsigned short srdy; /* SRDY */ - unsigned short mrdy; /* MRDY */ - unsigned short is_6160; /* Modem type */ + unsigned short rst_out; /* modem reset out */ + unsigned short pwr_on; /* power on */ + unsigned short rst_pmu; /* reset modem */ + unsigned short tx_pwr; /* modem power threshold */ + unsigned short srdy; /* SRDY */ + unsigned short mrdy; /* MRDY */ + unsigned char modem_type; /* Modem type */ + unsigned long max_hz; /* max SPI frequency */ + unsigned short use_dma:1; /* spi protocol driver supplies + dma-able addrs */ }; +#define IFX_MODEM_6160 1 +#define IFX_MODEM_6260 2 #endif From 364a6ece62455f669336e50d5b00f14ba650da93 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Tue, 1 Feb 2011 08:30:41 +0100 Subject: [PATCH 04/76] OMAP: Enable Magic SysRq on serial console ttyOx Magic SysRq key is not working for OMAP on new serial console ttyOx because SUPPORT_SYSRQ is not defined for omap-serial. This patch defines SUPPORT_SYSRQ in omap-serial and enables handling of Magic SysRq character. Further there is an issue of losing first break character. Removing the reset of the lsr_break_flag fixes this issue. Signed-off-by: Thomas Weber Acked-by: Govindraj.R Tested-by: Manjunath G Kondaiah Acked-by: Kevin Hilman Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/omap-serial.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 7f2f01058789..699b34446a55 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -20,6 +20,10 @@ * this driver as required for the omap-platform. */ +#if defined(CONFIG_SERIAL_OMAP_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +#define SUPPORT_SYSRQ +#endif + #include #include #include @@ -190,7 +194,6 @@ static inline void receive_chars(struct uart_omap_port *up, int *status) if (up->port.line == up->port.cons->index) { /* Recover the break flag from console xmit */ lsr |= up->lsr_break_flag; - up->lsr_break_flag = 0; } #endif if (lsr & UART_LSR_BI) From 78841462d72fe7038cb7ea48adecc6fc395f2dc5 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Mon, 24 Jan 2011 17:51:22 +0200 Subject: [PATCH 05/76] serial: omap-serial: Enable the UART wake-up bits always OMAP can do also dynamic idling so wake-up enable register should be set also while system is running. If UART_OMAP_WER is not set, then for instance the RX activity cannot wake up the UART port that is sleeping. This RX wake-up feature was working when the 8250 driver was used instead of omap-serial. Reason for this is that the 8250 doesn't set the UART_OMAP_WER and then arch/arm/mach-omap2/pm34xx.c ends up saving and restoring the reset default which is the same than value OMAP_UART_WER_MOD_WKUP here. Fix this by moving the conditional UART_OMAP_WER write from serial_omap_pm into serial_omap_startup where wake-up bits are set unconditionally. Signed-off-by: Jarkko Nikula Cc: Govindraj.R Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/omap-serial.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 699b34446a55..763537943a53 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -520,6 +520,9 @@ static int serial_omap_startup(struct uart_port *port) up->ier = UART_IER_RLSI | UART_IER_RDI; serial_out(up, UART_IER, up->ier); + /* Enable module level wake up */ + serial_out(up, UART_OMAP_WER, OMAP_UART_WER_MOD_WKUP); + up->port_activity = jiffies; return 0; } @@ -827,9 +830,6 @@ serial_omap_pm(struct uart_port *port, unsigned int state, serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); serial_out(up, UART_EFR, efr); serial_out(up, UART_LCR, 0); - /* Enable module level wake up */ - serial_out(up, UART_OMAP_WER, - (state != 0) ? OMAP_UART_WER_MOD_WKUP : 0); } static void serial_omap_release_port(struct uart_port *port) From 0a1f1a0b626d79071ee9fe91b7fcd28be6332677 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Mon, 24 Jan 2011 17:54:12 +0100 Subject: [PATCH 06/76] tty_ldisc: don't use flush_scheduled_work() flush_scheduled_work() is scheduled to be deprecated. Explicitly sync flush the used work items instead. Note that before this change, flush_scheduled_work() wouldn't have properly flushed tty->buf.work if it were on timer. Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman --- drivers/tty/tty_ldisc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 4214d58276f7..c42f402db9ba 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -534,6 +534,19 @@ static int tty_ldisc_halt(struct tty_struct *tty) return cancel_delayed_work_sync(&tty->buf.work); } +/** + * tty_ldisc_flush_works - flush all works of a tty + * @tty: tty device to flush works for + * + * Sync flush all works belonging to @tty. + */ +static void tty_ldisc_flush_works(struct tty_struct *tty) +{ + flush_work_sync(&tty->hangup_work); + flush_work_sync(&tty->SAK_work); + flush_delayed_work_sync(&tty->buf.work); +} + /** * tty_ldisc_wait_idle - wait for the ldisc to become idle * @tty: tty to wait for @@ -653,7 +666,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) mutex_unlock(&tty->ldisc_mutex); - flush_scheduled_work(); + tty_ldisc_flush_works(tty); retval = tty_ldisc_wait_idle(tty); @@ -905,7 +918,7 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty) tty_unlock(); tty_ldisc_halt(tty); - flush_scheduled_work(); + tty_ldisc_flush_works(tty); tty_lock(); mutex_lock(&tty->ldisc_mutex); From d8653d305ef66861c91fa7455fb8038460a7274c Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 25 Jan 2011 14:15:11 +0000 Subject: [PATCH 07/76] serial: mrst_max3110: make buffer larger This is used to store the spi_device ->modalias so they have to be the same size. SPI_NAME_SIZE is 32. Signed-off-by: Dan Carpenter Signed-off-by: Alan Cox Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/mrst_max3110.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c index b62857bf2fdb..37e13c3d91d9 100644 --- a/drivers/tty/serial/mrst_max3110.c +++ b/drivers/tty/serial/mrst_max3110.c @@ -51,7 +51,7 @@ struct uart_max3110 { struct uart_port port; struct spi_device *spi; - char name[24]; + char name[SPI_NAME_SIZE]; wait_queue_head_t wq; struct task_struct *main_thread; From 5933a161abcb8d83a2c145177f48027c3c0a8995 Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Sun, 30 Jan 2011 11:15:30 +0800 Subject: [PATCH 08/76] serial-core: reset the console speed on resume On some platforms, we need to restore the console speed on resume even it was not suspended (no_console_suspend), and on others we don't have to do that. So don't care about the "console_suspend_enabled" and unconditionally reset the console speed if it is a console. This is actually a redo of ba15ab0 (Set proper console speed on resume if console suspend is disabled) from Deepak Saxena. I also tried to investigate more to find out if this change will break others, here is what I've found out: commit 891b9dd10764352926e1e107756aa229dfa2c210 Author: Jason Wang serial-core: restore termios settings when resume console ports commit ca2e71aa8cfb0056ce720f3fd53f59f5fac4a3e1 Author: Jason Wang serial-core: skip call set_termios/console_start when no_console_suspend commit 4547be7809a3b775ce750ec7f8b5748954741523 Author: Stanislav Brabec serial-core: resume serial hardware with no_console_suspend commit ba15ab0e8de0d4439a91342ad52d55ca9e313f3d Author: Deepak Saxena Set proper console speed on resume if console suspend is disabled from ba15ab0, we learned that, even if the console suspend is disabled (when no_console_suspend is set), we may still need to "reset the port to the state it was in before we suspended." Then with 4547be7, this piece of code is removed. And then Jason Wang added that back in ca2e71a and 891b9dd, to fix some breakage on OMAP3EVM platform. From ca2e71a we learned that the "set_termios" things is actually needed by both console is suspended and not suspended. That's why I removed the console_suspended_enabled condition, and only call console_start() when we actually suspeneded it. I also noticed in this thread: http://marc.info/?t=129079257100004&r=1&w=2, which talked about on some platforms, UART HW will be cut power whether or not we set no_console_suspend, and then on resume it does not work quite well. I have a similar HW, and this patch fixed this issue, don't know if this patch also works on their platforms. [Update: Stanislav tested this patch on Zaurus and reported it improves the situation. Thanks.] CC: Greg KH CC: Deepak Saxena CC: Jason Wang CC: Stanislav Brabec CC: Daniel Drake Signed-off-by: Yin Kangkai Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/serial_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 460a72d91bb7..20563c509b21 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2064,7 +2064,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) /* * Re-enable the console device after suspending. */ - if (console_suspend_enabled && uart_console(uport)) { + if (uart_console(uport)) { /* * First try to use the console cflag setting. */ @@ -2077,9 +2077,9 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) if (port->tty && port->tty->termios && termios.c_cflag == 0) termios = *(port->tty->termios); - uart_change_pm(state, 0); uport->ops->set_termios(uport, &termios, NULL); - console_start(uport->cons); + if (console_suspend_enabled) + console_start(uport->cons); } if (port->flags & ASYNC_SUSPENDED) { From f094298bae5f5d0e1cb3bff4621aae7ef486812a Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Mon, 24 Jan 2011 17:53:41 +0100 Subject: [PATCH 09/76] 68328serial: remove unsed m68k_serial->tqueue_hangup m68k_serial->tqueue_hangup is unused. Remove it. Signed-off-by: Tejun Heo Cc: Greg Ungerer Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/68328serial.c | 23 ----------------------- drivers/tty/serial/68328serial.h | 1 - 2 files changed, 24 deletions(-) diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c index be0ebce36e54..a9d99856c892 100644 --- a/drivers/tty/serial/68328serial.c +++ b/drivers/tty/serial/68328serial.c @@ -393,28 +393,6 @@ static void do_softint(struct work_struct *work) #endif } -/* - * This routine is called from the scheduler tqueue when the interrupt - * routine has signalled that a hangup has occurred. The path of - * hangup processing is: - * - * serial interrupt routine -> (scheduler tqueue) -> - * do_serial_hangup() -> tty->hangup() -> rs_hangup() - * - */ -static void do_serial_hangup(struct work_struct *work) -{ - struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue_hangup); - struct tty_struct *tty; - - tty = info->port.tty; - if (!tty) - return; - - tty_hangup(tty); -} - - static int startup(struct m68k_serial * info) { m68328_uart *uart = &uart_addr[info->line]; @@ -1348,7 +1326,6 @@ rs68328_init(void) info->count = 0; info->blocked_open = 0; INIT_WORK(&info->tqueue, do_softint); - INIT_WORK(&info->tqueue_hangup, do_serial_hangup); init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); info->line = i; diff --git a/drivers/tty/serial/68328serial.h b/drivers/tty/serial/68328serial.h index 664ceb0a158c..8c9c3c0745db 100644 --- a/drivers/tty/serial/68328serial.h +++ b/drivers/tty/serial/68328serial.h @@ -159,7 +159,6 @@ struct m68k_serial { int xmit_tail; int xmit_cnt; struct work_struct tqueue; - struct work_struct tqueue_hangup; wait_queue_head_t open_wait; wait_queue_head_t close_wait; }; From 4564e1ef219fa69ed827fe2613569543a6b26fbc Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Fri, 28 Jan 2011 18:00:01 +0900 Subject: [PATCH 10/76] serial: pch_uart: support new device ML7213 Support ML7213 device of OKI SEMICONDUCTOR. ML7213 is companion chip of Intel Atom E6xx series for IVI(In-Vehicle Infotainment). ML7213 is completely compatible for Intel EG20T PCH. Signed-off-by: Tomoya MORINAGA Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/Kconfig | 5 +++++ drivers/tty/serial/pch_uart.c | 27 +++++++++++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 2b8334601c8b..86e2c994d440 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1596,4 +1596,9 @@ config SERIAL_PCH_UART This driver is for PCH(Platform controller Hub) UART of Intel EG20T which is an IOH(Input/Output Hub) for x86 embedded processor. Enabling PCH_DMA, this PCH UART works as DMA mode. + + This driver also can be used for OKI SEMICONDUCTOR ML7213 IOH(Input/ + Output Hub) which is for IVI(In-Vehicle Infotainment) use. + ML7213 is companion chip for Intel Atom E6xx series. + ML7213 is completely compatible for Intel EG20T PCH. endmenu diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 70a61458ec42..3b2fb93e1fa1 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -40,10 +40,11 @@ enum { #define PCH_UART_DRIVER_DEVICE "ttyPCH" -#define PCH_UART_NR_GE_256FIFO 1 -#define PCH_UART_NR_GE_64FIFO 3 -#define PCH_UART_NR_GE (PCH_UART_NR_GE_256FIFO+PCH_UART_NR_GE_64FIFO) -#define PCH_UART_NR PCH_UART_NR_GE +/* Set the max number of UART port + * Intel EG20T PCH: 4 port + * OKI SEMICONDUCTOR ML7213 IOH: 3 port +*/ +#define PCH_UART_NR 4 #define PCH_UART_HANDLED_RX_INT (1<<((PCH_UART_HANDLED_RX_INT_SHIFT)<<1)) #define PCH_UART_HANDLED_TX_INT (1<<((PCH_UART_HANDLED_TX_INT_SHIFT)<<1)) @@ -192,6 +193,8 @@ enum { #define PCH_UART_HAL_LOOP (PCH_UART_MCR_LOOP) #define PCH_UART_HAL_AFE (PCH_UART_MCR_AFE) +#define PCI_VENDOR_ID_ROHM 0x10DB + struct pch_uart_buffer { unsigned char *buf; int size; @@ -1249,7 +1252,7 @@ static struct uart_driver pch_uart_driver = { }; static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, - int port_type) + const struct pci_device_id *id) { struct eg20t_port *priv; int ret; @@ -1258,6 +1261,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, unsigned char *rxbuf; int fifosize, base_baud; static int num; + int port_type = id->driver_data; priv = kzalloc(sizeof(struct eg20t_port), GFP_KERNEL); if (priv == NULL) @@ -1269,11 +1273,11 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, switch (port_type) { case PORT_UNKNOWN: - fifosize = 256; /* UART0 */ + fifosize = 256; /* EG20T/ML7213: UART0 */ base_baud = 1843200; /* 1.8432MHz */ break; case PORT_8250: - fifosize = 64; /* UART1~3 */ + fifosize = 64; /* EG20T:UART1~3 ML7213: UART1~2*/ base_baud = 1843200; /* 1.8432MHz */ break; default: @@ -1307,6 +1311,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, pci_set_drvdata(pdev, priv); pch_uart_hal_request(pdev, fifosize, base_baud); + ret = uart_add_one_port(&pch_uart_driver, &priv->port); if (ret < 0) goto init_port_hal_free; @@ -1384,6 +1389,12 @@ static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = { .driver_data = PCH_UART_2LINE}, {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8814), .driver_data = PCH_UART_2LINE}, + {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8027), + .driver_data = PCH_UART_8LINE}, + {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8028), + .driver_data = PCH_UART_2LINE}, + {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8029), + .driver_data = PCH_UART_2LINE}, {0,}, }; @@ -1397,7 +1408,7 @@ static int __devinit pch_uart_pci_probe(struct pci_dev *pdev, if (ret < 0) goto probe_error; - priv = pch_uart_init_port(pdev, id->driver_data); + priv = pch_uart_init_port(pdev, id); if (!priv) { ret = -EBUSY; goto probe_disable_device; From 380042f2db653b324ae756d102d872c1ecd412c5 Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Fri, 28 Jan 2011 18:00:02 +0900 Subject: [PATCH 11/76] serial: pch_uart: revert Kconfig for non-DMA mode PCH_DMA is not always enabled when a user uses PCH_UART. Since overhead of DMA is not small, in case of low frequent communication, without DMA is better. Thus, "select PCH_DMA" and DMADEVICES are unnecessary Signed-off-by: Tomoya MORINAGA Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/Kconfig | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 86e2c994d440..aaedbad93a75 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1588,10 +1588,9 @@ config SERIAL_IFX6X60 Support for the IFX6x60 modem devices on Intel MID platforms. config SERIAL_PCH_UART - tristate "Intel EG20T PCH UART" - depends on PCI && DMADEVICES + tristate "Intel EG20T PCH UART/OKI SEMICONDUCTOR ML7213 IOH" + depends on PCI select SERIAL_CORE - select PCH_DMA help This driver is for PCH(Platform controller Hub) UART of Intel EG20T which is an IOH(Input/Output Hub) for x86 embedded processor. From a99632014631409483a481a6a0d77d09ded47239 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Thu, 3 Feb 2011 15:48:34 -0800 Subject: [PATCH 12/76] hvc_dcc: Fix bad code generation by marking assembly volatile Without marking the asm __dcc_getstatus() volatile my compiler decides it can cache the value of __ret in a register and then check the value of it continually in hvc_dcc_put_chars() (I had to replace get_wait/put_wait with 1 and fixup the branch otherwise my disassembler barfed on __dcc_(get|put)char). 00000000 : 0: ee103e11 mrc 14, 0, r3, cr0, cr1, {0} 4: e3a0c000 mov ip, #0 ; 0x0 8: e2033202 and r3, r3, #536870912 ; 0x20000000 c: ea000006 b 2c 10: e3530000 cmp r3, #0 ; 0x0 14: 1afffffd bne 10 18: e7d1000c ldrb r0, [r1, ip] 1c: ee10fe11 mrc 14, 0, pc, cr0, cr1, {0} 20: 2afffffd bcs 1c 24: ee000e15 mcr 14, 0, r0, cr0, cr5, {0} 28: e28cc001 add ip, ip, #1 ; 0x1 2c: e15c0002 cmp ip, r2 30: bafffff6 blt 10 34: e1a00002 mov r0, r2 38: e12fff1e bx lr As you can see, the value of the mrc is checked against DCC_STATUS_TX (bit 29) and then stored in r3 for later use. Marking the asm volatile produces the following: 00000000 : 0: e3a03000 mov r3, #0 ; 0x0 4: ea000007 b 28 8: ee100e11 mrc 14, 0, r0, cr0, cr1, {0} c: e3100202 tst r0, #536870912 ; 0x20000000 10: 1afffffc bne 8 14: e7d10003 ldrb r0, [r1, r3] 18: ee10fe11 mrc 14, 0, pc, cr0, cr1, {0} 1c: 2afffffd bcs 18 20: ee000e15 mcr 14, 0, r0, cr0, cr5, {0} 24: e2833001 add r3, r3, #1 ; 0x1 28: e1530002 cmp r3, r2 2c: bafffff5 blt 8 30: e1a00002 mov r0, r2 34: e12fff1e bx lr which looks better and actually works. Mark all the inline assembly in this file as volatile since we don't want the compiler to optimize away these statements or move them around in any way. Acked-by: Tony Lindgren Cc: Arnd Bergmann Acked-by: Nicolas Pitre Cc: Daniel Walker Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/tty/hvc/hvc_dcc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c index 6470f63deb4b..155ec105e1c8 100644 --- a/drivers/tty/hvc/hvc_dcc.c +++ b/drivers/tty/hvc/hvc_dcc.c @@ -33,8 +33,7 @@ static inline u32 __dcc_getstatus(void) { u32 __ret; - - asm("mrc p14, 0, %0, c0, c1, 0 @ read comms ctrl reg" + asm volatile("mrc p14, 0, %0, c0, c1, 0 @ read comms ctrl reg" : "=r" (__ret) : : "cc"); return __ret; @@ -46,7 +45,7 @@ static inline char __dcc_getchar(void) { char __c; - asm("get_wait: mrc p14, 0, pc, c0, c1, 0 \n\ + asm volatile("get_wait: mrc p14, 0, pc, c0, c1, 0 \n\ bne get_wait \n\ mrc p14, 0, %0, c0, c5, 0 @ read comms data reg" : "=r" (__c) : : "cc"); @@ -58,7 +57,7 @@ static inline char __dcc_getchar(void) { char __c; - asm("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg" + asm volatile("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg" : "=r" (__c)); return __c; @@ -68,7 +67,7 @@ static inline char __dcc_getchar(void) #if defined(CONFIG_CPU_V7) static inline void __dcc_putchar(char c) { - asm("put_wait: mrc p14, 0, pc, c0, c1, 0 \n\ + asm volatile("put_wait: mrc p14, 0, pc, c0, c1, 0 \n\ bcs put_wait \n\ mcr p14, 0, %0, c0, c5, 0 " : : "r" (c) : "cc"); @@ -76,7 +75,7 @@ static inline void __dcc_putchar(char c) #else static inline void __dcc_putchar(char c) { - asm("mcr p14, 0, %0, c0, c5, 0 @ write a char" + asm volatile("mcr p14, 0, %0, c0, c5, 0 @ write a char" : /* no output register */ : "r" (c)); } From bf73bd35a296b31dace098b9104b6b593ee0070f Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Thu, 3 Feb 2011 15:48:35 -0800 Subject: [PATCH 13/76] hvc_dcc: Simplify put_chars()/get_chars() loops Casting and anding with 0xff is unnecessary in hvc_dcc_put_chars() since buf is already a char[]. __dcc_get_char() can't return an int less than 0 since it only returns a char. Simplify the if statement in hvc_dcc_get_chars() to take this into account. Cc: Daniel Walker Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/tty/hvc/hvc_dcc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c index 155ec105e1c8..ad23cc8082a0 100644 --- a/drivers/tty/hvc/hvc_dcc.c +++ b/drivers/tty/hvc/hvc_dcc.c @@ -89,7 +89,7 @@ static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count) while (__dcc_getstatus() & DCC_STATUS_TX) cpu_relax(); - __dcc_putchar((char)(buf[i] & 0xFF)); + __dcc_putchar(buf[i]); } return count; @@ -99,15 +99,11 @@ static int hvc_dcc_get_chars(uint32_t vt, char *buf, int count) { int i; - for (i = 0; i < count; ++i) { - int c = -1; - + for (i = 0; i < count; ++i) if (__dcc_getstatus() & DCC_STATUS_RX) - c = __dcc_getchar(); - if (c < 0) + buf[i] = __dcc_getchar(); + else break; - buf[i] = c; - } return i; } From 8e6d3fe1af38bea3f6c003f8737d2e3a02d00fa0 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Thu, 3 Feb 2011 15:48:36 -0800 Subject: [PATCH 14/76] hvc_dcc: Simplify assembly for v6 and v7 ARM The inline assembly differences for v6 vs. v7 in the hvc_dcc driver are purely optimizations. On a v7 processor, an mrc with the pc sets the condition codes to the 28-31 bits of the register being read. It just so happens that the TX/RX full bits the DCC driver is testing for are high enough in the register to be put into the condition codes. On a v6 processor, this "feature" isn't implemented and thus we have to do the usual read, mask, test operations to check for TX/RX full. Since we already test the RX/TX full bits before calling __dcc_getchar() and __dcc_putchar() we don't actually need to do anything special for v7 over v6. The only difference is in hvc_dcc_get_chars(). We would test RX full, poll RX full, and then read a character from the buffer, whereas now we will test RX full, read a character from the buffer, and then test RX full again for the second iteration of the loop. It doesn't seem possible for the buffer to go from full to empty between testing the RX full and reading a character. Therefore, replace the v7 versions with the v6 versions and everything works the same. Acked-by: Tony Lindgren Cc: Arnd Bergmann Acked-by: Nicolas Pitre Cc: Daniel Walker Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/tty/hvc/hvc_dcc.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c index ad23cc8082a0..435f6facbc23 100644 --- a/drivers/tty/hvc/hvc_dcc.c +++ b/drivers/tty/hvc/hvc_dcc.c @@ -40,19 +40,6 @@ static inline u32 __dcc_getstatus(void) } -#if defined(CONFIG_CPU_V7) -static inline char __dcc_getchar(void) -{ - char __c; - - asm volatile("get_wait: mrc p14, 0, pc, c0, c1, 0 \n\ - bne get_wait \n\ - mrc p14, 0, %0, c0, c5, 0 @ read comms data reg" - : "=r" (__c) : : "cc"); - - return __c; -} -#else static inline char __dcc_getchar(void) { char __c; @@ -62,24 +49,13 @@ static inline char __dcc_getchar(void) return __c; } -#endif -#if defined(CONFIG_CPU_V7) -static inline void __dcc_putchar(char c) -{ - asm volatile("put_wait: mrc p14, 0, pc, c0, c1, 0 \n\ - bcs put_wait \n\ - mcr p14, 0, %0, c0, c5, 0 " - : : "r" (c) : "cc"); -} -#else static inline void __dcc_putchar(char c) { asm volatile("mcr p14, 0, %0, c0, c5, 0 @ write a char" : /* no output register */ : "r" (c)); } -#endif static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count) { From 9fc3de9c83565fcaa23df74c2fc414bb6e7efb0a Mon Sep 17 00:00:00 2001 From: Arthur Taylor Date: Fri, 4 Feb 2011 13:55:50 -0800 Subject: [PATCH 15/76] vt: Add virtual console keyboard mode OFF virtual console: add keyboard mode OFF Add a new mode for the virtual console keyboard OFF in which all input other than shift keys is ignored. Prevents vt input buffers from overflowing when a program opens but doesn't read from a tty, like X11 using evdev for input. Signed-off-by: Arthur Taylor Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/keyboard.c | 5 +++-- drivers/tty/vt/vt_ioctl.c | 3 +++ include/linux/kbd_kern.h | 3 ++- include/linux/kd.h | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c index e95d7876ca6b..6dd3c68c13ad 100644 --- a/drivers/tty/vt/keyboard.c +++ b/drivers/tty/vt/keyboard.c @@ -654,7 +654,8 @@ static void k_spec(struct vc_data *vc, unsigned char value, char up_flag) if (value >= ARRAY_SIZE(fn_handler)) return; if ((kbd->kbdmode == VC_RAW || - kbd->kbdmode == VC_MEDIUMRAW) && + kbd->kbdmode == VC_MEDIUMRAW || + kbd->kbdmode == VC_OFF) && value != KVAL(K_SAK)) return; /* SAK is allowed even in raw mode */ fn_handler[value](vc); @@ -1295,7 +1296,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) if (rc == NOTIFY_STOP) return; - if (raw_mode && type != KT_SPEC && type != KT_SHIFT) + if ((raw_mode || kbd->kbdmode == VC_OFF) && type != KT_SPEC && type != KT_SHIFT) return; (*k_handler[type])(vc, keysym & 0xff, !down); diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 1235ebda6e1c..6bcf05bf4978 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -688,6 +688,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, kbd->kbdmode = VC_UNICODE; compute_shiftstate(); break; + case K_OFF: + kbd->kbdmode = VC_OFF; + break; default: ret = -EINVAL; goto out; diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h index 506ad20c18f8..4b0761cc7dd9 100644 --- a/include/linux/kbd_kern.h +++ b/include/linux/kbd_kern.h @@ -50,11 +50,12 @@ struct kbd_struct { #define VC_CAPSLOCK 2 /* capslock mode */ #define VC_KANALOCK 3 /* kanalock mode */ - unsigned char kbdmode:2; /* one 2-bit value */ + unsigned char kbdmode:3; /* one 3-bit value */ #define VC_XLATE 0 /* translate keycodes using keymap */ #define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */ #define VC_RAW 2 /* raw (scancode) mode */ #define VC_UNICODE 3 /* Unicode mode */ +#define VC_OFF 4 /* disabled mode */ unsigned char modeflags:5; #define VC_APPLIC 0 /* application key mode */ diff --git a/include/linux/kd.h b/include/linux/kd.h index 15f2853ea58f..c36d8476db55 100644 --- a/include/linux/kd.h +++ b/include/linux/kd.h @@ -81,6 +81,7 @@ struct unimapinit { #define K_XLATE 0x01 #define K_MEDIUMRAW 0x02 #define K_UNICODE 0x03 +#define K_OFF 0x04 #define KDGKBMODE 0x4B44 /* gets current keyboard mode */ #define KDSKBMODE 0x4B45 /* sets current keyboard mode */ From 5427bcf5e95245d3e220742ac703182bdb973769 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 4 Feb 2011 20:45:49 -0500 Subject: [PATCH 16/76] hvc: add Blackfin JTAG console support This converts the existing bfin_jtag_comm TTY driver to the HVC layer so that the common HVC code can worry about all of the TTY/polling crap and leave the Blackfin code to worry about the Blackfin bits. Signed-off-by: Mike Frysinger Signed-off-by: Greg Kroah-Hartman --- drivers/char/Kconfig | 9 +++ drivers/tty/hvc/Makefile | 1 + drivers/tty/hvc/hvc_bfin_jtag.c | 105 ++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 drivers/tty/hvc/hvc_bfin_jtag.c diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index b7980a83ce2d..17f9b968b988 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -691,6 +691,15 @@ config HVC_DCC driver. This console is used through a JTAG only on ARM. If you don't have a JTAG then you probably don't want this option. +config HVC_BFIN_JTAG + bool "Blackfin JTAG console" + depends on BLACKFIN + select HVC_DRIVER + help + This console uses the Blackfin JTAG to create a console under the + the HVC driver. If you don't have JTAG, then you probably don't + want this option. + config VIRTIO_CONSOLE tristate "Virtio console" depends on VIRTIO diff --git a/drivers/tty/hvc/Makefile b/drivers/tty/hvc/Makefile index e6bed5f177ff..7b0edbce9009 100644 --- a/drivers/tty/hvc/Makefile +++ b/drivers/tty/hvc/Makefile @@ -9,5 +9,6 @@ obj-$(CONFIG_HVC_IRQ) += hvc_irq.o obj-$(CONFIG_HVC_XEN) += hvc_xen.o obj-$(CONFIG_HVC_IUCV) += hvc_iucv.o obj-$(CONFIG_HVC_UDBG) += hvc_udbg.o +obj-$(CONFIG_HVC_BFIN_JTAG) += hvc_bfin_jtag.o obj-$(CONFIG_HVCS) += hvcs.o obj-$(CONFIG_VIRTIO_CONSOLE) += virtio_console.o diff --git a/drivers/tty/hvc/hvc_bfin_jtag.c b/drivers/tty/hvc/hvc_bfin_jtag.c new file mode 100644 index 000000000000..31d6cc6a77af --- /dev/null +++ b/drivers/tty/hvc/hvc_bfin_jtag.c @@ -0,0 +1,105 @@ +/* + * Console via Blackfin JTAG Communication + * + * Copyright 2008-2011 Analog Devices Inc. + * + * Enter bugs at http://blackfin.uclinux.org/ + * + * Licensed under the GPL-2 or later. + */ + +#include +#include +#include +#include +#include +#include + +#include "hvc_console.h" + +/* See the Debug/Emulation chapter in the HRM */ +#define EMUDOF 0x00000001 /* EMUDAT_OUT full & valid */ +#define EMUDIF 0x00000002 /* EMUDAT_IN full & valid */ +#define EMUDOOVF 0x00000004 /* EMUDAT_OUT overflow */ +#define EMUDIOVF 0x00000008 /* EMUDAT_IN overflow */ + +/* Helper functions to glue the register API to simple C operations */ +static inline uint32_t bfin_write_emudat(uint32_t emudat) +{ + __asm__ __volatile__("emudat = %0;" : : "d"(emudat)); + return emudat; +} + +static inline uint32_t bfin_read_emudat(void) +{ + uint32_t emudat; + __asm__ __volatile__("%0 = emudat;" : "=d"(emudat)); + return emudat; +} + +/* Send data to the host */ +static int hvc_bfin_put_chars(uint32_t vt, const char *buf, int count) +{ + static uint32_t outbound_len; + uint32_t emudat; + int ret; + + if (bfin_read_DBGSTAT() & EMUDOF) + return 0; + + if (!outbound_len) { + outbound_len = count; + bfin_write_emudat(outbound_len); + return 0; + } + + ret = min(outbound_len, (uint32_t)4); + memcpy(&emudat, buf, ret); + bfin_write_emudat(emudat); + outbound_len -= ret; + + return ret; +} + +/* Receive data from the host */ +static int hvc_bfin_get_chars(uint32_t vt, char *buf, int count) +{ + static uint32_t inbound_len; + uint32_t emudat; + int ret; + + if (!(bfin_read_DBGSTAT() & EMUDIF)) + return 0; + emudat = bfin_read_emudat(); + + if (!inbound_len) { + inbound_len = emudat; + return 0; + } + + ret = min(inbound_len, (uint32_t)4); + memcpy(buf, &emudat, ret); + inbound_len -= ret; + + return ret; +} + +/* Glue the HVC layers to the Blackfin layers */ +static const struct hv_ops hvc_bfin_get_put_ops = { + .get_chars = hvc_bfin_get_chars, + .put_chars = hvc_bfin_put_chars, +}; + +static int __init hvc_bfin_console_init(void) +{ + hvc_instantiate(0, 0, &hvc_bfin_get_put_ops); + return 0; +} +console_initcall(hvc_bfin_console_init); + +static int __init hvc_bfin_init(void) +{ + hvc_alloc(0, 0, &hvc_bfin_get_put_ops, 128); + return 0; +} +device_initcall(hvc_bfin_init); From 1ffdda950394b6da54d68e9643bc691ebad7a6cc Mon Sep 17 00:00:00 2001 From: Mandeep Singh Baines Date: Sun, 6 Feb 2011 09:31:53 -0800 Subject: [PATCH 17/76] TTY: use appropriate printk priority level printk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely. Signed-off-by: Mandeep Singh Baines Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vt.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 147ede3423df..d5669ff72df4 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -2157,10 +2157,10 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co currcons = vc->vc_num; if (!vc_cons_allocated(currcons)) { - /* could this happen? */ - printk_once("con_write: tty %d not allocated\n", currcons+1); - console_unlock(); - return 0; + /* could this happen? */ + pr_warn_once("con_write: tty %d not allocated\n", currcons+1); + console_unlock(); + return 0; } himask = vc->vc_hi_font_mask; @@ -2940,7 +2940,7 @@ static int __init con_init(void) gotoxy(vc, vc->vc_x, vc->vc_y); csi_J(vc, 0); update_screen(vc); - printk("Console: %s %s %dx%d", + pr_info("Console: %s %s %dx%d", vc->vc_can_do_color ? "colour" : "mono", display_desc, vc->vc_cols, vc->vc_rows); printable = 1; @@ -3103,7 +3103,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last, clear_buffer_attributes(vc); } - printk("Console: switching "); + pr_info("Console: switching "); if (!deflt) printk("consoles %d-%d ", first+1, last+1); if (j >= 0) { @@ -3809,7 +3809,8 @@ void do_unblank_screen(int leaving_gfx) return; if (!vc_cons_allocated(fg_console)) { /* impossible */ - printk("unblank_screen: tty %d not allocated ??\n", fg_console+1); + pr_warning("unblank_screen: tty %d not allocated ??\n", + fg_console+1); return; } vc = vc_cons[fg_console].d; From dc1892c4bc6960121ca4c8023a07c815cfd689be Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Mon, 7 Feb 2011 19:31:24 +0100 Subject: [PATCH 18/76] tty,vcs: lseek/VC-release race fix there's a race between vcs's lseek handler and VC release. The lseek handler does not hold console_lock and touches VC's size info. If during this the VC got released, there's an access violation. Following program triggers the issue for me: [SNIP] #define _BSD_SOURCE #include #include #include #include #include #include #include #include static int run_seek(void) { while(1) { int fd; fd = open("./vcs30", O_RDWR); while(lseek(fd, 0, 0) != -1); close(fd); } } static int open_ioctl_tty(void) { return open("/dev/tty1", O_RDWR); } static int do_ioctl(int fd, int req, int i) { return ioctl(fd, req, i); } #define INIT(i) do_ioctl(ioctl_fd, VT_ACTIVATE, i) #define SHUT(i) do_ioctl(ioctl_fd, VT_DISALLOCATE, i) int main(int argc, char **argv) { int ioctl_fd = open_ioctl_tty(); if (ioctl < 0) { perror("open tty1 failed\n"); return -1; } if ((-1 == mknod("vcs30", S_IFCHR|0666, makedev(7, 30))) && (errno != EEXIST)) { printf("errno %d\n", errno); perror("failed to create vcs30"); return -1; } do_ioctl(ioctl_fd, VT_LOCKSWITCH, 0); if (!fork()) run_seek(); while(1) { INIT(30); SHUT(30); } return 0; } [SNIP] Signed-off-by: Jiri Olsa Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vc_screen.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index a672ed192d33..3c27c4bc6040 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c @@ -159,7 +159,13 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig) int size; mutex_lock(&con_buf_mtx); + console_lock(); size = vcs_size(file->f_path.dentry->d_inode); + console_unlock(); + if (size < 0) { + mutex_unlock(&con_buf_mtx); + return size; + } switch (orig) { default: mutex_unlock(&con_buf_mtx); @@ -237,6 +243,12 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) * could sleep. */ size = vcs_size(inode); + if (size < 0) { + if (read) + break; + ret = size; + goto unlock_out; + } if (pos >= size) break; if (count > size - pos) @@ -436,6 +448,12 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) * Return data written up to now on failure. */ size = vcs_size(inode); + if (size < 0) { + if (written) + break; + ret = size; + goto unlock_out; + } if (pos >= size) break; if (this_round > size - pos) From fcdba07ee390d9d9c15de8b2a17baef689284fcc Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Mon, 7 Feb 2011 19:31:25 +0100 Subject: [PATCH 19/76] tty,vcs removing con_buf/conf_buf_mtx seems there's no longer need for using con_buf/conf_buf_mtx as vcs_read/vcs_write buffer for user's data. The do_con_write function, that was the other user of this, is currently using its own kmalloc-ed buffer. Not sure when this got changed, as I was able to find this code in 2.6.9, but it's already gone as far as current git history goes - 2.6.12-rc2. AFAICS there's a behaviour change with the current change. The lseek is not completely mutually exclusive with the vcs_read/vcs_write - the file->f_pos might get updated via lseek callback during the vcs_read/vcs_write processing. I tried to find out if the prefered behaviour is to keep this in sync within read/write/lseek functions, but I did not find any pattern on different places. I guess if user end up calling write/lseek from different threads she should know what she's doing. If needed we could use dedicated fd mutex/buffer. Signed-off-by: Jiri Olsa Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vc_screen.c | 98 ++++++++++++++++++++------------------ drivers/tty/vt/vt.c | 12 ----- include/linux/vt_kern.h | 8 ---- 3 files changed, 52 insertions(+), 66 deletions(-) diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index 3c27c4bc6040..7b3bfbe2e6de 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -51,6 +50,8 @@ #undef addr #define HEADER_SIZE 4 +#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE) + struct vcs_poll_data { struct notifier_block notifier; unsigned int cons_num; @@ -131,21 +132,45 @@ vcs_poll_data_get(struct file *file) return poll; } +/* + * Returns VC for inode. + * Must be called with console_lock. + */ +static struct vc_data* +vcs_vc(struct inode *inode, int *viewed) +{ + unsigned int currcons = iminor(inode) & 127; + + WARN_CONSOLE_UNLOCKED(); + + if (currcons == 0) { + currcons = fg_console; + if (viewed) + *viewed = 1; + } else { + currcons--; + if (viewed) + *viewed = 0; + } + return vc_cons[currcons].d; +} + +/* + * Returns size for VC carried by inode. + * Must be called with console_lock. + */ static int vcs_size(struct inode *inode) { int size; int minor = iminor(inode); - int currcons = minor & 127; struct vc_data *vc; - if (currcons == 0) - currcons = fg_console; - else - currcons--; - if (!vc_cons_allocated(currcons)) + WARN_CONSOLE_UNLOCKED(); + + vc = vcs_vc(inode, NULL); + if (!vc) return -ENXIO; - vc = vc_cons[currcons].d; size = vc->vc_rows * vc->vc_cols; @@ -158,17 +183,13 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig) { int size; - mutex_lock(&con_buf_mtx); console_lock(); size = vcs_size(file->f_path.dentry->d_inode); console_unlock(); - if (size < 0) { - mutex_unlock(&con_buf_mtx); + if (size < 0) return size; - } switch (orig) { default: - mutex_unlock(&con_buf_mtx); return -EINVAL; case 2: offset += size; @@ -179,11 +200,9 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig) break; } if (offset < 0 || offset > size) { - mutex_unlock(&con_buf_mtx); return -EINVAL; } file->f_pos = offset; - mutex_unlock(&con_buf_mtx); return file->f_pos; } @@ -196,12 +215,15 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) struct vc_data *vc; struct vcs_poll_data *poll; long pos; - long viewed, attr, read; - int col, maxcol; + long attr, read; + int col, maxcol, viewed; unsigned short *org = NULL; ssize_t ret; + char *con_buf; - mutex_lock(&con_buf_mtx); + con_buf = (char *) __get_free_page(GFP_KERNEL); + if (!con_buf) + return -ENOMEM; pos = *ppos; @@ -211,18 +233,10 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) console_lock(); attr = (currcons & 128); - currcons = (currcons & 127); - if (currcons == 0) { - currcons = fg_console; - viewed = 1; - } else { - currcons--; - viewed = 0; - } ret = -ENXIO; - if (!vc_cons_allocated(currcons)) + vc = vcs_vc(inode, &viewed); + if (!vc) goto unlock_out; - vc = vc_cons[currcons].d; ret = -EINVAL; if (pos < 0) @@ -367,7 +381,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) ret = read; unlock_out: console_unlock(); - mutex_unlock(&con_buf_mtx); + free_page((unsigned long) con_buf); return ret; } @@ -378,13 +392,16 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) unsigned int currcons = iminor(inode); struct vc_data *vc; long pos; - long viewed, attr, size, written; + long attr, size, written; char *con_buf0; - int col, maxcol; + int col, maxcol, viewed; u16 *org0 = NULL, *org = NULL; size_t ret; + char *con_buf; - mutex_lock(&con_buf_mtx); + con_buf = (char *) __get_free_page(GFP_KERNEL); + if (!con_buf) + return -ENOMEM; pos = *ppos; @@ -394,19 +411,10 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) console_lock(); attr = (currcons & 128); - currcons = (currcons & 127); - - if (currcons == 0) { - currcons = fg_console; - viewed = 1; - } else { - currcons--; - viewed = 0; - } ret = -ENXIO; - if (!vc_cons_allocated(currcons)) + vc = vcs_vc(inode, &viewed); + if (!vc) goto unlock_out; - vc = vc_cons[currcons].d; size = vcs_size(inode); ret = -EINVAL; @@ -561,9 +569,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) unlock_out: console_unlock(); - - mutex_unlock(&con_buf_mtx); - + free_page((unsigned long) con_buf); return ret; } diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index d5669ff72df4..798df6f89110 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -2068,18 +2068,6 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) } } -/* This is a temporary buffer used to prepare a tty console write - * so that we can easily avoid touching user space while holding the - * console spinlock. It is allocated in con_init and is shared by - * this code and the vc_screen read/write tty calls. - * - * We have to allocate this statically in the kernel data section - * since console_init (and thus con_init) are called before any - * kernel memory allocation is available. - */ -char con_buf[CON_BUF_SIZE]; -DEFINE_MUTEX(con_buf_mtx); - /* is_double_width() is based on the wcwidth() implementation by * Markus Kuhn -- 2007-05-26 (Unicode 5.0) * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index 6625cc1ab758..4d05e14ea60c 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h @@ -142,14 +142,6 @@ static inline bool vt_force_oops_output(struct vc_data *vc) return false; } -/* - * vc_screen.c shares this temporary buffer with the console write code so that - * we can easily avoid touching user space while holding the console spinlock. - */ - -#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE) -extern char con_buf[CON_BUF_SIZE]; -extern struct mutex con_buf_mtx; extern char vt_dont_switch; extern int default_utf8; extern int global_cursor_default; From b68f23b24e0013d489aaa986da0210feea00d4c1 Mon Sep 17 00:00:00 2001 From: Russ Gorby Date: Mon, 7 Feb 2011 12:02:27 -0800 Subject: [PATCH 20/76] serial: ifx6x60: fixed call to tty_port_init The port ops must be set AFTER calling port init as that function zeroes the structure Signed-off-by: Russ Gorby Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/ifx6x60.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index c42de7152eea..972c04d8c1a3 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c @@ -798,8 +798,8 @@ static int ifx_spi_create_port(struct ifx_spi_device *ifx_dev) goto error_ret; } - pport->ops = &ifx_tty_port_ops; tty_port_init(pport); + pport->ops = &ifx_tty_port_ops; ifx_dev->minor = IFX_SPI_TTY_ID; ifx_dev->tty_dev = tty_register_device(tty_drv, ifx_dev->minor, &ifx_dev->spi_dev->dev); From 5fc324952049b2e6d16a54ef89afee25611ca476 Mon Sep 17 00:00:00 2001 From: Russ Gorby Date: Mon, 7 Feb 2011 12:02:28 -0800 Subject: [PATCH 21/76] serial: ifx6x60: dma_alloc_coherent must use parent dev This driver is a SPI protocol driver and has no DMA ops associated with the device so the call will fail. Furthermore, the DMA allocation made here will be used by the SPI controller driver (parent dev) so it makes sense to pass that device instead. Signed-off-by: Russ Gorby Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/ifx6x60.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index 972c04d8c1a3..bb2ff206d0ab 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c @@ -998,7 +998,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi) ifx_dev->spi_slave_cts = 0; /*initialize transfer and dma buffers */ - ifx_dev->tx_buffer = dma_alloc_coherent(&ifx_dev->spi_dev->dev, + ifx_dev->tx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent, IFX_SPI_TRANSFER_SIZE, &ifx_dev->tx_bus, GFP_KERNEL); @@ -1007,7 +1007,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi) ret = -ENOMEM; goto error_ret; } - ifx_dev->rx_buffer = dma_alloc_coherent(&ifx_dev->spi_dev->dev, + ifx_dev->rx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent, IFX_SPI_TRANSFER_SIZE, &ifx_dev->rx_bus, GFP_KERNEL); From f089140ea760b42542389c96f9a54d3076696b2c Mon Sep 17 00:00:00 2001 From: Russ Gorby Date: Mon, 7 Feb 2011 12:02:29 -0800 Subject: [PATCH 22/76] serial: ifx6x60: changed internal bpw from boolean to int driver should support 32bit SPI transfers. The boolean variable only allowed 8/16. Changed to support 8/16/32 for future enabling of 32 bpw. Signed-off-by: Russ Gorby Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/ifx6x60.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index bb2ff206d0ab..9161cabaec37 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c @@ -76,7 +76,7 @@ static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev); /* local variables */ -static int spi_b16 = 1; /* 8 or 16 bit word length */ +static int spi_bpw = 16; /* 8, 16 or 32 bit word length */ static struct tty_driver *tty_drv; static struct ifx_spi_device *saved_ifx_dev; static struct lock_class_key ifx_spi_key; @@ -724,7 +724,7 @@ static void ifx_spi_io(unsigned long data) ifx_dev->spi_xfer.cs_change = 0; ifx_dev->spi_xfer.speed_hz = 12500000; /* ifx_dev->spi_xfer.speed_hz = 390625; */ - ifx_dev->spi_xfer.bits_per_word = spi_b16 ? 16 : 8; + ifx_dev->spi_xfer.bits_per_word = spi_bpw; ifx_dev->spi_xfer.tx_buf = ifx_dev->tx_buffer; ifx_dev->spi_xfer.rx_buf = ifx_dev->rx_buffer; From 1b79b440576b80bace7b6fa012a57ed91d763b5f Mon Sep 17 00:00:00 2001 From: Russ Gorby Date: Mon, 7 Feb 2011 12:02:30 -0800 Subject: [PATCH 23/76] serial: ifx6x60: set SPI max_speed_hz based on platform type Platforms containing the 6260 can run up to 25Mhz. For these platforms set max_speed_hz to 25Mhz. Signed-off-by: Russ Gorby Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/ifx6x60.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index 9161cabaec37..766f0c3aabcf 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c @@ -722,7 +722,7 @@ static void ifx_spi_io(unsigned long data) /* note len is BYTES, not transfers */ ifx_dev->spi_xfer.len = IFX_SPI_TRANSFER_SIZE; ifx_dev->spi_xfer.cs_change = 0; - ifx_dev->spi_xfer.speed_hz = 12500000; + ifx_dev->spi_xfer.speed_hz = ifx_dev->spi_dev->max_speed_hz; /* ifx_dev->spi_xfer.speed_hz = 390625; */ ifx_dev->spi_xfer.bits_per_word = spi_bpw; @@ -992,6 +992,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi) ifx_dev->modem = pl_data->modem_type; ifx_dev->use_dma = pl_data->use_dma; ifx_dev->max_hz = pl_data->max_hz; + spi->max_speed_hz = ifx_dev->max_hz; /* ensure SPI protocol flags are initialized to enable transfer */ ifx_dev->spi_more = 0; From 2aff8d90a073e5a07e1ff5a94779d6a21fb72dd2 Mon Sep 17 00:00:00 2001 From: Russ Gorby Date: Mon, 7 Feb 2011 12:02:31 -0800 Subject: [PATCH 24/76] serial: ifx6x60: probe routine needs to call spi_setup The probe routine should call spi_setup() to configure the SPI bus so it can properly communicate with the device. E.g. the device operates in SPI mode 1. Called spi_setup to configure SPI mode, max_speed_hz, and bpw Signed-off-by: Russ Gorby Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/ifx6x60.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index 766f0c3aabcf..59e9cb87b7de 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c @@ -67,6 +67,7 @@ #define IFX_SPI_MORE_MASK 0x10 #define IFX_SPI_MORE_BIT 12 /* bit position in u16 */ #define IFX_SPI_CTS_BIT 13 /* bit position in u16 */ +#define IFX_SPI_MODE SPI_MODE_1 #define IFX_SPI_TTY_ID 0 #define IFX_SPI_TIMEOUT_SEC 2 #define IFX_SPI_HEADER_0 (-1) @@ -992,7 +993,15 @@ static int ifx_spi_spi_probe(struct spi_device *spi) ifx_dev->modem = pl_data->modem_type; ifx_dev->use_dma = pl_data->use_dma; ifx_dev->max_hz = pl_data->max_hz; + /* initialize spi mode, etc */ spi->max_speed_hz = ifx_dev->max_hz; + spi->mode = IFX_SPI_MODE | (SPI_LOOP & spi->mode); + spi->bits_per_word = spi_bpw; + ret = spi_setup(spi); + if (ret) { + dev_err(&spi->dev, "SPI setup wasn't successful %d", ret); + return -ENODEV; + } /* ensure SPI protocol flags are initialized to enable transfer */ ifx_dev->spi_more = 0; From 8115be01462f8af2dc22dd65dd28268bb9b8bff6 Mon Sep 17 00:00:00 2001 From: Russ Gorby Date: Mon, 7 Feb 2011 12:02:32 -0800 Subject: [PATCH 25/76] serial: ifx6x60: minor cleanup renamed spi_driver variable to not be h/w specific set driver name to use DRVNAME define removed commented-out define Signed-off-by: Russ Gorby Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/ifx6x60.c | 8 ++++---- drivers/tty/serial/ifx6x60.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index 59e9cb87b7de..b68b96f53e6c 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c @@ -1333,9 +1333,9 @@ static const struct spi_device_id ifx_id_table[] = { MODULE_DEVICE_TABLE(spi, ifx_id_table); /* spi operations */ -static const struct spi_driver ifx_spi_driver_6160 = { +static const struct spi_driver ifx_spi_driver = { .driver = { - .name = "ifx6160", + .name = DRVNAME, .bus = &spi_bus_type, .pm = &ifx_spi_pm, .owner = THIS_MODULE}, @@ -1357,7 +1357,7 @@ static void __exit ifx_spi_exit(void) { /* unregister */ tty_unregister_driver(tty_drv); - spi_unregister_driver((void *)&ifx_spi_driver_6160); + spi_unregister_driver((void *)&ifx_spi_driver); } /** @@ -1399,7 +1399,7 @@ static int __init ifx_spi_init(void) return result; } - result = spi_register_driver((void *)&ifx_spi_driver_6160); + result = spi_register_driver((void *)&ifx_spi_driver); if (result) { pr_err("%s: spi_register_driver failed(%d)", DRVNAME, result); diff --git a/drivers/tty/serial/ifx6x60.h b/drivers/tty/serial/ifx6x60.h index 0ec39b58ccc4..e8464baf9e75 100644 --- a/drivers/tty/serial/ifx6x60.h +++ b/drivers/tty/serial/ifx6x60.h @@ -29,8 +29,6 @@ #define DRVNAME "ifx6x60" #define TTYNAME "ttyIFX" -/* #define IFX_THROTTLE_CODE */ - #define IFX_SPI_MAX_MINORS 1 #define IFX_SPI_TRANSFER_SIZE 2048 #define IFX_SPI_FIFO_SIZE 4096 From 95926d2db6256e08d06b753752a0d903a0580acc Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Wed, 9 Feb 2011 11:34:20 +0800 Subject: [PATCH 26/76] serial: also set the uartclk value in resume after goes to highspeed For any reason if the NS16550A was not work in high speed mode (e.g. we hold NS16550A from going to high speed mode in autoconfig_16550a()), now we are resume from suspend, we should also set the uartclk to the correct value. Otherwise it is still the old 1843200 and that will bring issues. CC: Greg Kroah-Hartman CC: David Woodhouse CC: linux-kernel@vger.kernel.org CC: stable@kernel.org Signed-off-by: Yin Kangkai Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c index 3975df6f7fdb..c10a6a909c76 100644 --- a/drivers/tty/serial/8250.c +++ b/drivers/tty/serial/8250.c @@ -3036,6 +3036,7 @@ void serial8250_resume_port(int line) serial_outp(up, 0x04, tmp); serial_outp(up, UART_LCR, 0); + up->port.uartclk = 921600*16; } uart_resume_port(&serial8250_reg, &up->port); } From 0d0389e5414c8950b1613e8bdc74289cde3d6d98 Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Wed, 9 Feb 2011 11:35:18 +0800 Subject: [PATCH 27/76] serial: change the divisor latch only when prescalar actually changed In 8250.c original ns16550 autoconfig code, we change the divisor latch when we goto to high speed mode, we're assuming the previous speed is legacy. This some times is not true. For example in a system with both CONFIG_SERIAL_8250 and CONFIG_SERIAL_8250_PNP set, in this case, the code (autoconfig) will be called twice, one in serial8250_init/probe() and the other is from serial_pnp_probe. When serial_pnp_probe calls the autoconfig for NS16550A, it's already in high speed mode, change the divisor latch (quot << 3) in this case will make the UART console garbled. CC: Greg Kroah-Hartman CC: David Woodhouse CC: linux-kernel@vger.kernel.org CC: stable@kernel.org Signed-off-by: Yin Kangkai Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c index c10a6a909c76..b3b881bc4712 100644 --- a/drivers/tty/serial/8250.c +++ b/drivers/tty/serial/8250.c @@ -954,6 +954,23 @@ static int broken_efr(struct uart_8250_port *up) return 0; } +static inline int ns16550a_goto_highspeed(struct uart_8250_port *up) +{ + unsigned char status; + + status = serial_in(up, 0x04); /* EXCR2 */ +#define PRESL(x) ((x) & 0x30) + if (PRESL(status) == 0x10) { + /* already in high speed mode */ + return 0; + } else { + status &= ~0xB0; /* Disable LOCK, mask out PRESL[01] */ + status |= 0x10; /* 1.625 divisor for baud_base --> 921600 */ + serial_outp(up, 0x04, status); + } + return 1; +} + /* * We know that the chip has FIFOs. Does it have an EFR? The * EFR is located in the same register position as the IIR and @@ -1025,12 +1042,8 @@ static void autoconfig_16550a(struct uart_8250_port *up) quot = serial_dl_read(up); quot <<= 3; - status1 = serial_in(up, 0x04); /* EXCR2 */ - status1 &= ~0xB0; /* Disable LOCK, mask out PRESL[01] */ - status1 |= 0x10; /* 1.625 divisor for baud_base --> 921600 */ - serial_outp(up, 0x04, status1); - - serial_dl_write(up, quot); + if (ns16550a_goto_highspeed(up)) + serial_dl_write(up, quot); serial_outp(up, UART_LCR, 0); @@ -3025,15 +3038,10 @@ void serial8250_resume_port(int line) struct uart_8250_port *up = &serial8250_ports[line]; if (up->capabilities & UART_NATSEMI) { - unsigned char tmp; - /* Ensure it's still in high speed mode */ serial_outp(up, UART_LCR, 0xE0); - tmp = serial_in(up, 0x04); /* EXCR2 */ - tmp &= ~0xB0; /* Disable LOCK, mask out PRESL[01] */ - tmp |= 0x10; /* 1.625 divisor for baud_base --> 921600 */ - serial_outp(up, 0x04, tmp); + ns16550a_goto_highspeed(up); serial_outp(up, UART_LCR, 0); up->port.uartclk = 921600*16; From daaf6ff42d12c89f179868387c0107db6625f0f3 Mon Sep 17 00:00:00 2001 From: Niranjana Vishwanathapura Date: Wed, 9 Feb 2011 11:16:34 -0800 Subject: [PATCH 28/76] tty: Add msm_smd_tty driver msm_smd_tty driver provides tty device interface to 'DS' and 'GPSNMEA' streaming SMD ports. Cc: Brian Swetland Signed-off-by: Niranjana Vishwanathapura Acked-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/Kconfig | 9 ++ drivers/tty/serial/Makefile | 1 + drivers/tty/serial/msm_smd_tty.c | 236 +++++++++++++++++++++++++++++++ 3 files changed, 246 insertions(+) create mode 100644 drivers/tty/serial/msm_smd_tty.c diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index aaedbad93a75..90d939a4ee5d 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1600,4 +1600,13 @@ config SERIAL_PCH_UART Output Hub) which is for IVI(In-Vehicle Infotainment) use. ML7213 is companion chip for Intel Atom E6xx series. ML7213 is completely compatible for Intel EG20T PCH. + +config SERIAL_MSM_SMD + bool "Enable tty device interface for some SMD ports" + default n + depends on MSM_SMD + help + Enables userspace clients to read and write to some streaming SMD + ports via tty device interface for MSM chipset. + endmenu diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile index 8ea92e9c73b0..0c6aefb55acf 100644 --- a/drivers/tty/serial/Makefile +++ b/drivers/tty/serial/Makefile @@ -92,3 +92,4 @@ obj-$(CONFIG_SERIAL_MRST_MAX3110) += mrst_max3110.o obj-$(CONFIG_SERIAL_MFD_HSU) += mfd.o obj-$(CONFIG_SERIAL_IFX6X60) += ifx6x60.o obj-$(CONFIG_SERIAL_PCH_UART) += pch_uart.o +obj-$(CONFIG_SERIAL_MSM_SMD) += msm_smd_tty.o diff --git a/drivers/tty/serial/msm_smd_tty.c b/drivers/tty/serial/msm_smd_tty.c new file mode 100644 index 000000000000..beeff1e86093 --- /dev/null +++ b/drivers/tty/serial/msm_smd_tty.c @@ -0,0 +1,236 @@ +/* drivers/tty/serial/msm_smd_tty.c + * + * Copyright (C) 2007 Google, Inc. + * Copyright (c) 2011, Code Aurora Forum. All rights reserved. + * Author: Brian Swetland + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#define MAX_SMD_TTYS 32 + +struct smd_tty_info { + struct tty_port port; + smd_channel_t *ch; +}; + +struct smd_tty_channel_desc { + int id; + const char *name; +}; + +static struct smd_tty_info smd_tty[MAX_SMD_TTYS]; + +static const struct smd_tty_channel_desc smd_default_tty_channels[] = { + { .id = 0, .name = "SMD_DS" }, + { .id = 27, .name = "SMD_GPSNMEA" }, +}; + +static const struct smd_tty_channel_desc *smd_tty_channels = + smd_default_tty_channels; +static int smd_tty_channels_len = ARRAY_SIZE(smd_default_tty_channels); + +static void smd_tty_notify(void *priv, unsigned event) +{ + unsigned char *ptr; + int avail; + struct smd_tty_info *info = priv; + struct tty_struct *tty; + + if (event != SMD_EVENT_DATA) + return; + + tty = tty_port_tty_get(&info->port); + if (!tty) + return; + + for (;;) { + if (test_bit(TTY_THROTTLED, &tty->flags)) + break; + avail = smd_read_avail(info->ch); + if (avail == 0) + break; + + avail = tty_prepare_flip_string(tty, &ptr, avail); + + if (smd_read(info->ch, ptr, avail) != avail) { + /* shouldn't be possible since we're in interrupt + ** context here and nobody else could 'steal' our + ** characters. + */ + pr_err("OOPS - smd_tty_buffer mismatch?!"); + } + + tty_flip_buffer_push(tty); + } + + /* XXX only when writable and necessary */ + tty_wakeup(tty); + tty_kref_put(tty); +} + +static int smd_tty_port_activate(struct tty_port *tport, struct tty_struct *tty) +{ + int i, res = 0; + int n = tty->index; + const char *name = NULL; + struct smd_tty_info *info = smd_tty + n; + + for (i = 0; i < smd_tty_channels_len; i++) { + if (smd_tty_channels[i].id == n) { + name = smd_tty_channels[i].name; + break; + } + } + if (!name) + return -ENODEV; + + if (info->ch) + smd_kick(info->ch); + else + res = smd_open(name, &info->ch, info, smd_tty_notify); + + if (!res) + tty->driver_data = info; + + return res; +} + +static void smd_tty_port_shutdown(struct tty_port *tport) +{ + struct smd_tty_info *info; + struct tty_struct *tty = tty_port_tty_get(tport); + + info = tty->driver_data; + if (info->ch) { + smd_close(info->ch); + info->ch = 0; + } + + tty->driver_data = 0; + tty_kref_put(tty); +} + +static int smd_tty_open(struct tty_struct *tty, struct file *f) +{ + struct smd_tty_info *info = smd_tty + tty->index; + + return tty_port_open(&info->port, tty, f); +} + +static void smd_tty_close(struct tty_struct *tty, struct file *f) +{ + struct smd_tty_info *info = tty->driver_data; + + tty_port_close(&info->port, tty, f); +} + +static int smd_tty_write(struct tty_struct *tty, + const unsigned char *buf, int len) +{ + struct smd_tty_info *info = tty->driver_data; + int avail; + + /* if we're writing to a packet channel we will + ** never be able to write more data than there + ** is currently space for + */ + avail = smd_write_avail(info->ch); + if (len > avail) + len = avail; + + return smd_write(info->ch, buf, len); +} + +static int smd_tty_write_room(struct tty_struct *tty) +{ + struct smd_tty_info *info = tty->driver_data; + return smd_write_avail(info->ch); +} + +static int smd_tty_chars_in_buffer(struct tty_struct *tty) +{ + struct smd_tty_info *info = tty->driver_data; + return smd_read_avail(info->ch); +} + +static void smd_tty_unthrottle(struct tty_struct *tty) +{ + struct smd_tty_info *info = tty->driver_data; + smd_kick(info->ch); +} + +static const struct tty_port_operations smd_tty_port_ops = { + .shutdown = smd_tty_port_shutdown, + .activate = smd_tty_port_activate, +}; + +static const struct tty_operations smd_tty_ops = { + .open = smd_tty_open, + .close = smd_tty_close, + .write = smd_tty_write, + .write_room = smd_tty_write_room, + .chars_in_buffer = smd_tty_chars_in_buffer, + .unthrottle = smd_tty_unthrottle, +}; + +static struct tty_driver *smd_tty_driver; + +static int __init smd_tty_init(void) +{ + int ret, i; + + smd_tty_driver = alloc_tty_driver(MAX_SMD_TTYS); + if (smd_tty_driver == 0) + return -ENOMEM; + + smd_tty_driver->owner = THIS_MODULE; + smd_tty_driver->driver_name = "smd_tty_driver"; + smd_tty_driver->name = "smd"; + smd_tty_driver->major = 0; + smd_tty_driver->minor_start = 0; + smd_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; + smd_tty_driver->subtype = SERIAL_TYPE_NORMAL; + smd_tty_driver->init_termios = tty_std_termios; + smd_tty_driver->init_termios.c_iflag = 0; + smd_tty_driver->init_termios.c_oflag = 0; + smd_tty_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; + smd_tty_driver->init_termios.c_lflag = 0; + smd_tty_driver->flags = TTY_DRIVER_RESET_TERMIOS | + TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; + tty_set_operations(smd_tty_driver, &smd_tty_ops); + + ret = tty_register_driver(smd_tty_driver); + if (ret) + return ret; + + for (i = 0; i < smd_tty_channels_len; i++) { + tty_port_init(&smd_tty[smd_tty_channels[i].id].port); + smd_tty[smd_tty_channels[i].id].port.ops = &smd_tty_port_ops; + tty_register_device(smd_tty_driver, smd_tty_channels[i].id, 0); + } + + return 0; +} + +module_init(smd_tty_init); From 42bd7a4f68e7785dce656a379c3de0a74f5a4d84 Mon Sep 17 00:00:00 2001 From: Viktar Palstsiuk Date: Wed, 9 Feb 2011 15:26:13 +0100 Subject: [PATCH 29/76] atmel_serial: enable PPS support Enables PPS support in atmel serial driver to make PPS API working. Signed-off-by: Viktar Palstsiuk Signed-off-by: Nicolas Ferre Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/atmel_serial.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 2a1d52fb4936..f119d1761106 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1240,6 +1240,21 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, spin_unlock_irqrestore(&port->lock, flags); } +static void atmel_set_ldisc(struct uart_port *port, int new) +{ + int line = port->line; + + if (line >= port->state->port.tty->driver->num) + return; + + if (port->state->port.tty->ldisc->ops->num == N_PPS) { + port->flags |= UPF_HARDPPS_CD; + atmel_enable_ms(port); + } else { + port->flags &= ~UPF_HARDPPS_CD; + } +} + /* * Return string describing the specified port */ @@ -1380,6 +1395,7 @@ static struct uart_ops atmel_pops = { .shutdown = atmel_shutdown, .flush_buffer = atmel_flush_buffer, .set_termios = atmel_set_termios, + .set_ldisc = atmel_set_ldisc, .type = atmel_type, .release_port = atmel_release_port, .request_port = atmel_request_port, From d637837583163a1a70331ce48097f697cac85e32 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Fri, 11 Feb 2011 15:39:28 +0100 Subject: [PATCH 30/76] tty,vt: fix VT_SETACTIVATE console switch using VT_SETACTIVATE ioctl for console switch did not work, since it put wrong param to the set_console function. Also ioctl returned misleading error, because of the missing break statement. I wonder anyone has ever used this one :). Signed-off-by: Jiri Olsa Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vt_ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 6bcf05bf4978..9e9a901442a3 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -1010,8 +1010,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, if (ret) break; /* Commence switch and lock */ - set_console(arg); + set_console(vsa.console); } + break; } /* From e96fabd8791aad30a3c8a03919893ae3e2e3df25 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 9 Feb 2011 10:56:52 +0100 Subject: [PATCH 31/76] tty: serial: altera_uart: Handle pdev->id == -1 in altera_uart_remove Commit 6b5756f176568a710d008d3b478128fafb6707f0 introduced the possibility for pdev->id being -1 but the change was not done equally in altera_uart_remove. This patch fixes this. Acked-by: Anton Vorontsov Signed-off-by: Tobias Klauser Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/altera_uart.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index 721216292a50..dee7a0eb6ea1 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c @@ -561,9 +561,15 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) static int __devexit altera_uart_remove(struct platform_device *pdev) { - struct uart_port *port = &altera_uart_ports[pdev->id].port; + struct uart_port *port; + int i = pdev->id; + if (i == -1) + i = 0; + + port = &altera_uart_ports[i].port; uart_remove_one_port(&altera_uart_driver, port); + return 0; } From 2780ad42f5fe6739882603c61c8decba6e50eaa2 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 9 Feb 2011 10:57:04 +0100 Subject: [PATCH 32/76] tty: serial: altera_uart: Use port->regshift to store bus shift Use the regshift member of struct uart_port to store the address stride from platform data. This way we can save one dereference per call of altera_uart_readl and altera_uart_writel. This also allows us to use the driver without platform data, which is needed for device tree support in the Nios2 port. Acked-by: Anton Vorontsov Signed-off-by: Tobias Klauser Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/altera_uart.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index dee7a0eb6ea1..3a573528555e 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c @@ -86,16 +86,12 @@ struct altera_uart { static u32 altera_uart_readl(struct uart_port *port, int reg) { - struct altera_uart_platform_uart *platp = port->private_data; - - return readl(port->membase + (reg << platp->bus_shift)); + return readl(port->membase + (reg << port->regshift)); } static void altera_uart_writel(struct uart_port *port, u32 dat, int reg) { - struct altera_uart_platform_uart *platp = port->private_data; - - writel(dat, port->membase + (reg << platp->bus_shift)); + writel(dat, port->membase + (reg << port->regshift)); } static unsigned int altera_uart_tx_empty(struct uart_port *port) @@ -546,13 +542,17 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) if (!port->membase) return -ENOMEM; + if (platp) + port->regshift = platp->bus_shift; + else + port->regshift = 0; + port->line = i; port->type = PORT_ALTERA_UART; port->iotype = SERIAL_IO_MEM; port->uartclk = platp->uartclk; port->ops = &altera_uart_ops; port->flags = UPF_BOOT_AUTOCONF; - port->private_data = platp; uart_add_one_port(&altera_uart_driver, port); From adf9251fe9b87b5a50deebe489db2df8df4715fc Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 9 Feb 2011 10:58:29 +0100 Subject: [PATCH 33/76] MAINTAINERS: Add myself as a maintainer for altera_uart/altera_jtaguart Signed-off-by: Tobias Klauser Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 445537d46e7a..1eaeda66a525 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -465,6 +465,16 @@ M: Matt Turner L: linux-alpha@vger.kernel.org F: arch/alpha/ +ALTERA UART/JTAG UART SERIAL DRIVERS +M: Tobias Klauser +L: linux-serial@vger.kernel.org +L: nios2-dev@sopc.et.ntust.edu.tw (moderated for non-subscribers) +S: Maintained +F: drivers/tty/serial/altera_uart.c +F: drivers/tty/serial/altera_jtaguart.c +F: include/linux/altera_uart.h +F: include/linux/altera_jtaguart.h + AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER M: Thomas Dahlmann L: linux-geode@lists.infradead.org (moderated for non-subscribers) From 60b33c133ca0b7c0b6072c87234b63fee6e80558 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 14 Feb 2011 16:26:14 +0000 Subject: [PATCH 34/76] tiocmget: kill off the passing of the struct file We don't actually need this and it causes problems for internal use of this functionality. Currently there is a single use of the FILE * pointer. That is the serial core which uses it to check tty_hung_up_p. However if that is true then IO_ERROR is also already set so the check may be removed. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/char/amiserial.c | 2 +- drivers/char/cyclades.c | 2 +- drivers/char/epca.c | 4 ++-- drivers/char/ip2/ip2main.c | 4 ++-- drivers/char/isicom.c | 2 +- drivers/char/istallion.c | 2 +- drivers/char/moxa.c | 4 ++-- drivers/char/mxser.c | 2 +- drivers/char/nozomi.c | 2 +- drivers/char/pcmcia/ipwireless/tty.c | 2 +- drivers/char/pcmcia/synclink_cs.c | 4 ++-- drivers/char/riscom8.c | 2 +- drivers/char/rocket.c | 2 +- drivers/char/serial167.c | 2 +- drivers/char/specialix.c | 2 +- drivers/char/stallion.c | 2 +- drivers/char/sx.c | 2 +- drivers/char/synclink.c | 4 ++-- drivers/char/synclink_gt.c | 4 ++-- drivers/char/synclinkmp.c | 4 ++-- drivers/isdn/gigaset/interface.c | 4 ++-- drivers/isdn/i4l/isdn_tty.c | 2 +- drivers/mmc/card/sdio_uart.c | 2 +- drivers/net/usb/hso.c | 2 +- drivers/net/wan/pc300_tty.c | 4 ++-- drivers/staging/quatech_usb2/quatech_usb2.c | 2 +- drivers/staging/serqt_usb2/serqt_usb2.c | 6 +++--- drivers/tty/hvc/hvsi.c | 2 +- drivers/tty/n_gsm.c | 2 +- drivers/tty/serial/68360serial.c | 2 +- drivers/tty/serial/crisv10.c | 2 +- drivers/tty/serial/ifx6x60.c | 2 +- drivers/tty/serial/serial_core.c | 6 ++---- drivers/tty/tty_io.c | 6 +++--- drivers/usb/class/cdc-acm.c | 2 +- drivers/usb/serial/ark3116.c | 2 +- drivers/usb/serial/belkin_sa.c | 4 ++-- drivers/usb/serial/ch341.c | 2 +- drivers/usb/serial/cp210x.c | 4 ++-- drivers/usb/serial/cypress_m8.c | 4 ++-- drivers/usb/serial/digi_acceleport.c | 4 ++-- drivers/usb/serial/ftdi_sio.c | 4 ++-- drivers/usb/serial/io_edgeport.c | 4 ++-- drivers/usb/serial/io_ti.c | 2 +- drivers/usb/serial/iuu_phoenix.c | 2 +- drivers/usb/serial/keyspan.c | 2 +- drivers/usb/serial/keyspan.h | 3 +-- drivers/usb/serial/keyspan_pda.c | 2 +- drivers/usb/serial/kl5kusb105.c | 4 ++-- drivers/usb/serial/kobil_sct.c | 4 ++-- drivers/usb/serial/mct_u232.c | 4 ++-- drivers/usb/serial/mos7720.c | 4 ++-- drivers/usb/serial/mos7840.c | 2 +- drivers/usb/serial/opticon.c | 2 +- drivers/usb/serial/oti6858.c | 4 ++-- drivers/usb/serial/pl2303.c | 2 +- drivers/usb/serial/sierra.c | 2 +- drivers/usb/serial/spcp8x5.c | 2 +- drivers/usb/serial/ssu100.c | 2 +- drivers/usb/serial/ti_usb_3410_5052.c | 4 ++-- drivers/usb/serial/usb-serial.c | 4 ++-- drivers/usb/serial/usb-wwan.h | 2 +- drivers/usb/serial/usb_wwan.c | 2 +- drivers/usb/serial/whiteheat.c | 4 ++-- include/linux/tty_driver.h | 2 +- include/linux/usb/serial.h | 2 +- include/net/irda/ircomm_tty.h | 2 +- net/bluetooth/rfcomm/tty.c | 2 +- net/irda/ircomm/ircomm_tty_ioctl.c | 4 ++-- 69 files changed, 98 insertions(+), 101 deletions(-) diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 6ee3348bc3e4..bc67e6839059 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c @@ -1194,7 +1194,7 @@ static int get_lsr_info(struct async_struct * info, unsigned int __user *value) } -static int rs_tiocmget(struct tty_struct *tty, struct file *file) +static int rs_tiocmget(struct tty_struct *tty) { struct async_struct * info = tty->driver_data; unsigned char control, status; diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 4f152c28f40e..e7945ddacd18 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -2429,7 +2429,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value) return put_user(result, (unsigned long __user *)value); } -static int cy_tiocmget(struct tty_struct *tty, struct file *file) +static int cy_tiocmget(struct tty_struct *tty) { struct cyclades_port *info = tty->driver_data; struct cyclades_card *card; diff --git a/drivers/char/epca.c b/drivers/char/epca.c index d9df46aa0fba..ecf6f0a889fc 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -1982,7 +1982,7 @@ static int info_ioctl(struct tty_struct *tty, struct file *file, return 0; } -static int pc_tiocmget(struct tty_struct *tty, struct file *file) +static int pc_tiocmget(struct tty_struct *tty) { struct channel *ch = tty->driver_data; struct board_chan __iomem *bc; @@ -2074,7 +2074,7 @@ static int pc_ioctl(struct tty_struct *tty, struct file *file, return -EINVAL; switch (cmd) { case TIOCMODG: - mflag = pc_tiocmget(tty, file); + mflag = pc_tiocmget(tty); if (put_user(mflag, (unsigned long __user *)argp)) return -EFAULT; break; diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index c3a025356b8b..476cd087118e 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c @@ -181,7 +181,7 @@ static void ip2_unthrottle(PTTY); static void ip2_stop(PTTY); static void ip2_start(PTTY); static void ip2_hangup(PTTY); -static int ip2_tiocmget(struct tty_struct *tty, struct file *file); +static int ip2_tiocmget(struct tty_struct *tty); static int ip2_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int ip2_get_icount(struct tty_struct *tty, @@ -2038,7 +2038,7 @@ ip2_stop ( PTTY tty ) /* Device Ioctl Section */ /******************************************************************************/ -static int ip2_tiocmget(struct tty_struct *tty, struct file *file) +static int ip2_tiocmget(struct tty_struct *tty) { i2ChanStrPtr pCh = DevTable[tty->index]; #ifdef ENABLE_DSSNOW diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index c27e9d21fea9..836370bc04c2 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -1065,7 +1065,7 @@ static int isicom_send_break(struct tty_struct *tty, int length) return 0; } -static int isicom_tiocmget(struct tty_struct *tty, struct file *file) +static int isicom_tiocmget(struct tty_struct *tty) { struct isi_port *port = tty->driver_data; /* just send the port status */ diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 7c6de4c92458..7843a847b76a 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c @@ -1501,7 +1501,7 @@ static int stli_setserial(struct tty_struct *tty, struct serial_struct __user *s /*****************************************************************************/ -static int stli_tiocmget(struct tty_struct *tty, struct file *file) +static int stli_tiocmget(struct tty_struct *tty) { struct stliport *portp = tty->driver_data; struct stlibrd *brdp; diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 107b0bd58d19..fdf069bb702f 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -199,7 +199,7 @@ static void moxa_set_termios(struct tty_struct *, struct ktermios *); static void moxa_stop(struct tty_struct *); static void moxa_start(struct tty_struct *); static void moxa_hangup(struct tty_struct *); -static int moxa_tiocmget(struct tty_struct *tty, struct file *file); +static int moxa_tiocmget(struct tty_struct *tty); static int moxa_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static void moxa_poll(unsigned long); @@ -1257,7 +1257,7 @@ static int moxa_chars_in_buffer(struct tty_struct *tty) return chars; } -static int moxa_tiocmget(struct tty_struct *tty, struct file *file) +static int moxa_tiocmget(struct tty_struct *tty) { struct moxa_port *ch = tty->driver_data; int flag = 0, dtr, rts; diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index dd9d75351cd6..4d2f03ec06cd 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -1320,7 +1320,7 @@ static int mxser_get_lsr_info(struct mxser_port *info, return put_user(result, value); } -static int mxser_tiocmget(struct tty_struct *tty, struct file *file) +static int mxser_tiocmget(struct tty_struct *tty) { struct mxser_port *info = tty->driver_data; unsigned char control, status; diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c index 294d03e8c61a..0e1dff2ffb1e 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c @@ -1750,7 +1750,7 @@ static int ntty_write_room(struct tty_struct *tty) } /* Gets io control parameters */ -static int ntty_tiocmget(struct tty_struct *tty, struct file *file) +static int ntty_tiocmget(struct tty_struct *tty) { const struct port *port = tty->driver_data; const struct ctrl_dl *ctrl_dl = &port->ctrl_dl; diff --git a/drivers/char/pcmcia/ipwireless/tty.c b/drivers/char/pcmcia/ipwireless/tty.c index f5eb28b6cb0f..7d2ef4909a73 100644 --- a/drivers/char/pcmcia/ipwireless/tty.c +++ b/drivers/char/pcmcia/ipwireless/tty.c @@ -395,7 +395,7 @@ static int set_control_lines(struct ipw_tty *tty, unsigned int set, return 0; } -static int ipw_tiocmget(struct tty_struct *linux_tty, struct file *file) +static int ipw_tiocmget(struct tty_struct *linux_tty) { struct ipw_tty *tty = linux_tty->driver_data; /* FIXME: Exactly how is the tty object locked here .. */ diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index eaa41992fbe2..7b68ba6609fe 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -418,7 +418,7 @@ static void bh_status(MGSLPC_INFO *info); /* * ioctl handlers */ -static int tiocmget(struct tty_struct *tty, struct file *file); +static int tiocmget(struct tty_struct *tty); static int tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int get_stats(MGSLPC_INFO *info, struct mgsl_icount __user *user_icount); @@ -2114,7 +2114,7 @@ static int modem_input_wait(MGSLPC_INFO *info,int arg) /* return the state of the serial control and status signals */ -static int tiocmget(struct tty_struct *tty, struct file *file) +static int tiocmget(struct tty_struct *tty) { MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; unsigned int result; diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index af4de1fe8445..5d0c98456c93 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -1086,7 +1086,7 @@ static int rc_chars_in_buffer(struct tty_struct *tty) return port->xmit_cnt; } -static int rc_tiocmget(struct tty_struct *tty, struct file *file) +static int rc_tiocmget(struct tty_struct *tty) { struct riscom_port *port = tty->driver_data; struct riscom_board *bp; diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 3e4e73a0d7c1..75e98efbc8e9 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c @@ -1169,7 +1169,7 @@ static int sGetChanRI(CHANNEL_T * ChP) * Returns the state of the serial modem control lines. These next 2 functions * are the way kernel versions > 2.5 handle modem control lines rather than IOCTLs. */ -static int rp_tiocmget(struct tty_struct *tty, struct file *file) +static int rp_tiocmget(struct tty_struct *tty) { struct r_port *info = tty->driver_data; unsigned int control, result, ChanStatus; diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index 748c3b0ecd89..fda90643ead7 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c @@ -1308,7 +1308,7 @@ check_and_exit: return startup(info); } /* set_serial_info */ -static int cy_tiocmget(struct tty_struct *tty, struct file *file) +static int cy_tiocmget(struct tty_struct *tty) { struct cyclades_port *info = tty->driver_data; int channel; diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index c2bca3f25ef3..bfecfbef0895 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -1737,7 +1737,7 @@ static int sx_chars_in_buffer(struct tty_struct *tty) return port->xmit_cnt; } -static int sx_tiocmget(struct tty_struct *tty, struct file *file) +static int sx_tiocmget(struct tty_struct *tty) { struct specialix_port *port = tty->driver_data; struct specialix_board *bp; diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 461a5a045517..8c2bf3fb5b89 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -1094,7 +1094,7 @@ static int stl_setserial(struct tty_struct *tty, struct serial_struct __user *sp /*****************************************************************************/ -static int stl_tiocmget(struct tty_struct *tty, struct file *file) +static int stl_tiocmget(struct tty_struct *tty) { struct stlport *portp; diff --git a/drivers/char/sx.c b/drivers/char/sx.c index a786326cea2f..f46214e60d0c 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -1873,7 +1873,7 @@ static int sx_break(struct tty_struct *tty, int flag) return 0; } -static int sx_tiocmget(struct tty_struct *tty, struct file *file) +static int sx_tiocmget(struct tty_struct *tty) { struct sx_port *port = tty->driver_data; return sx_getsignals(port); diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 3a6824f12be2..d359e092904a 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -823,7 +823,7 @@ static isr_dispatch_func UscIsrTable[7] = /* * ioctl call handlers */ -static int tiocmget(struct tty_struct *tty, struct file *file); +static int tiocmget(struct tty_struct *tty); static int tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount @@ -2846,7 +2846,7 @@ static int modem_input_wait(struct mgsl_struct *info,int arg) /* return the state of the serial control and status signals */ -static int tiocmget(struct tty_struct *tty, struct file *file) +static int tiocmget(struct tty_struct *tty) { struct mgsl_struct *info = tty->driver_data; unsigned int result; diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index d01fffeac951..f18ab8af0e1c 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c @@ -512,7 +512,7 @@ static int tx_abort(struct slgt_info *info); static int rx_enable(struct slgt_info *info, int enable); static int modem_input_wait(struct slgt_info *info,int arg); static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr); -static int tiocmget(struct tty_struct *tty, struct file *file); +static int tiocmget(struct tty_struct *tty); static int tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int set_break(struct tty_struct *tty, int break_state); @@ -3195,7 +3195,7 @@ static int modem_input_wait(struct slgt_info *info,int arg) /* * return state of serial control and status signals */ -static int tiocmget(struct tty_struct *tty, struct file *file) +static int tiocmget(struct tty_struct *tty) { struct slgt_info *info = tty->driver_data; unsigned int result; diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 2f9eb4b0dec1..5900213ae75b 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c @@ -546,7 +546,7 @@ static int tx_abort(SLMP_INFO *info); static int rx_enable(SLMP_INFO *info, int enable); static int modem_input_wait(SLMP_INFO *info,int arg); static int wait_mgsl_event(SLMP_INFO *info, int __user *mask_ptr); -static int tiocmget(struct tty_struct *tty, struct file *file); +static int tiocmget(struct tty_struct *tty); static int tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int set_break(struct tty_struct *tty, int break_state); @@ -3207,7 +3207,7 @@ static int modem_input_wait(SLMP_INFO *info,int arg) /* return the state of the serial control and status signals */ -static int tiocmget(struct tty_struct *tty, struct file *file) +static int tiocmget(struct tty_struct *tty) { SLMP_INFO *info = tty->driver_data; unsigned int result; diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index bb710d16a526..e1a7c14f5f1d 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c @@ -122,7 +122,7 @@ static int if_chars_in_buffer(struct tty_struct *tty); static void if_throttle(struct tty_struct *tty); static void if_unthrottle(struct tty_struct *tty); static void if_set_termios(struct tty_struct *tty, struct ktermios *old); -static int if_tiocmget(struct tty_struct *tty, struct file *file); +static int if_tiocmget(struct tty_struct *tty); static int if_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int if_write(struct tty_struct *tty, @@ -280,7 +280,7 @@ static int if_ioctl(struct tty_struct *tty, struct file *file, return retval; } -static int if_tiocmget(struct tty_struct *tty, struct file *file) +static int if_tiocmget(struct tty_struct *tty) { struct cardstate *cs; int retval; diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index c463162843ba..ba6c2f124b58 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c @@ -1345,7 +1345,7 @@ isdn_tty_get_lsr_info(modem_info * info, uint __user * value) static int -isdn_tty_tiocmget(struct tty_struct *tty, struct file *file) +isdn_tty_tiocmget(struct tty_struct *tty) { modem_info *info = (modem_info *) tty->driver_data; u_char control, status; diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c index a0716967b7c8..86bb04d821b1 100644 --- a/drivers/mmc/card/sdio_uart.c +++ b/drivers/mmc/card/sdio_uart.c @@ -956,7 +956,7 @@ static int sdio_uart_break_ctl(struct tty_struct *tty, int break_state) return 0; } -static int sdio_uart_tiocmget(struct tty_struct *tty, struct file *file) +static int sdio_uart_tiocmget(struct tty_struct *tty) { struct sdio_uart_port *port = tty->driver_data; int result; diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index bed8fcedff49..7c68c456c035 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -1656,7 +1656,7 @@ static int hso_get_count(struct tty_struct *tty, } -static int hso_serial_tiocmget(struct tty_struct *tty, struct file *file) +static int hso_serial_tiocmget(struct tty_struct *tty) { int retval; struct hso_serial *serial = get_serial_by_tty(tty); diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index 515d9b8af01e..d999e54a7730 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c @@ -133,7 +133,7 @@ static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char); static int pc300_tiocmset(struct tty_struct *, struct file *, unsigned int, unsigned int); -static int pc300_tiocmget(struct tty_struct *, struct file *); +static int pc300_tiocmget(struct tty_struct *); /* functions called by PC300 driver */ void cpc_tty_init(pc300dev_t *dev); @@ -570,7 +570,7 @@ static int pc300_tiocmset(struct tty_struct *tty, struct file *file, return 0; } -static int pc300_tiocmget(struct tty_struct *tty, struct file *file) +static int pc300_tiocmget(struct tty_struct *tty) { unsigned int result; unsigned char status; diff --git a/drivers/staging/quatech_usb2/quatech_usb2.c b/drivers/staging/quatech_usb2/quatech_usb2.c index ed58f482c963..1e50292aef74 100644 --- a/drivers/staging/quatech_usb2/quatech_usb2.c +++ b/drivers/staging/quatech_usb2/quatech_usb2.c @@ -1078,7 +1078,7 @@ static void qt2_set_termios(struct tty_struct *tty, } } -static int qt2_tiocmget(struct tty_struct *tty, struct file *file) +static int qt2_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct usb_serial *serial = port->serial; diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c index 27841ef6a568..56ded56db7b4 100644 --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c @@ -1383,7 +1383,7 @@ static void qt_break(struct tty_struct *tty, int break_state) static inline int qt_real_tiocmget(struct tty_struct *tty, struct usb_serial_port *port, - struct file *file, struct usb_serial *serial) + struct usb_serial *serial) { u8 mcr; @@ -1462,7 +1462,7 @@ static inline int qt_real_tiocmset(struct tty_struct *tty, return 0; } -static int qt_tiocmget(struct tty_struct *tty, struct file *file) +static int qt_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct usb_serial *serial = get_usb_serial(port, __func__); @@ -1480,7 +1480,7 @@ static int qt_tiocmget(struct tty_struct *tty, struct file *file) dbg("%s - port %d\n", __func__, port->number); dbg("%s - port->RxHolding = %d\n", __func__, qt_port->RxHolding); - retval = qt_real_tiocmget(tty, port, file, serial); + retval = qt_real_tiocmget(tty, port, serial); spin_unlock_irqrestore(&qt_port->lock, flags); return retval; diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c index 67a75a502c01..55293105a56c 100644 --- a/drivers/tty/hvc/hvsi.c +++ b/drivers/tty/hvc/hvsi.c @@ -1095,7 +1095,7 @@ static void hvsi_unthrottle(struct tty_struct *tty) h_vio_signal(hp->vtermno, VIO_IRQ_ENABLE); } -static int hvsi_tiocmget(struct tty_struct *tty, struct file *file) +static int hvsi_tiocmget(struct tty_struct *tty) { struct hvsi_struct *hp = tty->driver_data; diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 44b8412a04e8..97e3d509ff82 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2648,7 +2648,7 @@ static void gsmtty_wait_until_sent(struct tty_struct *tty, int timeout) to do here */ } -static int gsmtty_tiocmget(struct tty_struct *tty, struct file *filp) +static int gsmtty_tiocmget(struct tty_struct *tty) { struct gsm_dlci *dlci = tty->driver_data; return dlci->modem_rx; diff --git a/drivers/tty/serial/68360serial.c b/drivers/tty/serial/68360serial.c index 88b13356ec10..2a52cf14ce50 100644 --- a/drivers/tty/serial/68360serial.c +++ b/drivers/tty/serial/68360serial.c @@ -1240,7 +1240,7 @@ static int get_lsr_info(struct async_struct * info, unsigned int *value) } #endif -static int rs_360_tiocmget(struct tty_struct *tty, struct file *file) +static int rs_360_tiocmget(struct tty_struct *tty) { ser_info_t *info = (ser_info_t *)tty->driver_data; unsigned int result = 0; diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index bcc31f2140ac..8cc5c0224b25 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c @@ -3614,7 +3614,7 @@ rs_tiocmset(struct tty_struct *tty, struct file *file, } static int -rs_tiocmget(struct tty_struct *tty, struct file *file) +rs_tiocmget(struct tty_struct *tty) { struct e100_serial *info = (struct e100_serial *)tty->driver_data; unsigned int result; diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index b68b96f53e6c..4d26d39ec344 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c @@ -245,7 +245,7 @@ static void ifx_spi_timeout(unsigned long arg) * Map the signal state into Linux modem flags and report the value * in Linux terms */ -static int ifx_spi_tiocmget(struct tty_struct *tty, struct file *filp) +static int ifx_spi_tiocmget(struct tty_struct *tty) { unsigned int value; struct ifx_spi_device *ifx_dev = tty->driver_data; diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 20563c509b21..53e490e47560 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -905,7 +905,7 @@ static int uart_get_lsr_info(struct tty_struct *tty, return put_user(result, value); } -static int uart_tiocmget(struct tty_struct *tty, struct file *file) +static int uart_tiocmget(struct tty_struct *tty) { struct uart_state *state = tty->driver_data; struct tty_port *port = &state->port; @@ -913,10 +913,8 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file) int result = -EIO; mutex_lock(&port->mutex); - if ((!file || !tty_hung_up_p(file)) && - !(tty->flags & (1 << TTY_IO_ERROR))) { + if (!(tty->flags & (1 << TTY_IO_ERROR))) { result = uport->mctrl; - spin_lock_irq(&uport->lock); result |= uport->ops->get_mctrl(uport); spin_unlock_irq(&uport->lock); diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 0065da4b11c1..fde5a4dae3dd 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2465,12 +2465,12 @@ out: * Locking: none (up to the driver) */ -static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p) +static int tty_tiocmget(struct tty_struct *tty, int __user *p) { int retval = -EINVAL; if (tty->ops->tiocmget) { - retval = tty->ops->tiocmget(tty, file); + retval = tty->ops->tiocmget(tty); if (retval >= 0) retval = put_user(retval, p); @@ -2655,7 +2655,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return send_break(tty, arg ? arg*100 : 250); case TIOCMGET: - return tty_tiocmget(tty, file, p); + return tty_tiocmget(tty, p); case TIOCMSET: case TIOCMBIC: case TIOCMBIS: diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index d6ede989ff22..2ae996b7ce7b 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -776,7 +776,7 @@ static int acm_tty_break_ctl(struct tty_struct *tty, int state) return retval; } -static int acm_tty_tiocmget(struct tty_struct *tty, struct file *file) +static int acm_tty_tiocmget(struct tty_struct *tty) { struct acm *acm = tty->driver_data; diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 8f1d4fb19d24..35b610aa3f92 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -485,7 +485,7 @@ static int ark3116_ioctl(struct tty_struct *tty, struct file *file, return -ENOIOCTLCMD; } -static int ark3116_tiocmget(struct tty_struct *tty, struct file *file) +static int ark3116_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct ark3116_private *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 36df35295db2..48fb3bad3cd6 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c @@ -100,7 +100,7 @@ static void belkin_sa_process_read_urb(struct urb *urb); static void belkin_sa_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios * old); static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state); -static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file); +static int belkin_sa_tiocmget(struct tty_struct *tty); static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); @@ -497,7 +497,7 @@ static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state) dev_err(&port->dev, "Set break_ctl %d\n", break_state); } -static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file) +static int belkin_sa_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct belkin_sa_private *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 7b8815ddf368..aa0962b72f4c 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -572,7 +572,7 @@ static int ch341_ioctl(struct tty_struct *tty, struct file *file, return -ENOIOCTLCMD; } -static int ch341_tiocmget(struct tty_struct *tty, struct file *file) +static int ch341_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct ch341_private *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 735ea03157ab..b3873815035c 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -41,7 +41,7 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, unsigned int *cflagp, unsigned int *baudp); static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *, struct ktermios*); -static int cp210x_tiocmget(struct tty_struct *, struct file *); +static int cp210x_tiocmget(struct tty_struct *); static int cp210x_tiocmset(struct tty_struct *, struct file *, unsigned int, unsigned int); static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *, @@ -742,7 +742,7 @@ static void cp210x_dtr_rts(struct usb_serial_port *p, int on) cp210x_tiocmset_port(p, NULL, 0, TIOCM_DTR|TIOCM_RTS); } -static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) +static int cp210x_tiocmget (struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; unsigned int control; diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 2edf238b00b9..9c96cff691fd 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -173,7 +173,7 @@ static int cypress_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); static void cypress_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); -static int cypress_tiocmget(struct tty_struct *tty, struct file *file); +static int cypress_tiocmget(struct tty_struct *tty); static int cypress_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int cypress_chars_in_buffer(struct tty_struct *tty); @@ -864,7 +864,7 @@ static int cypress_write_room(struct tty_struct *tty) } -static int cypress_tiocmget(struct tty_struct *tty, struct file *file) +static int cypress_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct cypress_private *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 666e5a6edd82..08da46cb5825 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -445,7 +445,7 @@ static void digi_rx_unthrottle(struct tty_struct *tty); static void digi_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios); static void digi_break_ctl(struct tty_struct *tty, int break_state); -static int digi_tiocmget(struct tty_struct *tty, struct file *file); +static int digi_tiocmget(struct tty_struct *tty); static int digi_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int digi_write(struct tty_struct *tty, struct usb_serial_port *port, @@ -1118,7 +1118,7 @@ static void digi_break_ctl(struct tty_struct *tty, int break_state) } -static int digi_tiocmget(struct tty_struct *tty, struct file *file) +static int digi_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct digi_port *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 4787c0cd063f..281d18141051 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -856,7 +856,7 @@ static int ftdi_prepare_write_buffer(struct usb_serial_port *port, void *dest, size_t size); static void ftdi_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); -static int ftdi_tiocmget(struct tty_struct *tty, struct file *file); +static int ftdi_tiocmget(struct tty_struct *tty); static int ftdi_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int ftdi_ioctl(struct tty_struct *tty, struct file *file, @@ -2149,7 +2149,7 @@ static void ftdi_set_termios(struct tty_struct *tty, } } -static int ftdi_tiocmget(struct tty_struct *tty, struct file *file) +static int ftdi_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct ftdi_private *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index cd769ef24f8a..e8fe4dcf72f0 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -219,7 +219,7 @@ static void edge_set_termios(struct tty_struct *tty, static int edge_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); static void edge_break(struct tty_struct *tty, int break_state); -static int edge_tiocmget(struct tty_struct *tty, struct file *file); +static int edge_tiocmget(struct tty_struct *tty); static int edge_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int edge_get_icount(struct tty_struct *tty, @@ -1599,7 +1599,7 @@ static int edge_tiocmset(struct tty_struct *tty, struct file *file, return 0; } -static int edge_tiocmget(struct tty_struct *tty, struct file *file) +static int edge_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct edgeport_port *edge_port = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 22506b095c4f..7cb9f5cb91f3 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -2477,7 +2477,7 @@ static int edge_tiocmset(struct tty_struct *tty, struct file *file, return 0; } -static int edge_tiocmget(struct tty_struct *tty, struct file *file) +static int edge_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct edgeport_port *edge_port = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 99b97c04896f..1d96142f135a 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -179,7 +179,7 @@ static int iuu_tiocmset(struct tty_struct *tty, struct file *file, * When no card , the reader respond with TIOCM_CD * This is known as CD autodetect mechanism */ -static int iuu_tiocmget(struct tty_struct *tty, struct file *file) +static int iuu_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct iuu_private *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 0791778a66f3..1beebbb7a20a 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -301,7 +301,7 @@ static void keyspan_set_termios(struct tty_struct *tty, keyspan_send_setup(port, 0); } -static int keyspan_tiocmget(struct tty_struct *tty, struct file *file) +static int keyspan_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct keyspan_port_private *p_priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h index ce134dc28ddf..5e5fc71e68df 100644 --- a/drivers/usb/serial/keyspan.h +++ b/drivers/usb/serial/keyspan.h @@ -58,8 +58,7 @@ static void keyspan_set_termios (struct tty_struct *tty, struct ktermios *old); static void keyspan_break_ctl (struct tty_struct *tty, int break_state); -static int keyspan_tiocmget (struct tty_struct *tty, - struct file *file); +static int keyspan_tiocmget (struct tty_struct *tty); static int keyspan_tiocmset (struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 554a8693a463..49ad2baf77cd 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -457,7 +457,7 @@ static int keyspan_pda_set_modem_info(struct usb_serial *serial, return rc; } -static int keyspan_pda_tiocmget(struct tty_struct *tty, struct file *file) +static int keyspan_pda_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct usb_serial *serial = port->serial; diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index e8a65ce45a2f..a570f5201c73 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -68,7 +68,7 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port); static void klsi_105_close(struct usb_serial_port *port); static void klsi_105_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); -static int klsi_105_tiocmget(struct tty_struct *tty, struct file *file); +static int klsi_105_tiocmget(struct tty_struct *tty); static int klsi_105_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static void klsi_105_process_read_urb(struct urb *urb); @@ -637,7 +637,7 @@ static void mct_u232_break_ctl(struct tty_struct *tty, int break_state) } #endif -static int klsi_105_tiocmget(struct tty_struct *tty, struct file *file) +static int klsi_105_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct klsi_105_private *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index bd5bd8589e04..81d07fb299b8 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -77,7 +77,7 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, static int kobil_write_room(struct tty_struct *tty); static int kobil_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); -static int kobil_tiocmget(struct tty_struct *tty, struct file *file); +static int kobil_tiocmget(struct tty_struct *tty); static int kobil_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static void kobil_read_int_callback(struct urb *urb); @@ -504,7 +504,7 @@ static int kobil_write_room(struct tty_struct *tty) } -static int kobil_tiocmget(struct tty_struct *tty, struct file *file) +static int kobil_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct kobil_private *priv; diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index 2849f8c32015..27447095feae 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c @@ -101,7 +101,7 @@ static void mct_u232_read_int_callback(struct urb *urb); static void mct_u232_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); static void mct_u232_break_ctl(struct tty_struct *tty, int break_state); -static int mct_u232_tiocmget(struct tty_struct *tty, struct file *file); +static int mct_u232_tiocmget(struct tty_struct *tty); static int mct_u232_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static void mct_u232_throttle(struct tty_struct *tty); @@ -762,7 +762,7 @@ static void mct_u232_break_ctl(struct tty_struct *tty, int break_state) } /* mct_u232_break_ctl */ -static int mct_u232_tiocmget(struct tty_struct *tty, struct file *file) +static int mct_u232_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct mct_u232_private *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 7d3bc9a3e2b6..5d40d4151b5a 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -1833,7 +1833,7 @@ static int get_lsr_info(struct tty_struct *tty, return 0; } -static int mos7720_tiocmget(struct tty_struct *tty, struct file *file) +static int mos7720_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct moschip_port *mos7720_port = usb_get_serial_port_data(port); @@ -1865,7 +1865,7 @@ static int mos7720_tiocmset(struct tty_struct *tty, struct file *file, struct moschip_port *mos7720_port = usb_get_serial_port_data(port); unsigned int mcr ; dbg("%s - port %d", __func__, port->number); - dbg("he was at tiocmget"); + dbg("he was at tiocmset"); mcr = mos7720_port->shadowMCR; diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 5627993f9e41..ee0dc9a0890c 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -1644,7 +1644,7 @@ static void mos7840_unthrottle(struct tty_struct *tty) } } -static int mos7840_tiocmget(struct tty_struct *tty, struct file *file) +static int mos7840_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct moschip_port *mos7840_port; diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index eda1f9266c4e..e305df807396 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c @@ -352,7 +352,7 @@ static void opticon_unthrottle(struct tty_struct *tty) } } -static int opticon_tiocmget(struct tty_struct *tty, struct file *file) +static int opticon_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct opticon_private *priv = usb_get_serial_data(port->serial); diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 73613205be7a..4cd3b0ef4e61 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c @@ -144,7 +144,7 @@ static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count); static int oti6858_write_room(struct tty_struct *tty); static int oti6858_chars_in_buffer(struct tty_struct *tty); -static int oti6858_tiocmget(struct tty_struct *tty, struct file *file); +static int oti6858_tiocmget(struct tty_struct *tty); static int oti6858_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int oti6858_startup(struct usb_serial *serial); @@ -657,7 +657,7 @@ static int oti6858_tiocmset(struct tty_struct *tty, struct file *file, return 0; } -static int oti6858_tiocmget(struct tty_struct *tty, struct file *file) +static int oti6858_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct oti6858_private *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 08c9181b8e48..6cb4f503a3f1 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -531,7 +531,7 @@ static int pl2303_tiocmset(struct tty_struct *tty, struct file *file, return set_control_lines(port->serial->dev, control); } -static int pl2303_tiocmget(struct tty_struct *tty, struct file *file) +static int pl2303_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct pl2303_private *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 7481ff8a49e4..66437f1e9e5b 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -389,7 +389,7 @@ static void sierra_set_termios(struct tty_struct *tty, sierra_send_setup(port); } -static int sierra_tiocmget(struct tty_struct *tty, struct file *file) +static int sierra_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; unsigned int value; diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index cbfb70bffdd0..cac13009fc5c 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c @@ -618,7 +618,7 @@ static int spcp8x5_tiocmset(struct tty_struct *tty, struct file *file, return spcp8x5_set_ctrlLine(port->serial->dev, control , priv->type); } -static int spcp8x5_tiocmget(struct tty_struct *tty, struct file *file) +static int spcp8x5_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct spcp8x5_private *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index 8359ec798959..b21583fa825c 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c @@ -484,7 +484,7 @@ static int ssu100_attach(struct usb_serial *serial) return ssu100_initdevice(serial->dev); } -static int ssu100_tiocmget(struct tty_struct *tty, struct file *file) +static int ssu100_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct usb_device *dev = port->serial->dev; diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index b2902f307b47..223e60e31735 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -112,7 +112,7 @@ static int ti_get_icount(struct tty_struct *tty, struct serial_icounter_struct *icount); static void ti_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios); -static int ti_tiocmget(struct tty_struct *tty, struct file *file); +static int ti_tiocmget(struct tty_struct *tty); static int ti_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static void ti_break(struct tty_struct *tty, int break_state); @@ -1000,7 +1000,7 @@ static void ti_set_termios(struct tty_struct *tty, } -static int ti_tiocmget(struct tty_struct *tty, struct file *file) +static int ti_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct ti_port *tport = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 546a52179bec..df105c6531a1 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -496,14 +496,14 @@ static const struct file_operations serial_proc_fops = { .release = single_release, }; -static int serial_tiocmget(struct tty_struct *tty, struct file *file) +static int serial_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; dbg("%s - port %d", __func__, port->number); if (port->serial->type->tiocmget) - return port->serial->type->tiocmget(tty, file); + return port->serial->type->tiocmget(tty); return -EINVAL; } diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h index 3ab77c5d9819..8b68fc783d5f 100644 --- a/drivers/usb/serial/usb-wwan.h +++ b/drivers/usb/serial/usb-wwan.h @@ -15,7 +15,7 @@ extern int usb_wwan_write_room(struct tty_struct *tty); extern void usb_wwan_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); -extern int usb_wwan_tiocmget(struct tty_struct *tty, struct file *file); +extern int usb_wwan_tiocmget(struct tty_struct *tty); extern int usb_wwan_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); extern int usb_wwan_ioctl(struct tty_struct *tty, struct file *file, diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index b004b2a485c3..60f942632cb4 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -79,7 +79,7 @@ void usb_wwan_set_termios(struct tty_struct *tty, } EXPORT_SYMBOL(usb_wwan_set_termios); -int usb_wwan_tiocmget(struct tty_struct *tty, struct file *file) +int usb_wwan_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; unsigned int value; diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 3f9ac88d588c..bf850139e0b8 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -156,7 +156,7 @@ static int whiteheat_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); static void whiteheat_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); -static int whiteheat_tiocmget(struct tty_struct *tty, struct file *file); +static int whiteheat_tiocmget(struct tty_struct *tty); static int whiteheat_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static void whiteheat_break_ctl(struct tty_struct *tty, int break_state); @@ -833,7 +833,7 @@ static int whiteheat_write_room(struct tty_struct *tty) return (room); } -static int whiteheat_tiocmget(struct tty_struct *tty, struct file *file) +static int whiteheat_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct whiteheat_private *info = usb_get_serial_port_data(port); diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index c3d43eb4150c..9539d74171db 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -271,7 +271,7 @@ struct tty_operations { void (*set_ldisc)(struct tty_struct *tty); void (*wait_until_sent)(struct tty_struct *tty, int timeout); void (*send_xchar)(struct tty_struct *tty, char ch); - int (*tiocmget)(struct tty_struct *tty, struct file *file); + int (*tiocmget)(struct tty_struct *tty); int (*tiocmset)(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); int (*resize)(struct tty_struct *tty, struct winsize *ws); diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index c9049139a7a5..30b945397d19 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -268,7 +268,7 @@ struct usb_serial_driver { int (*chars_in_buffer)(struct tty_struct *tty); void (*throttle)(struct tty_struct *tty); void (*unthrottle)(struct tty_struct *tty); - int (*tiocmget)(struct tty_struct *tty, struct file *file); + int (*tiocmget)(struct tty_struct *tty); int (*tiocmset)(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); int (*get_icount)(struct tty_struct *tty, diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h index eea2e6152389..fa3793b5392d 100644 --- a/include/net/irda/ircomm_tty.h +++ b/include/net/irda/ircomm_tty.h @@ -120,7 +120,7 @@ struct ircomm_tty_cb { void ircomm_tty_start(struct tty_struct *tty); void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self); -extern int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file); +extern int ircomm_tty_tiocmget(struct tty_struct *tty); extern int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 2575c2db6404..7f67fa4f2f5e 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -1089,7 +1089,7 @@ static void rfcomm_tty_hangup(struct tty_struct *tty) } } -static int rfcomm_tty_tiocmget(struct tty_struct *tty, struct file *filp) +static int rfcomm_tty_tiocmget(struct tty_struct *tty) { struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c index 24cb3aa2bbfb..bb47caeba7e6 100644 --- a/net/irda/ircomm/ircomm_tty_ioctl.c +++ b/net/irda/ircomm/ircomm_tty_ioctl.c @@ -189,12 +189,12 @@ void ircomm_tty_set_termios(struct tty_struct *tty, } /* - * Function ircomm_tty_tiocmget (tty, file) + * Function ircomm_tty_tiocmget (tty) * * * */ -int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file) +int ircomm_tty_tiocmget(struct tty_struct *tty) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; unsigned int result; From 20b9d17715017ae4dd4ec87fabc36d33b9de708e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 14 Feb 2011 16:26:50 +0000 Subject: [PATCH 35/76] tiocmset: kill the file pointer argument Doing tiocmget was such fun we should do tiocmset as well for the same reasons Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/char/amiserial.c | 4 ++-- drivers/char/cyclades.c | 2 +- drivers/char/epca.c | 4 ++-- drivers/char/ip2/ip2main.c | 4 ++-- drivers/char/isicom.c | 4 ++-- drivers/char/istallion.c | 2 +- drivers/char/moxa.c | 4 ++-- drivers/char/mxser.c | 2 +- drivers/char/nozomi.c | 4 ++-- drivers/char/pcmcia/ipwireless/tty.c | 2 +- drivers/char/pcmcia/synclink_cs.c | 6 +++--- drivers/char/riscom8.c | 4 ++-- drivers/char/rocket.c | 4 ++-- drivers/char/serial167.c | 3 +-- drivers/char/specialix.c | 2 +- drivers/char/stallion.c | 2 +- drivers/char/sx.c | 4 ++-- drivers/char/synclink.c | 6 +++--- drivers/char/synclink_gt.c | 6 +++--- drivers/char/synclinkmp.c | 8 ++++---- drivers/isdn/gigaset/interface.c | 4 ++-- drivers/isdn/gigaset/ser-gigaset.c | 2 +- drivers/isdn/i4l/isdn_tty.c | 2 +- drivers/mmc/card/sdio_uart.c | 2 +- drivers/net/irda/irtty-sir.c | 2 +- drivers/net/usb/hso.c | 6 +++--- drivers/net/wan/pc300_tty.c | 5 ++--- drivers/staging/quatech_usb2/quatech_usb2.c | 2 +- drivers/staging/serqt_usb2/serqt_usb2.c | 5 ++--- drivers/tty/hvc/hvsi.c | 4 ++-- drivers/tty/n_gsm.c | 2 +- drivers/tty/serial/68360serial.c | 2 +- drivers/tty/serial/crisv10.c | 3 +-- drivers/tty/serial/ifx6x60.c | 3 +-- drivers/tty/serial/serial_core.c | 6 ++---- drivers/tty/tty_io.c | 7 +++---- drivers/usb/class/cdc-acm.c | 2 +- drivers/usb/serial/ark3116.c | 2 +- drivers/usb/serial/belkin_sa.c | 4 ++-- drivers/usb/serial/ch341.c | 2 +- drivers/usb/serial/cp210x.c | 15 +++++++-------- drivers/usb/serial/cypress_m8.c | 4 ++-- drivers/usb/serial/digi_acceleport.c | 10 +++++----- drivers/usb/serial/ftdi_sio.c | 4 ++-- drivers/usb/serial/io_edgeport.c | 4 ++-- drivers/usb/serial/io_ti.c | 2 +- drivers/usb/serial/iuu_phoenix.c | 2 +- drivers/usb/serial/keyspan.c | 2 +- drivers/usb/serial/keyspan.h | 2 +- drivers/usb/serial/keyspan_pda.c | 2 +- drivers/usb/serial/kl5kusb105.c | 4 ++-- drivers/usb/serial/kobil_sct.c | 4 ++-- drivers/usb/serial/mct_u232.c | 4 ++-- drivers/usb/serial/mos7720.c | 2 +- drivers/usb/serial/mos7840.c | 2 +- drivers/usb/serial/oti6858.c | 4 ++-- drivers/usb/serial/pl2303.c | 2 +- drivers/usb/serial/sierra.c | 2 +- drivers/usb/serial/spcp8x5.c | 2 +- drivers/usb/serial/ssu100.c | 2 +- drivers/usb/serial/ti_usb_3410_5052.c | 6 +++--- drivers/usb/serial/usb-serial.c | 4 ++-- drivers/usb/serial/usb-wwan.h | 2 +- drivers/usb/serial/usb_wwan.c | 2 +- drivers/usb/serial/whiteheat.c | 4 ++-- include/linux/tty_driver.h | 2 +- include/linux/usb/serial.h | 2 +- include/net/irda/ircomm_tty.h | 2 +- net/bluetooth/rfcomm/tty.c | 2 +- net/irda/ircomm/ircomm_tty_ioctl.c | 4 ++-- 70 files changed, 120 insertions(+), 129 deletions(-) diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index bc67e6839059..5c15fad71ad2 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c @@ -1216,8 +1216,8 @@ static int rs_tiocmget(struct tty_struct *tty) | (!(status & SER_CTS) ? TIOCM_CTS : 0); } -static int rs_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +static int rs_tiocmset(struct tty_struct *tty, unsigned int set, + unsigned int clear) { struct async_struct * info = tty->driver_data; unsigned long flags; diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index e7945ddacd18..942b6f2b70a4 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -2483,7 +2483,7 @@ end: } /* cy_tiomget */ static int -cy_tiocmset(struct tty_struct *tty, struct file *file, +cy_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct cyclades_port *info = tty->driver_data; diff --git a/drivers/char/epca.c b/drivers/char/epca.c index ecf6f0a889fc..e5872b59f9cd 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -2015,7 +2015,7 @@ static int pc_tiocmget(struct tty_struct *tty) return mflag; } -static int pc_tiocmset(struct tty_struct *tty, struct file *file, +static int pc_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct channel *ch = tty->driver_data; @@ -2081,7 +2081,7 @@ static int pc_ioctl(struct tty_struct *tty, struct file *file, case TIOCMODS: if (get_user(mstat, (unsigned __user *)argp)) return -EFAULT; - return pc_tiocmset(tty, file, mstat, ~mstat); + return pc_tiocmset(tty, mstat, ~mstat); case TIOCSDTR: spin_lock_irqsave(&epca_lock, flags); ch->omodem |= ch->m_dtr; diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 476cd087118e..d5f866c7c672 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c @@ -182,7 +182,7 @@ static void ip2_stop(PTTY); static void ip2_start(PTTY); static void ip2_hangup(PTTY); static int ip2_tiocmget(struct tty_struct *tty); -static int ip2_tiocmset(struct tty_struct *tty, struct file *file, +static int ip2_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static int ip2_get_icount(struct tty_struct *tty, struct serial_icounter_struct *icount); @@ -2085,7 +2085,7 @@ static int ip2_tiocmget(struct tty_struct *tty) | ((pCh->dataSetIn & I2_CTS) ? TIOCM_CTS : 0); } -static int ip2_tiocmset(struct tty_struct *tty, struct file *file, +static int ip2_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { i2ChanStrPtr pCh = DevTable[tty->index]; diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 836370bc04c2..60f4d8ae7a49 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -1082,8 +1082,8 @@ static int isicom_tiocmget(struct tty_struct *tty) ((status & ISI_RI ) ? TIOCM_RI : 0); } -static int isicom_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +static int isicom_tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear) { struct isi_port *port = tty->driver_data; unsigned long flags; diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 7843a847b76a..763b58d58255 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c @@ -1524,7 +1524,7 @@ static int stli_tiocmget(struct tty_struct *tty) return stli_mktiocm(portp->asig.sigvalue); } -static int stli_tiocmset(struct tty_struct *tty, struct file *file, +static int stli_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct stliport *portp = tty->driver_data; diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index fdf069bb702f..9f4cd8968a5a 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -200,7 +200,7 @@ static void moxa_stop(struct tty_struct *); static void moxa_start(struct tty_struct *); static void moxa_hangup(struct tty_struct *); static int moxa_tiocmget(struct tty_struct *tty); -static int moxa_tiocmset(struct tty_struct *tty, struct file *file, +static int moxa_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static void moxa_poll(unsigned long); static void moxa_set_tty_param(struct tty_struct *, struct ktermios *); @@ -1277,7 +1277,7 @@ static int moxa_tiocmget(struct tty_struct *tty) return flag; } -static int moxa_tiocmset(struct tty_struct *tty, struct file *file, +static int moxa_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct moxa_port *ch; diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 4d2f03ec06cd..150a862c4989 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -1347,7 +1347,7 @@ static int mxser_tiocmget(struct tty_struct *tty) ((status & UART_MSR_CTS) ? TIOCM_CTS : 0); } -static int mxser_tiocmset(struct tty_struct *tty, struct file *file, +static int mxser_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct mxser_port *info = tty->driver_data; diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c index 0e1dff2ffb1e..1b74c48c4016 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c @@ -1767,8 +1767,8 @@ static int ntty_tiocmget(struct tty_struct *tty) } /* Sets io controls parameters */ -static int ntty_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +static int ntty_tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear) { struct nozomi *dc = get_dc_by_tty(tty); unsigned long flags; diff --git a/drivers/char/pcmcia/ipwireless/tty.c b/drivers/char/pcmcia/ipwireless/tty.c index 7d2ef4909a73..748190dfbab0 100644 --- a/drivers/char/pcmcia/ipwireless/tty.c +++ b/drivers/char/pcmcia/ipwireless/tty.c @@ -410,7 +410,7 @@ static int ipw_tiocmget(struct tty_struct *linux_tty) } static int -ipw_tiocmset(struct tty_struct *linux_tty, struct file *file, +ipw_tiocmset(struct tty_struct *linux_tty, unsigned int set, unsigned int clear) { struct ipw_tty *tty = linux_tty->driver_data; diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 7b68ba6609fe..02127cad0980 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -419,8 +419,8 @@ static void bh_status(MGSLPC_INFO *info); * ioctl handlers */ static int tiocmget(struct tty_struct *tty); -static int tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear); +static int tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear); static int get_stats(MGSLPC_INFO *info, struct mgsl_icount __user *user_icount); static int get_params(MGSLPC_INFO *info, MGSL_PARAMS __user *user_params); static int set_params(MGSLPC_INFO *info, MGSL_PARAMS __user *new_params, struct tty_struct *tty); @@ -2139,7 +2139,7 @@ static int tiocmget(struct tty_struct *tty) /* set modem control signals (DTR/RTS) */ -static int tiocmset(struct tty_struct *tty, struct file *file, +static int tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 5d0c98456c93..3666decc6438 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -1115,8 +1115,8 @@ static int rc_tiocmget(struct tty_struct *tty) return result; } -static int rc_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +static int rc_tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear) { struct riscom_port *port = tty->driver_data; unsigned long flags; diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 75e98efbc8e9..36c108811a81 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c @@ -1189,8 +1189,8 @@ static int rp_tiocmget(struct tty_struct *tty) /* * Sets the modem control lines */ -static int rp_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +static int rp_tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear) { struct r_port *info = tty->driver_data; diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index fda90643ead7..89ac542ffff2 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c @@ -1331,8 +1331,7 @@ static int cy_tiocmget(struct tty_struct *tty) } /* cy_tiocmget */ static int -cy_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +cy_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct cyclades_port *info = tty->driver_data; int channel; diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index bfecfbef0895..a6b23847e4a7 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -1778,7 +1778,7 @@ static int sx_tiocmget(struct tty_struct *tty) } -static int sx_tiocmset(struct tty_struct *tty, struct file *file, +static int sx_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct specialix_port *port = tty->driver_data; diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 8c2bf3fb5b89..c42dbffbed16 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -1107,7 +1107,7 @@ static int stl_tiocmget(struct tty_struct *tty) return stl_getsignals(portp); } -static int stl_tiocmset(struct tty_struct *tty, struct file *file, +static int stl_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct stlport *portp; diff --git a/drivers/char/sx.c b/drivers/char/sx.c index f46214e60d0c..342c6ae67da5 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -1879,8 +1879,8 @@ static int sx_tiocmget(struct tty_struct *tty) return sx_getsignals(port); } -static int sx_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +static int sx_tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear) { struct sx_port *port = tty->driver_data; int rts = -1, dtr = -1; diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index d359e092904a..691e1094c20b 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -824,7 +824,7 @@ static isr_dispatch_func UscIsrTable[7] = * ioctl call handlers */ static int tiocmget(struct tty_struct *tty); -static int tiocmset(struct tty_struct *tty, struct file *file, +static int tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount __user *user_icount); @@ -2871,8 +2871,8 @@ static int tiocmget(struct tty_struct *tty) /* set modem control signals (DTR/RTS) */ -static int tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +static int tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear) { struct mgsl_struct *info = tty->driver_data; unsigned long flags; diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index f18ab8af0e1c..04da6d61dc4f 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c @@ -513,8 +513,8 @@ static int rx_enable(struct slgt_info *info, int enable); static int modem_input_wait(struct slgt_info *info,int arg); static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr); static int tiocmget(struct tty_struct *tty); -static int tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear); +static int tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear); static int set_break(struct tty_struct *tty, int break_state); static int get_interface(struct slgt_info *info, int __user *if_mode); static int set_interface(struct slgt_info *info, int if_mode); @@ -3223,7 +3223,7 @@ static int tiocmget(struct tty_struct *tty) * TIOCMSET = set/clear signal values * value bit mask for command */ -static int tiocmset(struct tty_struct *tty, struct file *file, +static int tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct slgt_info *info = tty->driver_data; diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 5900213ae75b..1f9de97e8cfc 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c @@ -547,8 +547,8 @@ static int rx_enable(SLMP_INFO *info, int enable); static int modem_input_wait(SLMP_INFO *info,int arg); static int wait_mgsl_event(SLMP_INFO *info, int __user *mask_ptr); static int tiocmget(struct tty_struct *tty); -static int tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear); +static int tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear); static int set_break(struct tty_struct *tty, int break_state); static void add_device(SLMP_INFO *info); @@ -3232,8 +3232,8 @@ static int tiocmget(struct tty_struct *tty) /* set modem control signals (DTR/RTS) */ -static int tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +static int tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear) { SLMP_INFO *info = tty->driver_data; unsigned long flags; diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index e1a7c14f5f1d..9b2bb491c614 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c @@ -123,7 +123,7 @@ static void if_throttle(struct tty_struct *tty); static void if_unthrottle(struct tty_struct *tty); static void if_set_termios(struct tty_struct *tty, struct ktermios *old); static int if_tiocmget(struct tty_struct *tty); -static int if_tiocmset(struct tty_struct *tty, struct file *file, +static int if_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static int if_write(struct tty_struct *tty, const unsigned char *buf, int count); @@ -303,7 +303,7 @@ static int if_tiocmget(struct tty_struct *tty) return retval; } -static int if_tiocmset(struct tty_struct *tty, struct file *file, +static int if_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct cardstate *cs; diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c index 0ef09d0eb96b..86a5c4f7775e 100644 --- a/drivers/isdn/gigaset/ser-gigaset.c +++ b/drivers/isdn/gigaset/ser-gigaset.c @@ -440,7 +440,7 @@ static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state, if (!set && !clear) return 0; gig_dbg(DEBUG_IF, "tiocmset set %x clear %x", set, clear); - return tty->ops->tiocmset(tty, NULL, set, clear); + return tty->ops->tiocmset(tty, set, clear); } static int gigaset_baud_rate(struct cardstate *cs, unsigned cflag) diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index ba6c2f124b58..0341c69eb152 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c @@ -1372,7 +1372,7 @@ isdn_tty_tiocmget(struct tty_struct *tty) } static int -isdn_tty_tiocmset(struct tty_struct *tty, struct file *file, +isdn_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { modem_info *info = (modem_info *) tty->driver_data; diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c index 86bb04d821b1..c8c9edb3d7cb 100644 --- a/drivers/mmc/card/sdio_uart.c +++ b/drivers/mmc/card/sdio_uart.c @@ -970,7 +970,7 @@ static int sdio_uart_tiocmget(struct tty_struct *tty) return result; } -static int sdio_uart_tiocmset(struct tty_struct *tty, struct file *file, +static int sdio_uart_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct sdio_uart_port *port = tty->driver_data; diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index ee1dde52e8fc..3352b2443e58 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c @@ -167,7 +167,7 @@ static int irtty_set_dtr_rts(struct sir_dev *dev, int dtr, int rts) * let's be careful... Jean II */ IRDA_ASSERT(priv->tty->ops->tiocmset != NULL, return -1;); - priv->tty->ops->tiocmset(priv->tty, NULL, set, clear); + priv->tty->ops->tiocmset(priv->tty, set, clear); return 0; } diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 7c68c456c035..956e1d6e72a5 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -324,7 +324,7 @@ struct hso_device { /* Prototypes */ /*****************************************************************************/ /* Serial driver functions */ -static int hso_serial_tiocmset(struct tty_struct *tty, struct file *file, +static int hso_serial_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static void ctrl_callback(struct urb *urb); static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial); @@ -1335,7 +1335,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp) /* done */ if (result) - hso_serial_tiocmset(tty, NULL, TIOCM_RTS | TIOCM_DTR, 0); + hso_serial_tiocmset(tty, TIOCM_RTS | TIOCM_DTR, 0); err_out: mutex_unlock(&serial->parent->mutex); return result; @@ -1687,7 +1687,7 @@ static int hso_serial_tiocmget(struct tty_struct *tty) return retval; } -static int hso_serial_tiocmset(struct tty_struct *tty, struct file *file, +static int hso_serial_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { int val = 0; diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index d999e54a7730..1c65d1c33873 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c @@ -131,8 +131,7 @@ static void cpc_tty_trace(pc300dev_t *dev, char* buf, int len, char rxtx); static void cpc_tty_signal_off(pc300dev_t *pc300dev, unsigned char); static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char); -static int pc300_tiocmset(struct tty_struct *, struct file *, - unsigned int, unsigned int); +static int pc300_tiocmset(struct tty_struct *, unsigned int, unsigned int); static int pc300_tiocmget(struct tty_struct *); /* functions called by PC300 driver */ @@ -543,7 +542,7 @@ static int cpc_tty_chars_in_buffer(struct tty_struct *tty) return 0; } -static int pc300_tiocmset(struct tty_struct *tty, struct file *file, +static int pc300_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { st_cpc_tty_area *cpc_tty; diff --git a/drivers/staging/quatech_usb2/quatech_usb2.c b/drivers/staging/quatech_usb2/quatech_usb2.c index 1e50292aef74..3734448d1b82 100644 --- a/drivers/staging/quatech_usb2/quatech_usb2.c +++ b/drivers/staging/quatech_usb2/quatech_usb2.c @@ -1121,7 +1121,7 @@ static int qt2_tiocmget(struct tty_struct *tty) } } -static int qt2_tiocmset(struct tty_struct *tty, struct file *file, +static int qt2_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c index 56ded56db7b4..39776c1cf10f 100644 --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c @@ -1425,7 +1425,6 @@ static inline int qt_real_tiocmget(struct tty_struct *tty, static inline int qt_real_tiocmset(struct tty_struct *tty, struct usb_serial_port *port, - struct file *file, struct usb_serial *serial, unsigned int value) { @@ -1486,7 +1485,7 @@ static int qt_tiocmget(struct tty_struct *tty) return retval; } -static int qt_tiocmset(struct tty_struct *tty, struct file *file, +static int qt_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { @@ -1506,7 +1505,7 @@ static int qt_tiocmset(struct tty_struct *tty, struct file *file, dbg("%s - port %d\n", __func__, port->number); dbg("%s - qt_port->RxHolding = %d\n", __func__, qt_port->RxHolding); - retval = qt_real_tiocmset(tty, port, file, serial, set); + retval = qt_real_tiocmset(tty, port, serial, set); spin_unlock_irqrestore(&qt_port->lock, flags); return retval; diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c index 55293105a56c..8a8d6373f164 100644 --- a/drivers/tty/hvc/hvsi.c +++ b/drivers/tty/hvc/hvsi.c @@ -1103,8 +1103,8 @@ static int hvsi_tiocmget(struct tty_struct *tty) return hp->mctrl; } -static int hvsi_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +static int hvsi_tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear) { struct hvsi_struct *hp = tty->driver_data; unsigned long flags; diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 97e3d509ff82..88477d16b8b7 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2654,7 +2654,7 @@ static int gsmtty_tiocmget(struct tty_struct *tty) return dlci->modem_rx; } -static int gsmtty_tiocmset(struct tty_struct *tty, struct file *filp, +static int gsmtty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct gsm_dlci *dlci = tty->driver_data; diff --git a/drivers/tty/serial/68360serial.c b/drivers/tty/serial/68360serial.c index 2a52cf14ce50..217fe1c299e0 100644 --- a/drivers/tty/serial/68360serial.c +++ b/drivers/tty/serial/68360serial.c @@ -1271,7 +1271,7 @@ static int rs_360_tiocmget(struct tty_struct *tty) return result; } -static int rs_360_tiocmset(struct tty_struct *tty, struct file *file, +static int rs_360_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { #ifdef modem_control diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index 8cc5c0224b25..b9fcd0bda60c 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c @@ -3581,8 +3581,7 @@ rs_break(struct tty_struct *tty, int break_state) } static int -rs_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +rs_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct e100_serial *info = (struct e100_serial *)tty->driver_data; unsigned long flags; diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index 4d26d39ec344..8ee5a41d340d 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c @@ -263,7 +263,6 @@ static int ifx_spi_tiocmget(struct tty_struct *tty) /** * ifx_spi_tiocmset - set modem bits * @tty: the tty structure - * @filp: file handle issuing the request * @set: bits to set * @clear: bits to clear * @@ -272,7 +271,7 @@ static int ifx_spi_tiocmget(struct tty_struct *tty) * * FIXME: do we need to kick the tranfers when we do this ? */ -static int ifx_spi_tiocmset(struct tty_struct *tty, struct file *filp, +static int ifx_spi_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct ifx_spi_device *ifx_dev = tty->driver_data; diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 53e490e47560..623d6bd911d7 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -925,8 +925,7 @@ static int uart_tiocmget(struct tty_struct *tty) } static int -uart_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +uart_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct uart_state *state = tty->driver_data; struct uart_port *uport = state->uart_port; @@ -934,8 +933,7 @@ uart_tiocmset(struct tty_struct *tty, struct file *file, int ret = -EIO; mutex_lock(&port->mutex); - if ((!file || !tty_hung_up_p(file)) && - !(tty->flags & (1 << TTY_IO_ERROR))) { + if (!(tty->flags & (1 << TTY_IO_ERROR))) { uart_update_mctrl(uport, set, clear); ret = 0; } diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index fde5a4dae3dd..83af24ca1e5e 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2481,7 +2481,6 @@ static int tty_tiocmget(struct tty_struct *tty, int __user *p) /** * tty_tiocmset - set modem status * @tty: tty device - * @file: user file pointer * @cmd: command - clear bits, set bits or set all * @p: pointer to desired bits * @@ -2491,7 +2490,7 @@ static int tty_tiocmget(struct tty_struct *tty, int __user *p) * Locking: none (up to the driver) */ -static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd, +static int tty_tiocmset(struct tty_struct *tty, unsigned int cmd, unsigned __user *p) { int retval; @@ -2518,7 +2517,7 @@ static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int } set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; - return tty->ops->tiocmset(tty, file, set, clear); + return tty->ops->tiocmset(tty, set, clear); } static int tty_tiocgicount(struct tty_struct *tty, void __user *arg) @@ -2659,7 +2658,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case TIOCMSET: case TIOCMBIC: case TIOCMBIS: - return tty_tiocmset(tty, file, cmd, p); + return tty_tiocmset(tty, cmd, p); case TIOCGICOUNT: retval = tty_tiocgicount(tty, p); /* For the moment allow fall through to the old method */ diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 2ae996b7ce7b..e9a26fbd079c 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -791,7 +791,7 @@ static int acm_tty_tiocmget(struct tty_struct *tty) TIOCM_CTS; } -static int acm_tty_tiocmset(struct tty_struct *tty, struct file *file, +static int acm_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct acm *acm = tty->driver_data; diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 35b610aa3f92..2f837e983339 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -511,7 +511,7 @@ static int ark3116_tiocmget(struct tty_struct *tty) (ctrl & UART_MCR_OUT2 ? TIOCM_OUT2 : 0); } -static int ark3116_tiocmset(struct tty_struct *tty, struct file *file, +static int ark3116_tiocmset(struct tty_struct *tty, unsigned set, unsigned clr) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 48fb3bad3cd6..d6921fa1403c 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c @@ -101,7 +101,7 @@ static void belkin_sa_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios * old); static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state); static int belkin_sa_tiocmget(struct tty_struct *tty); -static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, +static int belkin_sa_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); @@ -513,7 +513,7 @@ static int belkin_sa_tiocmget(struct tty_struct *tty) return control_state; } -static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, +static int belkin_sa_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index aa0962b72f4c..5cbef313281e 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -431,7 +431,7 @@ out: kfree(break_reg); } -static int ch341_tiocmset(struct tty_struct *tty, struct file *file, +static int ch341_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index b3873815035c..4df3e0cecbae 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -42,9 +42,8 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *, struct ktermios*); static int cp210x_tiocmget(struct tty_struct *); -static int cp210x_tiocmset(struct tty_struct *, struct file *, - unsigned int, unsigned int); -static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *, +static int cp210x_tiocmset(struct tty_struct *, unsigned int, unsigned int); +static int cp210x_tiocmset_port(struct usb_serial_port *port, unsigned int, unsigned int); static void cp210x_break_ctl(struct tty_struct *, int); static int cp210x_startup(struct usb_serial *); @@ -698,14 +697,14 @@ static void cp210x_set_termios(struct tty_struct *tty, } -static int cp210x_tiocmset (struct tty_struct *tty, struct file *file, +static int cp210x_tiocmset (struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; - return cp210x_tiocmset_port(port, file, set, clear); + return cp210x_tiocmset_port(port, set, clear); } -static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *file, +static int cp210x_tiocmset_port(struct usb_serial_port *port, unsigned int set, unsigned int clear) { unsigned int control = 0; @@ -737,9 +736,9 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *file, static void cp210x_dtr_rts(struct usb_serial_port *p, int on) { if (on) - cp210x_tiocmset_port(p, NULL, TIOCM_DTR|TIOCM_RTS, 0); + cp210x_tiocmset_port(p, TIOCM_DTR|TIOCM_RTS, 0); else - cp210x_tiocmset_port(p, NULL, 0, TIOCM_DTR|TIOCM_RTS); + cp210x_tiocmset_port(p, 0, TIOCM_DTR|TIOCM_RTS); } static int cp210x_tiocmget (struct tty_struct *tty) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 9c96cff691fd..2beb5a66180d 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -174,7 +174,7 @@ static int cypress_ioctl(struct tty_struct *tty, struct file *file, static void cypress_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); static int cypress_tiocmget(struct tty_struct *tty); -static int cypress_tiocmset(struct tty_struct *tty, struct file *file, +static int cypress_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static int cypress_chars_in_buffer(struct tty_struct *tty); static void cypress_throttle(struct tty_struct *tty); @@ -892,7 +892,7 @@ static int cypress_tiocmget(struct tty_struct *tty) } -static int cypress_tiocmset(struct tty_struct *tty, struct file *file, +static int cypress_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 08da46cb5825..86fbba6336c9 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -446,10 +446,10 @@ static void digi_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios); static void digi_break_ctl(struct tty_struct *tty, int break_state); static int digi_tiocmget(struct tty_struct *tty); -static int digi_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear); +static int digi_tiocmset(struct tty_struct *tty, unsigned int set, + unsigned int clear); static int digi_write(struct tty_struct *tty, struct usb_serial_port *port, - const unsigned char *buf, int count); + const unsigned char *buf, int count); static void digi_write_bulk_callback(struct urb *urb); static int digi_write_room(struct tty_struct *tty); static int digi_chars_in_buffer(struct tty_struct *tty); @@ -1134,8 +1134,8 @@ static int digi_tiocmget(struct tty_struct *tty) } -static int digi_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +static int digi_tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; struct digi_port *priv = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 281d18141051..f521ab1eb60f 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -857,7 +857,7 @@ static int ftdi_prepare_write_buffer(struct usb_serial_port *port, static void ftdi_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); static int ftdi_tiocmget(struct tty_struct *tty); -static int ftdi_tiocmset(struct tty_struct *tty, struct file *file, +static int ftdi_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static int ftdi_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); @@ -2202,7 +2202,7 @@ out: return ret; } -static int ftdi_tiocmset(struct tty_struct *tty, struct file *file, +static int ftdi_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index e8fe4dcf72f0..0b8846e27a79 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -220,7 +220,7 @@ static int edge_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); static void edge_break(struct tty_struct *tty, int break_state); static int edge_tiocmget(struct tty_struct *tty); -static int edge_tiocmset(struct tty_struct *tty, struct file *file, +static int edge_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static int edge_get_icount(struct tty_struct *tty, struct serial_icounter_struct *icount); @@ -1568,7 +1568,7 @@ static int get_lsr_info(struct edgeport_port *edge_port, return 0; } -static int edge_tiocmset(struct tty_struct *tty, struct file *file, +static int edge_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 7cb9f5cb91f3..88120523710b 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -2444,7 +2444,7 @@ static void edge_set_termios(struct tty_struct *tty, change_port_settings(tty, edge_port, old_termios); } -static int edge_tiocmset(struct tty_struct *tty, struct file *file, +static int edge_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 1d96142f135a..6aca631a407a 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -150,7 +150,7 @@ static void iuu_release(struct usb_serial *serial) } } -static int iuu_tiocmset(struct tty_struct *tty, struct file *file, +static int iuu_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 1beebbb7a20a..c6e968f24e04 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -317,7 +317,7 @@ static int keyspan_tiocmget(struct tty_struct *tty) return value; } -static int keyspan_tiocmset(struct tty_struct *tty, struct file *file, +static int keyspan_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h index 5e5fc71e68df..13fa1d1cc900 100644 --- a/drivers/usb/serial/keyspan.h +++ b/drivers/usb/serial/keyspan.h @@ -60,7 +60,7 @@ static void keyspan_break_ctl (struct tty_struct *tty, int break_state); static int keyspan_tiocmget (struct tty_struct *tty); static int keyspan_tiocmset (struct tty_struct *tty, - struct file *file, unsigned int set, + unsigned int set, unsigned int clear); static int keyspan_fake_startup (struct usb_serial *serial); diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 49ad2baf77cd..207caabdc4ff 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -478,7 +478,7 @@ static int keyspan_pda_tiocmget(struct tty_struct *tty) return value; } -static int keyspan_pda_tiocmset(struct tty_struct *tty, struct file *file, +static int keyspan_pda_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index a570f5201c73..19373cb7c5bf 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -69,7 +69,7 @@ static void klsi_105_close(struct usb_serial_port *port); static void klsi_105_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); static int klsi_105_tiocmget(struct tty_struct *tty); -static int klsi_105_tiocmset(struct tty_struct *tty, struct file *file, +static int klsi_105_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static void klsi_105_process_read_urb(struct urb *urb); static int klsi_105_prepare_write_buffer(struct usb_serial_port *port, @@ -661,7 +661,7 @@ static int klsi_105_tiocmget(struct tty_struct *tty) return (int)line_state; } -static int klsi_105_tiocmset(struct tty_struct *tty, struct file *file, +static int klsi_105_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { int retval = -EINVAL; diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 81d07fb299b8..22cd0c08f46f 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -78,7 +78,7 @@ static int kobil_write_room(struct tty_struct *tty); static int kobil_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); static int kobil_tiocmget(struct tty_struct *tty); -static int kobil_tiocmset(struct tty_struct *tty, struct file *file, +static int kobil_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static void kobil_read_int_callback(struct urb *urb); static void kobil_write_callback(struct urb *purb); @@ -544,7 +544,7 @@ static int kobil_tiocmget(struct tty_struct *tty) return result; } -static int kobil_tiocmset(struct tty_struct *tty, struct file *file, +static int kobil_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index 27447095feae..ef49902c5a51 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c @@ -102,7 +102,7 @@ static void mct_u232_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); static void mct_u232_break_ctl(struct tty_struct *tty, int break_state); static int mct_u232_tiocmget(struct tty_struct *tty); -static int mct_u232_tiocmset(struct tty_struct *tty, struct file *file, +static int mct_u232_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static void mct_u232_throttle(struct tty_struct *tty); static void mct_u232_unthrottle(struct tty_struct *tty); @@ -778,7 +778,7 @@ static int mct_u232_tiocmget(struct tty_struct *tty) return control_state; } -static int mct_u232_tiocmset(struct tty_struct *tty, struct file *file, +static int mct_u232_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 5d40d4151b5a..95b1c64cac03 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -1858,7 +1858,7 @@ static int mos7720_tiocmget(struct tty_struct *tty) return result; } -static int mos7720_tiocmset(struct tty_struct *tty, struct file *file, +static int mos7720_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index ee0dc9a0890c..9424178c6689 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -1674,7 +1674,7 @@ static int mos7840_tiocmget(struct tty_struct *tty) return result; } -static int mos7840_tiocmset(struct tty_struct *tty, struct file *file, +static int mos7840_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 4cd3b0ef4e61..63734cb0fb0f 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c @@ -145,7 +145,7 @@ static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port, static int oti6858_write_room(struct tty_struct *tty); static int oti6858_chars_in_buffer(struct tty_struct *tty); static int oti6858_tiocmget(struct tty_struct *tty); -static int oti6858_tiocmset(struct tty_struct *tty, struct file *file, +static int oti6858_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static int oti6858_startup(struct usb_serial *serial); static void oti6858_release(struct usb_serial *serial); @@ -624,7 +624,7 @@ static void oti6858_close(struct usb_serial_port *port) usb_kill_urb(port->interrupt_in_urb); } -static int oti6858_tiocmset(struct tty_struct *tty, struct file *file, +static int oti6858_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 6cb4f503a3f1..b797992fa54b 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -505,7 +505,7 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) return 0; } -static int pl2303_tiocmset(struct tty_struct *tty, struct file *file, +static int pl2303_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 66437f1e9e5b..79ee6c79ad54 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -408,7 +408,7 @@ static int sierra_tiocmget(struct tty_struct *tty) return value; } -static int sierra_tiocmset(struct tty_struct *tty, struct file *file, +static int sierra_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index cac13009fc5c..dfbc543e0db8 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c @@ -595,7 +595,7 @@ static int spcp8x5_ioctl(struct tty_struct *tty, struct file *file, return -ENOIOCTLCMD; } -static int spcp8x5_tiocmset(struct tty_struct *tty, struct file *file, +static int spcp8x5_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index b21583fa825c..abceee9d3af9 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c @@ -517,7 +517,7 @@ mget_out: return r; } -static int ssu100_tiocmset(struct tty_struct *tty, struct file *file, +static int ssu100_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 223e60e31735..c7fea4a2a1be 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -113,7 +113,7 @@ static int ti_get_icount(struct tty_struct *tty, static void ti_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios); static int ti_tiocmget(struct tty_struct *tty); -static int ti_tiocmset(struct tty_struct *tty, struct file *file, +static int ti_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static void ti_break(struct tty_struct *tty, int break_state); static void ti_interrupt_callback(struct urb *urb); @@ -1033,8 +1033,8 @@ static int ti_tiocmget(struct tty_struct *tty) } -static int ti_tiocmset(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear) +static int ti_tiocmset(struct tty_struct *tty, + unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; struct ti_port *tport = usb_get_serial_port_data(port); diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index df105c6531a1..dab679e5b7ea 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -507,7 +507,7 @@ static int serial_tiocmget(struct tty_struct *tty) return -EINVAL; } -static int serial_tiocmset(struct tty_struct *tty, struct file *file, +static int serial_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; @@ -515,7 +515,7 @@ static int serial_tiocmset(struct tty_struct *tty, struct file *file, dbg("%s - port %d", __func__, port->number); if (port->serial->type->tiocmset) - return port->serial->type->tiocmset(tty, file, set, clear); + return port->serial->type->tiocmset(tty, set, clear); return -EINVAL; } diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h index 8b68fc783d5f..4d65f1c8dd93 100644 --- a/drivers/usb/serial/usb-wwan.h +++ b/drivers/usb/serial/usb-wwan.h @@ -16,7 +16,7 @@ extern void usb_wwan_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); extern int usb_wwan_tiocmget(struct tty_struct *tty); -extern int usb_wwan_tiocmset(struct tty_struct *tty, struct file *file, +extern int usb_wwan_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); extern int usb_wwan_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index 60f942632cb4..b72912027ae8 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -98,7 +98,7 @@ int usb_wwan_tiocmget(struct tty_struct *tty) } EXPORT_SYMBOL(usb_wwan_tiocmget); -int usb_wwan_tiocmset(struct tty_struct *tty, struct file *file, +int usb_wwan_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index bf850139e0b8..6e0c397e869f 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -157,7 +157,7 @@ static int whiteheat_ioctl(struct tty_struct *tty, struct file *file, static void whiteheat_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); static int whiteheat_tiocmget(struct tty_struct *tty); -static int whiteheat_tiocmset(struct tty_struct *tty, struct file *file, +static int whiteheat_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); static void whiteheat_break_ctl(struct tty_struct *tty, int break_state); static int whiteheat_chars_in_buffer(struct tty_struct *tty); @@ -850,7 +850,7 @@ static int whiteheat_tiocmget(struct tty_struct *tty) return modem_signals; } -static int whiteheat_tiocmset(struct tty_struct *tty, struct file *file, +static int whiteheat_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 9539d74171db..5dabaa2e6da3 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -272,7 +272,7 @@ struct tty_operations { void (*wait_until_sent)(struct tty_struct *tty, int timeout); void (*send_xchar)(struct tty_struct *tty, char ch); int (*tiocmget)(struct tty_struct *tty); - int (*tiocmset)(struct tty_struct *tty, struct file *file, + int (*tiocmset)(struct tty_struct *tty, unsigned int set, unsigned int clear); int (*resize)(struct tty_struct *tty, struct winsize *ws); int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew); diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 30b945397d19..c1aa1b243ba3 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -269,7 +269,7 @@ struct usb_serial_driver { void (*throttle)(struct tty_struct *tty); void (*unthrottle)(struct tty_struct *tty); int (*tiocmget)(struct tty_struct *tty); - int (*tiocmset)(struct tty_struct *tty, struct file *file, + int (*tiocmset)(struct tty_struct *tty, unsigned int set, unsigned int clear); int (*get_icount)(struct tty_struct *tty, struct serial_icounter_struct *icount); diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h index fa3793b5392d..980ccb66e1b4 100644 --- a/include/net/irda/ircomm_tty.h +++ b/include/net/irda/ircomm_tty.h @@ -121,7 +121,7 @@ void ircomm_tty_start(struct tty_struct *tty); void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self); extern int ircomm_tty_tiocmget(struct tty_struct *tty); -extern int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, +extern int ircomm_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 7f67fa4f2f5e..8e78e7447726 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -1098,7 +1098,7 @@ static int rfcomm_tty_tiocmget(struct tty_struct *tty) return dev->modem_status; } -static int rfcomm_tty_tiocmset(struct tty_struct *tty, struct file *filp, unsigned int set, unsigned int clear) +static int rfcomm_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; struct rfcomm_dlc *dlc = dev->dlc; diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c index bb47caeba7e6..5e0e718c930a 100644 --- a/net/irda/ircomm/ircomm_tty_ioctl.c +++ b/net/irda/ircomm/ircomm_tty_ioctl.c @@ -214,12 +214,12 @@ int ircomm_tty_tiocmget(struct tty_struct *tty) } /* - * Function ircomm_tty_tiocmset (tty, file, set, clear) + * Function ircomm_tty_tiocmset (tty, set, clear) * * * */ -int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, +int ircomm_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; From 00a0d0d65b61241a718d0aee96f46b9a2d93bf26 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 14 Feb 2011 16:27:06 +0000 Subject: [PATCH 36/76] tty: remove filp from the USB tty ioctls We don't use it so we can trim it from here as we try and stamp the file object dependencies out of the serial code. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/quatech_usb2/quatech_usb2.c | 2 +- drivers/staging/serqt_usb2/serqt_usb2.c | 2 +- drivers/usb/serial/ark3116.c | 2 +- drivers/usb/serial/ch341.c | 3 +-- drivers/usb/serial/cypress_m8.c | 4 ++-- drivers/usb/serial/ftdi_sio.c | 4 ++-- drivers/usb/serial/io_edgeport.c | 4 ++-- drivers/usb/serial/io_ti.c | 2 +- drivers/usb/serial/kobil_sct.c | 4 ++-- drivers/usb/serial/mos7720.c | 2 +- drivers/usb/serial/mos7840.c | 2 +- drivers/usb/serial/opticon.c | 2 +- drivers/usb/serial/oti6858.c | 4 ++-- drivers/usb/serial/pl2303.c | 2 +- drivers/usb/serial/spcp8x5.c | 2 +- drivers/usb/serial/ssu100.c | 2 +- drivers/usb/serial/ti_usb_3410_5052.c | 4 ++-- drivers/usb/serial/usb-serial.c | 2 +- drivers/usb/serial/usb-wwan.h | 2 +- drivers/usb/serial/usb_wwan.c | 2 +- drivers/usb/serial/whiteheat.c | 4 ++-- include/linux/usb/serial.h | 2 +- 22 files changed, 29 insertions(+), 30 deletions(-) diff --git a/drivers/staging/quatech_usb2/quatech_usb2.c b/drivers/staging/quatech_usb2/quatech_usb2.c index 3734448d1b82..36b18e302718 100644 --- a/drivers/staging/quatech_usb2/quatech_usb2.c +++ b/drivers/staging/quatech_usb2/quatech_usb2.c @@ -852,7 +852,7 @@ static int qt2_chars_in_buffer(struct tty_struct *tty) * TIOCMGET and TIOCMSET are filtered off to their own methods before they get * here, so we don't have to handle them. */ -static int qt2_ioctl(struct tty_struct *tty, struct file *file, +static int qt2_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c index 39776c1cf10f..e0aae86a8809 100644 --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c @@ -1191,7 +1191,7 @@ static int qt_write_room(struct tty_struct *tty) } -static int qt_ioctl(struct tty_struct *tty, struct file *file, +static int qt_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 2f837e983339..5cdb9d912275 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -431,7 +431,7 @@ static int ark3116_get_icount(struct tty_struct *tty, return 0; } -static int ark3116_ioctl(struct tty_struct *tty, struct file *file, +static int ark3116_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 5cbef313281e..d0b9feac5dc3 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -552,8 +552,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) return 0; } -/*static int ch341_ioctl(struct usb_serial_port *port, struct file *file,*/ -static int ch341_ioctl(struct tty_struct *tty, struct file *file, +static int ch341_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 2beb5a66180d..987e9bf7bd02 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -169,7 +169,7 @@ static int cypress_write(struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count); static void cypress_send(struct usb_serial_port *port); static int cypress_write_room(struct tty_struct *tty); -static int cypress_ioctl(struct tty_struct *tty, struct file *file, +static int cypress_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); static void cypress_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); @@ -917,7 +917,7 @@ static int cypress_tiocmset(struct tty_struct *tty, } -static int cypress_ioctl(struct tty_struct *tty, struct file *file, +static int cypress_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index f521ab1eb60f..e3e23a4e227d 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -859,7 +859,7 @@ static void ftdi_set_termios(struct tty_struct *tty, static int ftdi_tiocmget(struct tty_struct *tty); static int ftdi_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); -static int ftdi_ioctl(struct tty_struct *tty, struct file *file, +static int ftdi_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); static void ftdi_break_ctl(struct tty_struct *tty, int break_state); @@ -2210,7 +2210,7 @@ static int ftdi_tiocmset(struct tty_struct *tty, return update_mctrl(port, set, clear); } -static int ftdi_ioctl(struct tty_struct *tty, struct file *file, +static int ftdi_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 0b8846e27a79..ae91bcdcb2bc 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -216,7 +216,7 @@ static void edge_unthrottle(struct tty_struct *tty); static void edge_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios); -static int edge_ioctl(struct tty_struct *tty, struct file *file, +static int edge_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); static void edge_break(struct tty_struct *tty, int break_state); static int edge_tiocmget(struct tty_struct *tty); @@ -1679,7 +1679,7 @@ static int get_serial_info(struct edgeport_port *edge_port, * SerialIoctl * this function handles any ioctl calls to the driver *****************************************************************************/ -static int edge_ioctl(struct tty_struct *tty, struct file *file, +static int edge_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 88120523710b..d8434910fa7b 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -2552,7 +2552,7 @@ static int get_serial_info(struct edgeport_port *edge_port, return 0; } -static int edge_ioctl(struct tty_struct *tty, struct file *file, +static int edge_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 22cd0c08f46f..667863ef0625 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -75,7 +75,7 @@ static void kobil_close(struct usb_serial_port *port); static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count); static int kobil_write_room(struct tty_struct *tty); -static int kobil_ioctl(struct tty_struct *tty, struct file *file, +static int kobil_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); static int kobil_tiocmget(struct tty_struct *tty); static int kobil_tiocmset(struct tty_struct *tty, @@ -668,7 +668,7 @@ static void kobil_set_termios(struct tty_struct *tty, ); } -static int kobil_ioctl(struct tty_struct *tty, struct file *file, +static int kobil_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 95b1c64cac03..d8b3e8fa14e9 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -1987,7 +1987,7 @@ static int get_serial_info(struct moschip_port *mos7720_port, return 0; } -static int mos7720_ioctl(struct tty_struct *tty, struct file *file, +static int mos7720_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 9424178c6689..7b50aa122752 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -2235,7 +2235,7 @@ static int mos7840_get_icount(struct tty_struct *tty, * this function handles any ioctl calls to the driver *****************************************************************************/ -static int mos7840_ioctl(struct tty_struct *tty, struct file *file, +static int mos7840_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index e305df807396..8d603a1ca2eb 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c @@ -396,7 +396,7 @@ static int get_serial_info(struct opticon_private *priv, return 0; } -static int opticon_ioctl(struct tty_struct *tty, struct file *file, +static int opticon_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 63734cb0fb0f..4c29e6c2bda7 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c @@ -135,7 +135,7 @@ static void oti6858_close(struct usb_serial_port *port); static void oti6858_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); static void oti6858_init_termios(struct tty_struct *tty); -static int oti6858_ioctl(struct tty_struct *tty, struct file *file, +static int oti6858_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); static void oti6858_read_int_callback(struct urb *urb); static void oti6858_read_bulk_callback(struct urb *urb); @@ -728,7 +728,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) return 0; } -static int oti6858_ioctl(struct tty_struct *tty, struct file *file, +static int oti6858_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index b797992fa54b..30461fcc2206 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -606,7 +606,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) return 0; } -static int pl2303_ioctl(struct tty_struct *tty, struct file *file, +static int pl2303_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct serial_struct ser; diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index dfbc543e0db8..180ea6c7911c 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c @@ -576,7 +576,7 @@ static int spcp8x5_wait_modem_info(struct usb_serial_port *port, return 0; } -static int spcp8x5_ioctl(struct tty_struct *tty, struct file *file, +static int spcp8x5_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index abceee9d3af9..87362e48796e 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c @@ -439,7 +439,7 @@ static int ssu100_get_icount(struct tty_struct *tty, -static int ssu100_ioctl(struct tty_struct *tty, struct file *file, +static int ssu100_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index c7fea4a2a1be..f4a57ad27db8 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -106,7 +106,7 @@ static int ti_write_room(struct tty_struct *tty); static int ti_chars_in_buffer(struct tty_struct *tty); static void ti_throttle(struct tty_struct *tty); static void ti_unthrottle(struct tty_struct *tty); -static int ti_ioctl(struct tty_struct *tty, struct file *file, +static int ti_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); static int ti_get_icount(struct tty_struct *tty, struct serial_icounter_struct *icount); @@ -818,7 +818,7 @@ static int ti_get_icount(struct tty_struct *tty, return 0; } -static int ti_ioctl(struct tty_struct *tty, struct file *file, +static int ti_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index dab679e5b7ea..b1110e136c33 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -417,7 +417,7 @@ static int serial_ioctl(struct tty_struct *tty, struct file *file, /* pass on to the driver specific version of this function if it is available */ if (port->serial->type->ioctl) { - retval = port->serial->type->ioctl(tty, file, cmd, arg); + retval = port->serial->type->ioctl(tty, cmd, arg); } else retval = -ENOIOCTLCMD; return retval; diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h index 4d65f1c8dd93..c47b6ec03063 100644 --- a/drivers/usb/serial/usb-wwan.h +++ b/drivers/usb/serial/usb-wwan.h @@ -18,7 +18,7 @@ extern void usb_wwan_set_termios(struct tty_struct *tty, extern int usb_wwan_tiocmget(struct tty_struct *tty); extern int usb_wwan_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); -extern int usb_wwan_ioctl(struct tty_struct *tty, struct file *file, +extern int usb_wwan_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); extern int usb_wwan_send_setup(struct usb_serial_port *port); extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port, diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index b72912027ae8..b38d77b389d4 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -178,7 +178,7 @@ static int set_serial_info(struct usb_serial_port *port, return retval; } -int usb_wwan_ioctl(struct tty_struct *tty, struct file *file, +int usb_wwan_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 6e0c397e869f..5b073bcc807b 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -152,7 +152,7 @@ static int whiteheat_write(struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count); static int whiteheat_write_room(struct tty_struct *tty); -static int whiteheat_ioctl(struct tty_struct *tty, struct file *file, +static int whiteheat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); static void whiteheat_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); @@ -874,7 +874,7 @@ static int whiteheat_tiocmset(struct tty_struct *tty, } -static int whiteheat_ioctl(struct tty_struct *tty, struct file *file, +static int whiteheat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index c1aa1b243ba3..00e98ee5fba0 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -260,7 +260,7 @@ struct usb_serial_driver { const unsigned char *buf, int count); /* Called only by the tty layer */ int (*write_room)(struct tty_struct *tty); - int (*ioctl)(struct tty_struct *tty, struct file *file, + int (*ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg); void (*set_termios)(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); From 6caa76b7786891b42b66a0e61e2c2fff2c884620 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 14 Feb 2011 16:27:22 +0000 Subject: [PATCH 37/76] tty: now phase out the ioctl file pointer for good Only oddities here are a couple of drivers that bogusly called the ldisc helpers instead of returning -ENOIOCTLCMD. Fix the bug and the rest goes away. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/char/amiserial.c | 2 +- drivers/char/cyclades.c | 2 +- drivers/char/epca.c | 8 ++++---- drivers/char/ip2/ip2main.c | 4 ++-- drivers/char/isicom.c | 2 +- drivers/char/istallion.c | 4 ++-- drivers/char/moxa.c | 2 +- drivers/char/mxser.c | 2 +- drivers/char/nozomi.c | 2 +- drivers/char/pcmcia/ipwireless/tty.c | 4 ++-- drivers/char/riscom8.c | 2 +- drivers/char/rocket.c | 2 +- drivers/char/ser_a2232.c | 6 +++--- drivers/char/serial167.c | 2 +- drivers/char/specialix.c | 2 +- drivers/char/stallion.c | 5 ++--- drivers/char/sx.c | 2 +- drivers/char/synclink.c | 3 +-- drivers/char/synclink_gt.c | 9 ++++----- drivers/char/synclinkmp.c | 5 ++--- drivers/char/ttyprintk.c | 2 +- drivers/char/vme_scc.c | 4 ++-- drivers/isdn/capi/capi.c | 10 ++-------- drivers/isdn/gigaset/interface.c | 4 ++-- drivers/isdn/i4l/isdn_tty.c | 3 +-- drivers/net/usb/hso.c | 2 +- drivers/tty/n_gsm.c | 2 +- drivers/tty/pty.c | 4 ++-- drivers/tty/serial/68328serial.c | 2 +- drivers/tty/serial/68360serial.c | 2 +- drivers/tty/serial/crisv10.c | 2 +- drivers/tty/serial/serial_core.c | 4 ++-- drivers/tty/tty_io.c | 4 ++-- drivers/tty/vt/vt_ioctl.c | 6 +++--- drivers/usb/class/cdc-acm.c | 2 +- drivers/usb/serial/usb-serial.c | 2 +- include/linux/tty.h | 2 +- include/linux/tty_driver.h | 9 ++++----- include/net/irda/ircomm_tty.h | 2 +- net/bluetooth/rfcomm/tty.c | 2 +- net/irda/ircomm/ircomm_tty_ioctl.c | 4 ++-- 41 files changed, 66 insertions(+), 78 deletions(-) diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 5c15fad71ad2..f214e5022472 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c @@ -1293,7 +1293,7 @@ static int rs_get_icount(struct tty_struct *tty, return 0; } -static int rs_ioctl(struct tty_struct *tty, struct file * file, +static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct async_struct * info = tty->driver_data; diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 942b6f2b70a4..c99728f0cd9f 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -2680,7 +2680,7 @@ static int cy_cflags_changed(struct cyclades_port *info, unsigned long arg, * not recognized by the driver, it should return ENOIOCTLCMD. */ static int -cy_ioctl(struct tty_struct *tty, struct file *file, +cy_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct cyclades_port *info = tty->driver_data; diff --git a/drivers/char/epca.c b/drivers/char/epca.c index e5872b59f9cd..7ad3638967ae 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -175,9 +175,9 @@ static unsigned termios2digi_i(struct channel *ch, unsigned); static unsigned termios2digi_c(struct channel *ch, unsigned); static void epcaparam(struct tty_struct *, struct channel *); static void receive_data(struct channel *, struct tty_struct *tty); -static int pc_ioctl(struct tty_struct *, struct file *, +static int pc_ioctl(struct tty_struct *, unsigned int, unsigned long); -static int info_ioctl(struct tty_struct *, struct file *, +static int info_ioctl(struct tty_struct *, unsigned int, unsigned long); static void pc_set_termios(struct tty_struct *, struct ktermios *); static void do_softint(struct work_struct *work); @@ -1919,7 +1919,7 @@ static void receive_data(struct channel *ch, struct tty_struct *tty) tty_schedule_flip(tty); } -static int info_ioctl(struct tty_struct *tty, struct file *file, +static int info_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { switch (cmd) { @@ -2057,7 +2057,7 @@ static int pc_tiocmset(struct tty_struct *tty, return 0; } -static int pc_ioctl(struct tty_struct *tty, struct file *file, +static int pc_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { digiflow_t dflow; diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index d5f866c7c672..ea7a8fb08283 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c @@ -173,7 +173,7 @@ static void ip2_flush_chars(PTTY); static int ip2_write_room(PTTY); static int ip2_chars_in_buf(PTTY); static void ip2_flush_buffer(PTTY); -static int ip2_ioctl(PTTY, struct file *, UINT, ULONG); +static int ip2_ioctl(PTTY, UINT, ULONG); static void ip2_set_termios(PTTY, struct ktermios *); static void ip2_set_line_discipline(PTTY); static void ip2_throttle(PTTY); @@ -2127,7 +2127,7 @@ static int ip2_tiocmset(struct tty_struct *tty, /* */ /******************************************************************************/ static int -ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) +ip2_ioctl ( PTTY tty, UINT cmd, ULONG arg ) { wait_queue_t wait; i2ChanStrPtr pCh = DevTable[tty->index]; diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 60f4d8ae7a49..db1cf9c328d8 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -1167,7 +1167,7 @@ static int isicom_get_serial_info(struct isi_port *port, return 0; } -static int isicom_ioctl(struct tty_struct *tty, struct file *filp, +static int isicom_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct isi_port *port = tty->driver_data; diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 763b58d58255..0b266272cccd 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c @@ -603,7 +603,7 @@ static int stli_putchar(struct tty_struct *tty, unsigned char ch); static void stli_flushchars(struct tty_struct *tty); static int stli_writeroom(struct tty_struct *tty); static int stli_charsinbuffer(struct tty_struct *tty); -static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); +static int stli_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); static void stli_settermios(struct tty_struct *tty, struct ktermios *old); static void stli_throttle(struct tty_struct *tty); static void stli_unthrottle(struct tty_struct *tty); @@ -1556,7 +1556,7 @@ static int stli_tiocmset(struct tty_struct *tty, sizeof(asysigs_t), 0); } -static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) +static int stli_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct stliport *portp; struct stlibrd *brdp; diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 9f4cd8968a5a..35b0c38590e6 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -287,7 +287,7 @@ static void moxa_low_water_check(void __iomem *ofsAddr) * TTY operations */ -static int moxa_ioctl(struct tty_struct *tty, struct file *file, +static int moxa_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct moxa_port *ch = tty->driver_data; diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 150a862c4989..d188f378684d 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -1655,7 +1655,7 @@ static int mxser_cflags_changed(struct mxser_port *info, unsigned long arg, return ret; } -static int mxser_ioctl(struct tty_struct *tty, struct file *file, +static int mxser_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct mxser_port *info = tty->driver_data; diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c index 1b74c48c4016..513ba12064ea 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c @@ -1824,7 +1824,7 @@ static int ntty_tiocgicount(struct tty_struct *tty, return 0; } -static int ntty_ioctl(struct tty_struct *tty, struct file *file, +static int ntty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct port *port = tty->driver_data; diff --git a/drivers/char/pcmcia/ipwireless/tty.c b/drivers/char/pcmcia/ipwireless/tty.c index 748190dfbab0..ef92869502a7 100644 --- a/drivers/char/pcmcia/ipwireless/tty.c +++ b/drivers/char/pcmcia/ipwireless/tty.c @@ -425,7 +425,7 @@ ipw_tiocmset(struct tty_struct *linux_tty, return set_control_lines(tty, set, clear); } -static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file, +static int ipw_ioctl(struct tty_struct *linux_tty, unsigned int cmd, unsigned long arg) { struct ipw_tty *tty = linux_tty->driver_data; @@ -484,7 +484,7 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file, return tty_perform_flush(linux_tty, arg); } } - return tty_mode_ioctl(linux_tty, file, cmd , arg); + return -ENOIOCTLCMD; } static int add_tty(int j, diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 3666decc6438..602643a40b4b 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -1236,7 +1236,7 @@ static int rc_get_serial_info(struct riscom_port *port, return copy_to_user(retinfo, &tmp, sizeof(tmp)) ? -EFAULT : 0; } -static int rc_ioctl(struct tty_struct *tty, struct file *filp, +static int rc_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct riscom_port *port = tty->driver_data; diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 36c108811a81..3780da8ad12d 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c @@ -1326,7 +1326,7 @@ static int get_version(struct r_port *info, struct rocket_version __user *retver } /* IOCTL call handler into the driver */ -static int rp_ioctl(struct tty_struct *tty, struct file *file, +static int rp_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct r_port *info = tty->driver_data; diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c index 9610861d1f5f..3f47c2ead8e5 100644 --- a/drivers/char/ser_a2232.c +++ b/drivers/char/ser_a2232.c @@ -133,8 +133,8 @@ static void a2232_hungup(void *ptr); /* END GENERIC_SERIAL PROTOTYPES */ /* Functions that the TTY driver struct expects */ -static int a2232_ioctl(struct tty_struct *tty, struct file *file, - unsigned int cmd, unsigned long arg); +static int a2232_ioctl(struct tty_struct *tty, + unsigned int cmd, unsigned long arg); static void a2232_throttle(struct tty_struct *tty); static void a2232_unthrottle(struct tty_struct *tty); static int a2232_open(struct tty_struct * tty, struct file * filp); @@ -447,7 +447,7 @@ static void a2232_hungup(void *ptr) /*** END OF REAL_DRIVER FUNCTIONS ***/ /*** BEGIN FUNCTIONS EXPECTED BY TTY DRIVER STRUCTS ***/ -static int a2232_ioctl( struct tty_struct *tty, struct file *file, +static int a2232_ioctl( struct tty_struct *tty, unsigned int cmd, unsigned long arg) { return -ENOIOCTLCMD; diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index 89ac542ffff2..674af6933978 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c @@ -1492,7 +1492,7 @@ get_default_timeout(struct cyclades_port *info, unsigned long __user * value) } static int -cy_ioctl(struct tty_struct *tty, struct file *file, +cy_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct cyclades_port *info = tty->driver_data; diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index a6b23847e4a7..47e5753f732a 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -1928,7 +1928,7 @@ static int sx_get_serial_info(struct specialix_port *port, } -static int sx_ioctl(struct tty_struct *tty, struct file *filp, +static int sx_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct specialix_port *port = tty->driver_data; diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index c42dbffbed16..4fff5cd3b163 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -1132,14 +1132,13 @@ static int stl_tiocmset(struct tty_struct *tty, return 0; } -static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) +static int stl_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct stlport *portp; int rc; void __user *argp = (void __user *)arg; - pr_debug("stl_ioctl(tty=%p,file=%p,cmd=%x,arg=%lx)\n", tty, file, cmd, - arg); + pr_debug("stl_ioctl(tty=%p,cmd=%x,arg=%lx)\n", tty, cmd, arg); portp = tty->driver_data; if (portp == NULL) diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 342c6ae67da5..1291462bcddb 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -1899,7 +1899,7 @@ static int sx_tiocmset(struct tty_struct *tty, return 0; } -static int sx_ioctl(struct tty_struct *tty, struct file *filp, +static int sx_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { int rc; diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 691e1094c20b..18888d005a0a 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -2962,13 +2962,12 @@ static int msgl_get_icount(struct tty_struct *tty, * Arguments: * * tty pointer to tty instance data - * file pointer to associated file object for device * cmd IOCTL command code * arg command argument/context * * Return Value: 0 if success, otherwise error code */ -static int mgsl_ioctl(struct tty_struct *tty, struct file * file, +static int mgsl_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct mgsl_struct * info = tty->driver_data; diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 04da6d61dc4f..a35dd549a008 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c @@ -154,7 +154,7 @@ static void flush_buffer(struct tty_struct *tty); static void tx_hold(struct tty_struct *tty); static void tx_release(struct tty_struct *tty); -static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); +static int ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); static int chars_in_buffer(struct tty_struct *tty); static void throttle(struct tty_struct * tty); static void unthrottle(struct tty_struct * tty); @@ -1030,13 +1030,12 @@ static void tx_release(struct tty_struct *tty) * Arguments * * tty pointer to tty instance data - * file pointer to associated file object for device * cmd IOCTL command code * arg command argument/context * * Return 0 if success, otherwise error code */ -static int ioctl(struct tty_struct *tty, struct file *file, +static int ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct slgt_info *info = tty->driver_data; @@ -1200,7 +1199,7 @@ static long set_params32(struct slgt_info *info, struct MGSL_PARAMS32 __user *ne return 0; } -static long slgt_compat_ioctl(struct tty_struct *tty, struct file *file, +static long slgt_compat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct slgt_info *info = tty->driver_data; @@ -1239,7 +1238,7 @@ static long slgt_compat_ioctl(struct tty_struct *tty, struct file *file, case MGSL_IOCSIF: case MGSL_IOCSXSYNC: case MGSL_IOCSXCTRL: - rc = ioctl(tty, file, cmd, arg); + rc = ioctl(tty, cmd, arg); break; } diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 1f9de97e8cfc..327343694473 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c @@ -520,7 +520,7 @@ static void flush_buffer(struct tty_struct *tty); static void tx_hold(struct tty_struct *tty); static void tx_release(struct tty_struct *tty); -static int ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); +static int ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); static int chars_in_buffer(struct tty_struct *tty); static void throttle(struct tty_struct * tty); static void unthrottle(struct tty_struct * tty); @@ -1248,13 +1248,12 @@ static void tx_release(struct tty_struct *tty) * Arguments: * * tty pointer to tty instance data - * file pointer to associated file object for device * cmd IOCTL command code * arg command argument/context * * Return Value: 0 if success, otherwise error code */ -static int ioctl(struct tty_struct *tty, struct file *file, +static int ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { SLMP_INFO *info = tty->driver_data; diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c index c40c1612c8a7..a1f68af4ccf4 100644 --- a/drivers/char/ttyprintk.c +++ b/drivers/char/ttyprintk.c @@ -144,7 +144,7 @@ static int tpk_write_room(struct tty_struct *tty) /* * TTY operations ioctl function. */ -static int tpk_ioctl(struct tty_struct *tty, struct file *file, +static int tpk_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct ttyprintk_port *tpkp = tty->driver_data; diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index 12de1202d22c..96838640f575 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c @@ -75,7 +75,7 @@ static void scc_hungup(void *ptr); static void scc_close(void *ptr); static int scc_chars_in_buffer(void * ptr); static int scc_open(struct tty_struct * tty, struct file * filp); -static int scc_ioctl(struct tty_struct * tty, struct file * filp, +static int scc_ioctl(struct tty_struct * tty, unsigned int cmd, unsigned long arg); static void scc_throttle(struct tty_struct *tty); static void scc_unthrottle(struct tty_struct *tty); @@ -1046,7 +1046,7 @@ static void scc_unthrottle (struct tty_struct * tty) } -static int scc_ioctl(struct tty_struct *tty, struct file *file, +static int scc_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { return -ENOIOCTLCMD; diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index f80a7c48a35f..0d7088367038 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1219,16 +1219,10 @@ static int capinc_tty_chars_in_buffer(struct tty_struct *tty) return mp->outbytes; } -static int capinc_tty_ioctl(struct tty_struct *tty, struct file * file, +static int capinc_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { - int error = 0; - switch (cmd) { - default: - error = n_tty_ioctl_helper(tty, file, cmd, arg); - break; - } - return error; + return -ENOIOCTLCMD; } static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old) diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index 9b2bb491c614..59de638225fe 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c @@ -115,7 +115,7 @@ static int if_config(struct cardstate *cs, int *arg) static int if_open(struct tty_struct *tty, struct file *filp); static void if_close(struct tty_struct *tty, struct file *filp); -static int if_ioctl(struct tty_struct *tty, struct file *file, +static int if_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); static int if_write_room(struct tty_struct *tty); static int if_chars_in_buffer(struct tty_struct *tty); @@ -205,7 +205,7 @@ static void if_close(struct tty_struct *tty, struct file *filp) module_put(cs->driver->owner); } -static int if_ioctl(struct tty_struct *tty, struct file *file, +static int if_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct cardstate *cs; diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 0341c69eb152..3d88f15aa218 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c @@ -1413,8 +1413,7 @@ isdn_tty_tiocmset(struct tty_struct *tty, } static int -isdn_tty_ioctl(struct tty_struct *tty, struct file *file, - uint cmd, ulong arg) +isdn_tty_ioctl(struct tty_struct *tty, uint cmd, ulong arg) { modem_info *info = (modem_info *) tty->driver_data; int retval; diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 956e1d6e72a5..2ad58a0377b7 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -1730,7 +1730,7 @@ static int hso_serial_tiocmset(struct tty_struct *tty, USB_CTRL_SET_TIMEOUT); } -static int hso_serial_ioctl(struct tty_struct *tty, struct file *file, +static int hso_serial_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct hso_serial *serial = get_serial_by_tty(tty); diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 88477d16b8b7..50f3ffd610b7 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2671,7 +2671,7 @@ static int gsmtty_tiocmset(struct tty_struct *tty, } -static int gsmtty_ioctl(struct tty_struct *tty, struct file *filp, +static int gsmtty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { return -ENOIOCTLCMD; diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 923a48585501..c88029af84dd 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -334,7 +334,7 @@ free_mem_out: return -ENOMEM; } -static int pty_bsd_ioctl(struct tty_struct *tty, struct file *file, +static int pty_bsd_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { switch (cmd) { @@ -489,7 +489,7 @@ static struct ctl_table pty_root_table[] = { }; -static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, +static int pty_unix98_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { switch (cmd) { diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c index a9d99856c892..1de0e8d4bde1 100644 --- a/drivers/tty/serial/68328serial.c +++ b/drivers/tty/serial/68328serial.c @@ -945,7 +945,7 @@ static void send_break(struct m68k_serial * info, unsigned int duration) local_irq_restore(flags); } -static int rs_ioctl(struct tty_struct *tty, struct file * file, +static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { int error; diff --git a/drivers/tty/serial/68360serial.c b/drivers/tty/serial/68360serial.c index 217fe1c299e0..514a356d8d64 100644 --- a/drivers/tty/serial/68360serial.c +++ b/drivers/tty/serial/68360serial.c @@ -1405,7 +1405,7 @@ static int rs_360_get_icount(struct tty_struct *tty, return 0; } -static int rs_360_ioctl(struct tty_struct *tty, struct file * file, +static int rs_360_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { int error; diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index b9fcd0bda60c..225123b37f19 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c @@ -3647,7 +3647,7 @@ rs_tiocmget(struct tty_struct *tty) static int -rs_ioctl(struct tty_struct *tty, struct file * file, +rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct e100_serial * info = (struct e100_serial *)tty->driver_data; diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 623d6bd911d7..733fe8e73f0f 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1099,7 +1099,7 @@ static int uart_get_icount(struct tty_struct *tty, * Called via sys_ioctl. We can use spin_lock_irq() here. */ static int -uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, +uart_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct uart_state *state = tty->driver_data; @@ -1152,7 +1152,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, mutex_lock(&port->mutex); - if (tty_hung_up_p(filp)) { + if (tty->flags & (1 << TTY_IO_ERROR)) { ret = -EIO; goto out_up; } diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 83af24ca1e5e..20a862a2a0c2 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2676,7 +2676,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) break; } if (tty->ops->ioctl) { - retval = (tty->ops->ioctl)(tty, file, cmd, arg); + retval = (tty->ops->ioctl)(tty, cmd, arg); if (retval != -ENOIOCTLCMD) return retval; } @@ -2704,7 +2704,7 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd, return -EINVAL; if (tty->ops->compat_ioctl) { - retval = (tty->ops->compat_ioctl)(tty, file, cmd, arg); + retval = (tty->ops->compat_ioctl)(tty, cmd, arg); if (retval != -ENOIOCTLCMD) return retval; } diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 9e9a901442a3..b64804965316 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -495,7 +495,7 @@ do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, struct vc_ * We handle the console-specific ioctl's here. We allow the * capability to modify any console, not just the fg_console. */ -int vt_ioctl(struct tty_struct *tty, struct file * file, +int vt_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct vc_data *vc = tty->driver_data; @@ -1495,7 +1495,7 @@ compat_unimap_ioctl(unsigned int cmd, struct compat_unimapdesc __user *user_ud, return 0; } -long vt_compat_ioctl(struct tty_struct *tty, struct file * file, +long vt_compat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct vc_data *vc = tty->driver_data; @@ -1581,7 +1581,7 @@ out: fallback: tty_unlock(); - return vt_ioctl(tty, file, cmd, arg); + return vt_ioctl(tty, cmd, arg); } diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e9a26fbd079c..8d994a8bdc90 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -813,7 +813,7 @@ static int acm_tty_tiocmset(struct tty_struct *tty, return acm_set_control(acm, acm->ctrlout = newctrl); } -static int acm_tty_ioctl(struct tty_struct *tty, struct file *file, +static int acm_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct acm *acm = tty->driver_data; diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index b1110e136c33..a72575349744 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -406,7 +406,7 @@ static void serial_unthrottle(struct tty_struct *tty) port->serial->type->unthrottle(tty); } -static int serial_ioctl(struct tty_struct *tty, struct file *file, +static int serial_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; diff --git a/include/linux/tty.h b/include/linux/tty.h index 54e4eaaa0561..483df15146d2 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -584,7 +584,7 @@ extern int pcxe_open(struct tty_struct *tty, struct file *filp); /* vt.c */ -extern int vt_ioctl(struct tty_struct *tty, struct file *file, +extern int vt_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 5dabaa2e6da3..9deeac855240 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -98,8 +98,7 @@ * * Note: Do not call this function directly, call tty_write_room * - * int (*ioctl)(struct tty_struct *tty, struct file * file, - * unsigned int cmd, unsigned long arg); + * int (*ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg); * * This routine allows the tty driver to implement * device-specific ioctls. If the ioctl number passed in cmd @@ -107,7 +106,7 @@ * * Optional * - * long (*compat_ioctl)(struct tty_struct *tty, struct file * file, + * long (*compat_ioctl)(struct tty_struct *tty,, * unsigned int cmd, unsigned long arg); * * implement ioctl processing for 32 bit process on 64 bit system @@ -256,9 +255,9 @@ struct tty_operations { void (*flush_chars)(struct tty_struct *tty); int (*write_room)(struct tty_struct *tty); int (*chars_in_buffer)(struct tty_struct *tty); - int (*ioctl)(struct tty_struct *tty, struct file * file, + int (*ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg); - long (*compat_ioctl)(struct tty_struct *tty, struct file * file, + long (*compat_ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg); void (*set_termios)(struct tty_struct *tty, struct ktermios * old); void (*throttle)(struct tty_struct * tty); diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h index 980ccb66e1b4..59ba38bc400f 100644 --- a/include/net/irda/ircomm_tty.h +++ b/include/net/irda/ircomm_tty.h @@ -123,7 +123,7 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self); extern int ircomm_tty_tiocmget(struct tty_struct *tty); extern int ircomm_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); -extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, +extern int ircomm_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); extern void ircomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios); diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 8e78e7447726..b1805ff95415 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -830,7 +830,7 @@ static int rfcomm_tty_write_room(struct tty_struct *tty) return room; } -static int rfcomm_tty_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg) +static int rfcomm_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { BT_DBG("tty %p cmd 0x%02x", tty, cmd); diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c index 5e0e718c930a..77c5e6499f8f 100644 --- a/net/irda/ircomm/ircomm_tty_ioctl.c +++ b/net/irda/ircomm/ircomm_tty_ioctl.c @@ -365,12 +365,12 @@ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, } /* - * Function ircomm_tty_ioctl (tty, file, cmd, arg) + * Function ircomm_tty_ioctl (tty, cmd, arg) * * * */ -int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, +int ircomm_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; From 94c2273d6c1b65eaaf2a6446c7147bdf6e5ae924 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 17 Feb 2011 12:02:51 -0800 Subject: [PATCH 38/76] tty: fix build error in vt_ioctl.c if CONFIG_COMPAT is enabled This was caused by the previous patch to remove the file pointer from the tty ioctl handler. Cc: Alan Cox Signed-off-by: Greg Kroah-Hartman --- include/linux/tty.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/tty.h b/include/linux/tty.h index 483df15146d2..ef1e0123573b 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -587,7 +587,7 @@ extern int pcxe_open(struct tty_struct *tty, struct file *filp); extern int vt_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); -extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, +extern long vt_compat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); /* tty_mutex.c */ From 8d075b199b9a66ad90296f898f1f15c0ae1511b8 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 14 Feb 2011 16:27:53 +0000 Subject: [PATCH 39/76] tty: add a helper for setting termios data from kernel side This basically encapsulates the small bit of locking knowledge needed. While we are at it make sure we blow up on any more abusers and unsafe misuses of ioctl for this kind of stuff. We change the function to return an argument as at some point it needs to honour the POSIX 'I asked for changes but got none of them' error reporting corner case. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/tty/tty_ioctl.c | 14 +++++++++----- include/linux/tty.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index 0c1889971459..1a1135d580a2 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c @@ -486,7 +486,7 @@ int tty_termios_hw_change(struct ktermios *a, struct ktermios *b) EXPORT_SYMBOL(tty_termios_hw_change); /** - * change_termios - update termios values + * tty_set_termios - update termios values * @tty: tty to update * @new_termios: desired new value * @@ -497,7 +497,7 @@ EXPORT_SYMBOL(tty_termios_hw_change); * Locking: termios_mutex */ -static void change_termios(struct tty_struct *tty, struct ktermios *new_termios) +int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios) { struct ktermios old_termios; struct tty_ldisc *ld; @@ -553,7 +553,9 @@ static void change_termios(struct tty_struct *tty, struct ktermios *new_termios) tty_ldisc_deref(ld); } mutex_unlock(&tty->termios_mutex); + return 0; } +EXPORT_SYMBOL_GPL(tty_set_termios); /** * set_termios - set termios values for a tty @@ -562,7 +564,7 @@ static void change_termios(struct tty_struct *tty, struct ktermios *new_termios) * @opt: option information * * Helper function to prepare termios data and run necessary other - * functions before using change_termios to do the actual changes. + * functions before using tty_set_termios to do the actual changes. * * Locking: * Called functions take ldisc and termios_mutex locks @@ -620,7 +622,7 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt) return -EINTR; } - change_termios(tty, &tmp_termios); + tty_set_termios(tty, &tmp_termios); /* FIXME: Arguably if tmp_termios == tty->termios AND the actual requested termios was not tmp_termios then we may @@ -797,7 +799,7 @@ static int set_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb) termios.c_ospeed); #endif mutex_unlock(&tty->termios_mutex); - change_termios(tty, &termios); + tty_set_termios(tty, &termios); return 0; } #endif @@ -951,6 +953,8 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, int ret = 0; struct ktermios kterm; + BUG_ON(file == NULL); + if (tty->driver->type == TTY_DRIVER_TYPE_PTY && tty->driver->subtype == PTY_TYPE_MASTER) real_tty = tty->link; diff --git a/include/linux/tty.h b/include/linux/tty.h index ef1e0123573b..4e53d4641b38 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -448,6 +448,7 @@ extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud); extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); +extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); extern void tty_ldisc_deref(struct tty_ldisc *); From afaae08442d86402f9e0b63475c02a651c6f1387 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 14 Feb 2011 16:28:18 +0000 Subject: [PATCH 40/76] hci_ath: Fix the mess in this driver Was this exploitable - who knows, but it was certainly totally broken Signed-of-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/bluetooth/hci_ath.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/bluetooth/hci_ath.c b/drivers/bluetooth/hci_ath.c index 6a160c17ea94..bd34406faaae 100644 --- a/drivers/bluetooth/hci_ath.c +++ b/drivers/bluetooth/hci_ath.c @@ -51,32 +51,32 @@ struct ath_struct { static int ath_wakeup_ar3k(struct tty_struct *tty) { - struct termios settings; - int status = tty->driver->ops->tiocmget(tty, NULL); + struct ktermios ktermios; + int status = tty->driver->ops->tiocmget(tty); if (status & TIOCM_CTS) return status; /* Disable Automatic RTSCTS */ - n_tty_ioctl_helper(tty, NULL, TCGETS, (unsigned long)&settings); - settings.c_cflag &= ~CRTSCTS; - n_tty_ioctl_helper(tty, NULL, TCSETS, (unsigned long)&settings); + memcpy(&ktermios, tty->termios, sizeof(ktermios)); + ktermios.c_cflag &= ~CRTSCTS; + tty_set_termios(tty, &ktermios); /* Clear RTS first */ - status = tty->driver->ops->tiocmget(tty, NULL); - tty->driver->ops->tiocmset(tty, NULL, 0x00, TIOCM_RTS); + status = tty->driver->ops->tiocmget(tty); + tty->driver->ops->tiocmset(tty, 0x00, TIOCM_RTS); mdelay(20); /* Set RTS, wake up board */ - status = tty->driver->ops->tiocmget(tty, NULL); - tty->driver->ops->tiocmset(tty, NULL, TIOCM_RTS, 0x00); + status = tty->driver->ops->tiocmget(tty); + tty->driver->ops->tiocmset(tty, TIOCM_RTS, 0x00); mdelay(20); - status = tty->driver->ops->tiocmget(tty, NULL); + status = tty->driver->ops->tiocmget(tty); - n_tty_ioctl_helper(tty, NULL, TCGETS, (unsigned long)&settings); - settings.c_cflag |= CRTSCTS; - n_tty_ioctl_helper(tty, NULL, TCSETS, (unsigned long)&settings); + /* Disable Automatic RTSCTS */ + ktermios.c_cflag |= CRTSCTS; + status = tty_set_termios(tty, &ktermios); return status; } From 3c95c985fa91ecf6a0e29622bbdd13dcfc5ce9f1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 Feb 2011 18:39:28 +0100 Subject: [PATCH 41/76] tty: add TIOCVHANGUP to allow clean tty shutdown of all ttys This is useful for system management software so that it can kick off things like gettys and everything that's started from a tty, before we reuse it from/for something else or shut it down. Without this ioctl it would have to temporarily become the owner of the tty, then call vhangup() and then give it up again. Cc: Lennart Poettering Signed-off-by: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- arch/alpha/include/asm/ioctls.h | 1 + arch/mips/include/asm/ioctls.h | 1 + arch/parisc/include/asm/ioctls.h | 1 + arch/powerpc/include/asm/ioctls.h | 1 + arch/sh/include/asm/ioctls.h | 1 + arch/sparc/include/asm/ioctls.h | 1 + arch/xtensa/include/asm/ioctls.h | 1 + drivers/tty/tty_io.c | 5 +++++ include/asm-generic/ioctls.h | 1 + 9 files changed, 13 insertions(+) diff --git a/arch/alpha/include/asm/ioctls.h b/arch/alpha/include/asm/ioctls.h index 034b6cf5d9f3..80e1cee90f1f 100644 --- a/arch/alpha/include/asm/ioctls.h +++ b/arch/alpha/include/asm/ioctls.h @@ -94,6 +94,7 @@ #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ #define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ +#define TIOCVHANGUP 0x5437 #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 diff --git a/arch/mips/include/asm/ioctls.h b/arch/mips/include/asm/ioctls.h index d967b8997626..92403c3d6007 100644 --- a/arch/mips/include/asm/ioctls.h +++ b/arch/mips/include/asm/ioctls.h @@ -85,6 +85,7 @@ #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ #define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */ #define TIOCSIG _IOW('T', 0x36, int) /* Generate signal on Pty slave */ +#define TIOCVHANGUP 0x5437 /* I hope the range from 0x5480 on is free ... */ #define TIOCSCTTY 0x5480 /* become controlling tty */ diff --git a/arch/parisc/include/asm/ioctls.h b/arch/parisc/include/asm/ioctls.h index 6ba80d03623a..054ec06f9e23 100644 --- a/arch/parisc/include/asm/ioctls.h +++ b/arch/parisc/include/asm/ioctls.h @@ -54,6 +54,7 @@ #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ #define TIOCGDEV _IOR('T',0x32, int) /* Get primary device node of /dev/console */ #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ +#define TIOCVHANGUP 0x5437 #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ #define FIOCLEX 0x5451 diff --git a/arch/powerpc/include/asm/ioctls.h b/arch/powerpc/include/asm/ioctls.h index c7dc17cf84f1..e9b78870aaab 100644 --- a/arch/powerpc/include/asm/ioctls.h +++ b/arch/powerpc/include/asm/ioctls.h @@ -96,6 +96,7 @@ #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ #define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ +#define TIOCVHANGUP 0x5437 #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 diff --git a/arch/sh/include/asm/ioctls.h b/arch/sh/include/asm/ioctls.h index 84e85a792638..a6769f352bf6 100644 --- a/arch/sh/include/asm/ioctls.h +++ b/arch/sh/include/asm/ioctls.h @@ -87,6 +87,7 @@ #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ #define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ +#define TIOCVHANGUP _IO('T', 0x37) #define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */ #define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */ diff --git a/arch/sparc/include/asm/ioctls.h b/arch/sparc/include/asm/ioctls.h index ed3807b96bb5..28d0c8b02cc3 100644 --- a/arch/sparc/include/asm/ioctls.h +++ b/arch/sparc/include/asm/ioctls.h @@ -20,6 +20,7 @@ #define TCSETSW2 _IOW('T', 14, struct termios2) #define TCSETSF2 _IOW('T', 15, struct termios2) #define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ +#define TIOCVHANGUP _IO('T', 0x37) /* Note that all the ioctls that are not available in Linux have a * double underscore on the front to: a) avoid some programs to diff --git a/arch/xtensa/include/asm/ioctls.h b/arch/xtensa/include/asm/ioctls.h index ccf1800f0b0c..fd1d1369a407 100644 --- a/arch/xtensa/include/asm/ioctls.h +++ b/arch/xtensa/include/asm/ioctls.h @@ -100,6 +100,7 @@ #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ #define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ +#define TIOCVHANGUP _IO('T', 0x37) #define TIOCSERCONFIG _IO('T', 83) #define TIOCSERGWILD _IOR('T', 84, int) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 20a862a2a0c2..8ef2d69470ec 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2626,6 +2626,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return put_user(tty->ldisc->ops->num, (int __user *)p); case TIOCSETD: return tiocsetd(tty, p); + case TIOCVHANGUP: + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + tty_vhangup(tty); + return 0; case TIOCGDEV: { unsigned int ret = new_encode_dev(tty_devnum(real_tty)); diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h index 3f3f2d189fb8..199975fac395 100644 --- a/include/asm-generic/ioctls.h +++ b/include/asm-generic/ioctls.h @@ -73,6 +73,7 @@ #define TCSETXF 0x5434 #define TCSETXW 0x5435 #define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */ +#define TIOCVHANGUP 0x5437 #define FIONCLEX 0x5450 #define FIOCLEX 0x5451 From bdcffc5a1a28b566a38a4b0d5bcefc78a97f4ecb Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 22 Feb 2011 15:41:47 -0800 Subject: [PATCH 42/76] tty: move Kconfig entries into drivers/tty from drivers/char The Kconfig options for the drivers/tty/ files still were hanging around in the "big" drivers/char/Kconfig file, so move them to the proper location under drivers/tty and drivers/tty/hvc/ Signed-off-by: Greg Kroah-Hartman --- drivers/char/Kconfig | 254 +--------------------------------------- drivers/tty/Kconfig | 150 ++++++++++++++++++++++++ drivers/tty/hvc/Kconfig | 105 +++++++++++++++++ 3 files changed, 257 insertions(+), 252 deletions(-) create mode 100644 drivers/tty/Kconfig create mode 100644 drivers/tty/hvc/Kconfig diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 17f9b968b988..9b9ab867f50e 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -4,89 +4,7 @@ menu "Character devices" -config VT - bool "Virtual terminal" if EXPERT - depends on !S390 - select INPUT - default y - ---help--- - If you say Y here, you will get support for terminal devices with - display and keyboard devices. These are called "virtual" because you - can run several virtual terminals (also called virtual consoles) on - one physical terminal. This is rather useful, for example one - virtual terminal can collect system messages and warnings, another - one can be used for a text-mode user session, and a third could run - an X session, all in parallel. Switching between virtual terminals - is done with certain key combinations, usually Alt-. - - The setterm command ("man setterm") can be used to change the - properties (such as colors or beeping) of a virtual terminal. The - man page console_codes(4) ("man console_codes") contains the special - character sequences that can be used to change those properties - directly. The fonts used on virtual terminals can be changed with - the setfont ("man setfont") command and the key bindings are defined - with the loadkeys ("man loadkeys") command. - - You need at least one virtual terminal device in order to make use - of your keyboard and monitor. Therefore, only people configuring an - embedded system would want to say N here in order to save some - memory; the only way to log into such a system is then via a serial - or network connection. - - If unsure, say Y, or else you won't be able to do much with your new - shiny Linux system :-) - -config CONSOLE_TRANSLATIONS - depends on VT - default y - bool "Enable character translations in console" if EXPERT - ---help--- - This enables support for font mapping and Unicode translation - on virtual consoles. - -config VT_CONSOLE - bool "Support for console on virtual terminal" if EXPERT - depends on VT - default y - ---help--- - The system console is the device which receives all kernel messages - and warnings and which allows logins in single user mode. If you - answer Y here, a virtual terminal (the device used to interact with - a physical terminal) can be used as system console. This is the most - common mode of operations, so you should say Y here unless you want - the kernel messages be output only to a serial port (in which case - you should say Y to "Console on serial port", below). - - If you do say Y here, by default the currently visible virtual - terminal (/dev/tty0) will be used as system console. You can change - that with a kernel command line option such as "console=tty3" which - would use the third virtual terminal as system console. (Try "man - bootparam" or see the documentation of your boot loader (lilo or - loadlin) about how to pass options to the kernel at boot time.) - - If unsure, say Y. - -config HW_CONSOLE - bool - depends on VT && !S390 && !UML - default y - -config VT_HW_CONSOLE_BINDING - bool "Support for binding and unbinding console drivers" - depends on HW_CONSOLE - default n - ---help--- - The virtual terminal is the device that interacts with the physical - terminal through console drivers. On these systems, at least one - console driver is loaded. In other configurations, additional console - drivers may be enabled, such as the framebuffer console. If more than - 1 console driver is enabled, setting this to 'y' will allow you to - select the console driver that will serve as the backend for the - virtual terminals. - - See for more - information. For framebuffer console users, please refer to - . +source "drivers/tty/Kconfig" config DEVKMEM bool "/dev/kmem virtual device support" @@ -428,71 +346,6 @@ config SGI_MBCS source "drivers/tty/serial/Kconfig" -config UNIX98_PTYS - bool "Unix98 PTY support" if EXPERT - default y - ---help--- - A pseudo terminal (PTY) is a software device consisting of two - halves: a master and a slave. The slave device behaves identical to - a physical terminal; the master device is used by a process to - read data from and write data to the slave, thereby emulating a - terminal. Typical programs for the master side are telnet servers - and xterms. - - Linux has traditionally used the BSD-like names /dev/ptyxx for - masters and /dev/ttyxx for slaves of pseudo terminals. This scheme - has a number of problems. The GNU C library glibc 2.1 and later, - however, supports the Unix98 naming standard: in order to acquire a - pseudo terminal, a process opens /dev/ptmx; the number of the pseudo - terminal is then made available to the process and the pseudo - terminal slave can be accessed as /dev/pts/. What was - traditionally /dev/ttyp2 will then be /dev/pts/2, for example. - - All modern Linux systems use the Unix98 ptys. Say Y unless - you're on an embedded system and want to conserve memory. - -config DEVPTS_MULTIPLE_INSTANCES - bool "Support multiple instances of devpts" - depends on UNIX98_PTYS - default n - ---help--- - Enable support for multiple instances of devpts filesystem. - If you want to have isolated PTY namespaces (eg: in containers), - say Y here. Otherwise, say N. If enabled, each mount of devpts - filesystem with the '-o newinstance' option will create an - independent PTY namespace. - -config LEGACY_PTYS - bool "Legacy (BSD) PTY support" - default y - ---help--- - A pseudo terminal (PTY) is a software device consisting of two - halves: a master and a slave. The slave device behaves identical to - a physical terminal; the master device is used by a process to - read data from and write data to the slave, thereby emulating a - terminal. Typical programs for the master side are telnet servers - and xterms. - - Linux has traditionally used the BSD-like names /dev/ptyxx - for masters and /dev/ttyxx for slaves of pseudo - terminals. This scheme has a number of problems, including - security. This option enables these legacy devices; on most - systems, it is safe to say N. - - -config LEGACY_PTY_COUNT - int "Maximum number of legacy PTY in use" - depends on LEGACY_PTYS - range 0 256 - default "256" - ---help--- - The maximum number of legacy PTYs that can be used at any one time. - The default is 256, and should be more than enough. Embedded - systems may want to reduce this to save memory. - - When not in use, each legacy PTY occupies 12 bytes on 32-bit - architectures and 24 bytes on 64-bit architectures. - config TTY_PRINTK bool "TTY driver to output user messages via printk" depends on EXPERT @@ -612,93 +465,7 @@ config PPDEV If unsure, say N. -config HVC_DRIVER - bool - help - Generic "hypervisor virtual console" infrastructure for various - hypervisors (pSeries, iSeries, Xen, lguest). - It will automatically be selected if one of the back-end console drivers - is selected. - -config HVC_IRQ - bool - -config HVC_CONSOLE - bool "pSeries Hypervisor Virtual Console support" - depends on PPC_PSERIES - select HVC_DRIVER - select HVC_IRQ - help - pSeries machines when partitioned support a hypervisor virtual - console. This driver allows each pSeries partition to have a console - which is accessed via the HMC. - -config HVC_ISERIES - bool "iSeries Hypervisor Virtual Console support" - depends on PPC_ISERIES - default y - select HVC_DRIVER - select HVC_IRQ - select VIOPATH - help - iSeries machines support a hypervisor virtual console. - -config HVC_RTAS - bool "IBM RTAS Console support" - depends on PPC_RTAS - select HVC_DRIVER - help - IBM Console device driver which makes use of RTAS - -config HVC_BEAT - bool "Toshiba's Beat Hypervisor Console support" - depends on PPC_CELLEB - select HVC_DRIVER - help - Toshiba's Cell Reference Set Beat Console device driver - -config HVC_IUCV - bool "z/VM IUCV Hypervisor console support (VM only)" - depends on S390 - select HVC_DRIVER - select IUCV - default y - help - This driver provides a Hypervisor console (HVC) back-end to access - a Linux (console) terminal via a z/VM IUCV communication path. - -config HVC_XEN - bool "Xen Hypervisor Console support" - depends on XEN - select HVC_DRIVER - select HVC_IRQ - default y - help - Xen virtual console device driver - -config HVC_UDBG - bool "udbg based fake hypervisor console" - depends on PPC && EXPERIMENTAL - select HVC_DRIVER - default n - -config HVC_DCC - bool "ARM JTAG DCC console" - depends on ARM - select HVC_DRIVER - help - This console uses the JTAG DCC on ARM to create a console under the HVC - driver. This console is used through a JTAG only on ARM. If you don't have - a JTAG then you probably don't want this option. - -config HVC_BFIN_JTAG - bool "Blackfin JTAG console" - depends on BLACKFIN - select HVC_DRIVER - help - This console uses the Blackfin JTAG to create a console under the - the HVC driver. If you don't have JTAG, then you probably don't - want this option. +source "drivers/tty/hvc/Kconfig" config VIRTIO_CONSOLE tristate "Virtio console" @@ -716,23 +483,6 @@ config VIRTIO_CONSOLE the port which can be used by udev scripts to create a symlink to the device. -config HVCS - tristate "IBM Hypervisor Virtual Console Server support" - depends on PPC_PSERIES && HVC_CONSOLE - help - Partitionable IBM Power5 ppc64 machines allow hosting of - firmware virtual consoles from one Linux partition by - another Linux partition. This driver allows console data - from Linux partitions to be accessed through TTY device - interfaces in the device tree of a Linux partition running - this driver. - - To compile this driver as a module, choose M here: the - module will be called hvcs. Additionally, this module - will depend on arch specific APIs exported from hvcserver.ko - which will also be compiled when this driver is built as a - module. - config IBM_BSR tristate "IBM POWER Barrier Synchronization Register support" depends on PPC_PSERIES diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig new file mode 100644 index 000000000000..9cfbdb318ed9 --- /dev/null +++ b/drivers/tty/Kconfig @@ -0,0 +1,150 @@ +config VT + bool "Virtual terminal" if EXPERT + depends on !S390 + select INPUT + default y + ---help--- + If you say Y here, you will get support for terminal devices with + display and keyboard devices. These are called "virtual" because you + can run several virtual terminals (also called virtual consoles) on + one physical terminal. This is rather useful, for example one + virtual terminal can collect system messages and warnings, another + one can be used for a text-mode user session, and a third could run + an X session, all in parallel. Switching between virtual terminals + is done with certain key combinations, usually Alt-. + + The setterm command ("man setterm") can be used to change the + properties (such as colors or beeping) of a virtual terminal. The + man page console_codes(4) ("man console_codes") contains the special + character sequences that can be used to change those properties + directly. The fonts used on virtual terminals can be changed with + the setfont ("man setfont") command and the key bindings are defined + with the loadkeys ("man loadkeys") command. + + You need at least one virtual terminal device in order to make use + of your keyboard and monitor. Therefore, only people configuring an + embedded system would want to say N here in order to save some + memory; the only way to log into such a system is then via a serial + or network connection. + + If unsure, say Y, or else you won't be able to do much with your new + shiny Linux system :-) + +config CONSOLE_TRANSLATIONS + depends on VT + default y + bool "Enable character translations in console" if EXPERT + ---help--- + This enables support for font mapping and Unicode translation + on virtual consoles. + +config VT_CONSOLE + bool "Support for console on virtual terminal" if EXPERT + depends on VT + default y + ---help--- + The system console is the device which receives all kernel messages + and warnings and which allows logins in single user mode. If you + answer Y here, a virtual terminal (the device used to interact with + a physical terminal) can be used as system console. This is the most + common mode of operations, so you should say Y here unless you want + the kernel messages be output only to a serial port (in which case + you should say Y to "Console on serial port", below). + + If you do say Y here, by default the currently visible virtual + terminal (/dev/tty0) will be used as system console. You can change + that with a kernel command line option such as "console=tty3" which + would use the third virtual terminal as system console. (Try "man + bootparam" or see the documentation of your boot loader (lilo or + loadlin) about how to pass options to the kernel at boot time.) + + If unsure, say Y. + +config HW_CONSOLE + bool + depends on VT && !S390 && !UML + default y + +config VT_HW_CONSOLE_BINDING + bool "Support for binding and unbinding console drivers" + depends on HW_CONSOLE + default n + ---help--- + The virtual terminal is the device that interacts with the physical + terminal through console drivers. On these systems, at least one + console driver is loaded. In other configurations, additional console + drivers may be enabled, such as the framebuffer console. If more than + 1 console driver is enabled, setting this to 'y' will allow you to + select the console driver that will serve as the backend for the + virtual terminals. + + See for more + information. For framebuffer console users, please refer to + . + +config UNIX98_PTYS + bool "Unix98 PTY support" if EXPERT + default y + ---help--- + A pseudo terminal (PTY) is a software device consisting of two + halves: a master and a slave. The slave device behaves identical to + a physical terminal; the master device is used by a process to + read data from and write data to the slave, thereby emulating a + terminal. Typical programs for the master side are telnet servers + and xterms. + + Linux has traditionally used the BSD-like names /dev/ptyxx for + masters and /dev/ttyxx for slaves of pseudo terminals. This scheme + has a number of problems. The GNU C library glibc 2.1 and later, + however, supports the Unix98 naming standard: in order to acquire a + pseudo terminal, a process opens /dev/ptmx; the number of the pseudo + terminal is then made available to the process and the pseudo + terminal slave can be accessed as /dev/pts/. What was + traditionally /dev/ttyp2 will then be /dev/pts/2, for example. + + All modern Linux systems use the Unix98 ptys. Say Y unless + you're on an embedded system and want to conserve memory. + +config DEVPTS_MULTIPLE_INSTANCES + bool "Support multiple instances of devpts" + depends on UNIX98_PTYS + default n + ---help--- + Enable support for multiple instances of devpts filesystem. + If you want to have isolated PTY namespaces (eg: in containers), + say Y here. Otherwise, say N. If enabled, each mount of devpts + filesystem with the '-o newinstance' option will create an + independent PTY namespace. + +config LEGACY_PTYS + bool "Legacy (BSD) PTY support" + default y + ---help--- + A pseudo terminal (PTY) is a software device consisting of two + halves: a master and a slave. The slave device behaves identical to + a physical terminal; the master device is used by a process to + read data from and write data to the slave, thereby emulating a + terminal. Typical programs for the master side are telnet servers + and xterms. + + Linux has traditionally used the BSD-like names /dev/ptyxx + for masters and /dev/ttyxx for slaves of pseudo + terminals. This scheme has a number of problems, including + security. This option enables these legacy devices; on most + systems, it is safe to say N. + + +config LEGACY_PTY_COUNT + int "Maximum number of legacy PTY in use" + depends on LEGACY_PTYS + range 0 256 + default "256" + ---help--- + The maximum number of legacy PTYs that can be used at any one time. + The default is 256, and should be more than enough. Embedded + systems may want to reduce this to save memory. + + When not in use, each legacy PTY occupies 12 bytes on 32-bit + architectures and 24 bytes on 64-bit architectures. + + diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig new file mode 100644 index 000000000000..6f2c9809f1fb --- /dev/null +++ b/drivers/tty/hvc/Kconfig @@ -0,0 +1,105 @@ +config HVC_DRIVER + bool + help + Generic "hypervisor virtual console" infrastructure for various + hypervisors (pSeries, iSeries, Xen, lguest). + It will automatically be selected if one of the back-end console drivers + is selected. + +config HVC_IRQ + bool + +config HVC_CONSOLE + bool "pSeries Hypervisor Virtual Console support" + depends on PPC_PSERIES + select HVC_DRIVER + select HVC_IRQ + help + pSeries machines when partitioned support a hypervisor virtual + console. This driver allows each pSeries partition to have a console + which is accessed via the HMC. + +config HVC_ISERIES + bool "iSeries Hypervisor Virtual Console support" + depends on PPC_ISERIES + default y + select HVC_DRIVER + select HVC_IRQ + select VIOPATH + help + iSeries machines support a hypervisor virtual console. + +config HVC_RTAS + bool "IBM RTAS Console support" + depends on PPC_RTAS + select HVC_DRIVER + help + IBM Console device driver which makes use of RTAS + +config HVC_BEAT + bool "Toshiba's Beat Hypervisor Console support" + depends on PPC_CELLEB + select HVC_DRIVER + help + Toshiba's Cell Reference Set Beat Console device driver + +config HVC_IUCV + bool "z/VM IUCV Hypervisor console support (VM only)" + depends on S390 + select HVC_DRIVER + select IUCV + default y + help + This driver provides a Hypervisor console (HVC) back-end to access + a Linux (console) terminal via a z/VM IUCV communication path. + +config HVC_XEN + bool "Xen Hypervisor Console support" + depends on XEN + select HVC_DRIVER + select HVC_IRQ + default y + help + Xen virtual console device driver + +config HVC_UDBG + bool "udbg based fake hypervisor console" + depends on PPC && EXPERIMENTAL + select HVC_DRIVER + default n + +config HVC_DCC + bool "ARM JTAG DCC console" + depends on ARM + select HVC_DRIVER + help + This console uses the JTAG DCC on ARM to create a console under the HVC + driver. This console is used through a JTAG only on ARM. If you don't have + a JTAG then you probably don't want this option. + +config HVC_BFIN_JTAG + bool "Blackfin JTAG console" + depends on BLACKFIN + select HVC_DRIVER + help + This console uses the Blackfin JTAG to create a console under the + the HVC driver. If you don't have JTAG, then you probably don't + want this option. + +config HVCS + tristate "IBM Hypervisor Virtual Console Server support" + depends on PPC_PSERIES && HVC_CONSOLE + help + Partitionable IBM Power5 ppc64 machines allow hosting of + firmware virtual consoles from one Linux partition by + another Linux partition. This driver allows console data + from Linux partitions to be accessed through TTY device + interfaces in the device tree of a Linux partition running + this driver. + + To compile this driver as a module, choose M here: the + module will be called hvcs. Additionally, this module + will depend on arch specific APIs exported from hvcserver.ko + which will also be compiled when this driver is built as a + module. + From 10e82f6ce76351425644bccc56f8e2c2ad596ce6 Mon Sep 17 00:00:00 2001 From: "Luck, Tony" Date: Tue, 22 Feb 2011 11:47:04 -0800 Subject: [PATCH 43/76] tty: simserial: now phase out the ioctl file pointer for good Alan missed the ia64 simulator serial driver (because it was hidden in arch/... rather than located under drivers/... where one might expect to find a driver). Drop the "file *" argument from rs_ioctl() in arch/ia64/hp/sim/simserial.c Signed-off-by: Tony Luck Cc: Alan Cox , Signed-off-by: Greg Kroah-Hartman --- arch/ia64/hp/sim/simserial.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 13633da0d3de..bff0824cf8a4 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c @@ -390,8 +390,7 @@ static void rs_unthrottle(struct tty_struct * tty) } -static int rs_ioctl(struct tty_struct *tty, struct file * file, - unsigned int cmd, unsigned long arg) +static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) && From 085a4f758f0cf95e1865b63892bf4304a149f0ca Mon Sep 17 00:00:00 2001 From: Feng Tang Date: Tue, 22 Feb 2011 15:28:10 +0800 Subject: [PATCH 44/76] serial: mfd: remove the TX full-empty interrupts workaround In A0 stepping, TX half-empty interrupt is not working, so have to use the full-empty interrupts whose performance will be 15% lower. Now re-enable the half-empty interrrupt after it is enabled in silicon. Signed-off-by: Feng Tang Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/mfd.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c index 776777462937..53ff6af16273 100644 --- a/drivers/tty/serial/mfd.c +++ b/drivers/tty/serial/mfd.c @@ -16,9 +16,7 @@ * 2/3 chan to port 1, 4/5 chan to port 3. Even number chans * are used for RX, odd chans for TX * - * 2. In A0 stepping, UART will not support TX half empty flag - * - * 3. The RI/DSR/DCD/DTR are not pinned out, DCD & DSR are always + * 2. The RI/DSR/DCD/DTR are not pinned out, DCD & DSR are always * asserted, only when the HW is reset the DDCD and DDSR will * be triggered */ @@ -41,8 +39,6 @@ #include #include -#define MFD_HSU_A0_STEPPING 1 - #define HSU_DMA_BUF_SIZE 2048 #define chan_readl(chan, offset) readl(chan->reg + offset) @@ -543,16 +539,9 @@ static void transmit_chars(struct uart_hsu_port *up) return; } -#ifndef MFD_HSU_A0_STEPPING + /* The IRQ is for TX FIFO half-empty */ count = up->port.fifosize / 2; -#else - /* - * A0 only supports fully empty IRQ, and the first char written - * into it won't clear the EMPT bit, so we may need be cautious - * by useing a shorter buffer - */ - count = up->port.fifosize - 4; -#endif + do { serial_out(up, UART_TX, xmit->buf[xmit->tail]); xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); @@ -761,9 +750,8 @@ static void serial_hsu_break_ctl(struct uart_port *port, int break_state) /* * What special to do: * 1. chose the 64B fifo mode - * 2. make sure not to select half empty mode for A0 stepping - * 3. start dma or pio depends on configuration - * 4. we only allocate dma memory when needed + * 2. start dma or pio depends on configuration + * 3. we only allocate dma memory when needed */ static int serial_hsu_startup(struct uart_port *port) { @@ -967,10 +955,6 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, fcr = UART_FCR_ENABLE_FIFO | UART_FCR_HSU_64_32B; fcr |= UART_FCR_HSU_64B_FIFO; -#ifdef MFD_HSU_A0_STEPPING - /* A0 doesn't support half empty IRQ */ - fcr |= UART_FCR_FULL_EMPT_TXI; -#endif /* * Ok, we're now changing the port state. Do it with From f023eab379821365bf265a0240f30c00cecaef7c Mon Sep 17 00:00:00 2001 From: Feng Tang Date: Tue, 22 Feb 2011 15:28:12 +0800 Subject: [PATCH 45/76] serial: mfd: add a module parameter for setting each port's working mode The three identical uart ports can work either in DMA or PIO mode. Adding such a module parameter "hsu_dma_enable" will enable user to chose working modes for each port. If the mfd driver is built in kernel, adding a "mfd.hsu_dma_enable=x" in kernel command line has the same effect. Signed-off-by: Feng Tang Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/mfd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c index 53ff6af16273..c111f36f5d21 100644 --- a/drivers/tty/serial/mfd.c +++ b/drivers/tty/serial/mfd.c @@ -47,6 +47,11 @@ #define mfd_readl(obj, offset) readl(obj->reg + offset) #define mfd_writel(obj, offset, val) writel(val, obj->reg + offset) +static int hsu_dma_enable; +module_param(hsu_dma_enable, int, 0); +MODULE_PARM_DESC(hsu_dma_enable, "It is a bitmap to set working mode, if \ +bit[x] is 1, then port[x] will work in DMA mode, otherwise in PIO mode."); + struct hsu_dma_buffer { u8 *buf; dma_addr_t dma_addr; @@ -1367,6 +1372,12 @@ static void hsu_global_init(void) serial_hsu_ports[i] = uport; uport->index = i; + + if (hsu_dma_enable & (1<use_dma = 1; + else + uport->use_dma = 0; + uport++; } From 2314a0f667352748a48753bf903f8c50fd2a756d Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 18 Feb 2011 16:38:37 +0100 Subject: [PATCH 46/76] tty: serial: altera_jtaguart: Don't use plain integer as NULL pointer This fixes a sparse warning. Signed-off-by: Tobias Klauser Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/altera_jtaguart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c index f9b49b5ff5e1..0c0a8b60f2d6 100644 --- a/drivers/tty/serial/altera_jtaguart.c +++ b/drivers/tty/serial/altera_jtaguart.c @@ -384,7 +384,7 @@ static int __init altera_jtaguart_console_setup(struct console *co, if (co->index < 0 || co->index >= ALTERA_JTAGUART_MAXPORTS) return -EINVAL; port = &altera_jtaguart_ports[co->index].port; - if (port->membase == 0) + if (port->membase == NULL) return -ENODEV; return 0; } From 3231f075070ac61ab7174a9a82bdc6d7b1de10bb Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 18 Feb 2011 16:38:38 +0100 Subject: [PATCH 47/76] tty: serial: altera_jtaguart: Remove unused function early_altera_jtaguart_setup This is not even used in nios2 arch code anymore. Signed-off-by: Tobias Klauser Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/altera_jtaguart.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c index 0c0a8b60f2d6..94ccf4741f0e 100644 --- a/drivers/tty/serial/altera_jtaguart.c +++ b/drivers/tty/serial/altera_jtaguart.c @@ -305,28 +305,6 @@ static struct altera_jtaguart altera_jtaguart_ports[ALTERA_JTAGUART_MAXPORTS]; #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE) -int __init early_altera_jtaguart_setup(struct altera_jtaguart_platform_uart - *platp) -{ - struct uart_port *port; - int i; - - for (i = 0; i < ALTERA_JTAGUART_MAXPORTS && platp[i].mapbase; i++) { - port = &altera_jtaguart_ports[i].port; - - port->line = i; - port->type = PORT_ALTERA_JTAGUART; - port->mapbase = platp[i].mapbase; - port->membase = ioremap(port->mapbase, ALTERA_JTAGUART_SIZE); - port->iotype = SERIAL_IO_MEM; - port->irq = platp[i].irq; - port->flags = ASYNC_BOOT_AUTOCONF; - port->ops = &altera_jtaguart_ops; - } - - return 0; -} - #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS) static void altera_jtaguart_console_putc(struct console *co, const char c) { From 72af4762ee640b717a30761e27fc55126c686568 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 18 Feb 2011 16:38:39 +0100 Subject: [PATCH 48/76] tty: serial: altera_jtaguart: Support getting mapbase and IRQ from resources This will make it easier to get the driver to support device tree. The old platform data method is still supported though. Also change the driver to use only one platform device per port. Signed-off-by: Tobias Klauser Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/altera_jtaguart.c | 61 +++++++++++++++++++--------- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c index 94ccf4741f0e..aa2a4caaa1c3 100644 --- a/drivers/tty/serial/altera_jtaguart.c +++ b/drivers/tty/serial/altera_jtaguart.c @@ -409,22 +409,45 @@ static int __devinit altera_jtaguart_probe(struct platform_device *pdev) { struct altera_jtaguart_platform_uart *platp = pdev->dev.platform_data; struct uart_port *port; - int i; + struct resource *res_irq, *res_mem; + int i = pdev->id; - for (i = 0; i < ALTERA_JTAGUART_MAXPORTS && platp[i].mapbase; i++) { - port = &altera_jtaguart_ports[i].port; + /* -1 emphasizes that the platform must have one port, no .N suffix */ + if (i == -1) + i = 0; - port->line = i; - port->type = PORT_ALTERA_JTAGUART; - port->mapbase = platp[i].mapbase; - port->membase = ioremap(port->mapbase, ALTERA_JTAGUART_SIZE); - port->iotype = SERIAL_IO_MEM; - port->irq = platp[i].irq; - port->ops = &altera_jtaguart_ops; - port->flags = ASYNC_BOOT_AUTOCONF; + if (i >= ALTERA_JTAGUART_MAXPORTS) + return -EINVAL; - uart_add_one_port(&altera_jtaguart_driver, port); - } + port = &altera_jtaguart_ports[i].port; + + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (res_mem) + port->mapbase = res_mem->start; + else if (platp) + port->mapbase = platp->mapbase; + else + return -ENODEV; + + res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (res_irq) + port->irq = res_irq->start; + else if (platp) + port->irq = platp->irq; + else + return -ENODEV; + + port->membase = ioremap(port->mapbase, ALTERA_JTAGUART_SIZE); + if (!port->membase) + return -ENOMEM; + + port->line = i; + port->type = PORT_ALTERA_JTAGUART; + port->iotype = SERIAL_IO_MEM; + port->ops = &altera_jtaguart_ops; + port->flags = ASYNC_BOOT_AUTOCONF; + + uart_add_one_port(&altera_jtaguart_driver, port); return 0; } @@ -432,13 +455,13 @@ static int __devinit altera_jtaguart_probe(struct platform_device *pdev) static int __devexit altera_jtaguart_remove(struct platform_device *pdev) { struct uart_port *port; - int i; + int i = pdev->id; - for (i = 0; i < ALTERA_JTAGUART_MAXPORTS; i++) { - port = &altera_jtaguart_ports[i].port; - if (port) - uart_remove_one_port(&altera_jtaguart_driver, port); - } + if (i == -1) + i = 0; + + port = &altera_jtaguart_ports[i].port; + uart_remove_one_port(&altera_jtaguart_driver, port); return 0; } From 44ed76b78e158d852f640d533b7acc08b91f2132 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 18 Feb 2011 16:38:40 +0100 Subject: [PATCH 49/76] tty: serial: altera_jtaguart: Fixup type usage of port flags port->flags is of type upf_t, which corresponds to UPF_* flags. Signed-off-by: Tobias Klauser Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/altera_jtaguart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c index aa2a4caaa1c3..8f014bb916b7 100644 --- a/drivers/tty/serial/altera_jtaguart.c +++ b/drivers/tty/serial/altera_jtaguart.c @@ -445,7 +445,7 @@ static int __devinit altera_jtaguart_probe(struct platform_device *pdev) port->type = PORT_ALTERA_JTAGUART; port->iotype = SERIAL_IO_MEM; port->ops = &altera_jtaguart_ops; - port->flags = ASYNC_BOOT_AUTOCONF; + port->flags = UPF_BOOT_AUTOCONF; uart_add_one_port(&altera_jtaguart_driver, port); From a6afd9f3e819de4795fcd356e5bfad446e4323f2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 22 Feb 2011 16:14:56 -0800 Subject: [PATCH 50/76] tty: move a number of tty drivers from drivers/char/ to drivers/tty/ As planned by Arnd Bergmann, this moves the following drivers from drivers/char/ to drivers/tty/ as that's where they really belong: amiserial nozomi synclink rocket cyclades moxa mxser isicom bfin_jtag_comm Cc: Arnd Bergmann Cc: Alan Cox Cc: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- drivers/char/Kconfig | 172 ------------------------- drivers/char/Makefile | 11 -- drivers/tty/Kconfig | 171 ++++++++++++++++++++++++ drivers/tty/Makefile | 13 ++ drivers/{char => tty}/amiserial.c | 0 drivers/{char => tty}/bfin_jtag_comm.c | 0 drivers/{char => tty}/cyclades.c | 0 drivers/{char => tty}/isicom.c | 0 drivers/{char => tty}/moxa.c | 0 drivers/{char => tty}/moxa.h | 0 drivers/{char => tty}/mxser.c | 0 drivers/{char => tty}/mxser.h | 0 drivers/{char => tty}/nozomi.c | 0 drivers/{char => tty}/rocket.c | 0 drivers/{char => tty}/rocket.h | 0 drivers/{char => tty}/rocket_int.h | 0 drivers/{char => tty}/synclink.c | 0 drivers/{char => tty}/synclink_gt.c | 0 drivers/{char => tty}/synclinkmp.c | 0 19 files changed, 184 insertions(+), 183 deletions(-) rename drivers/{char => tty}/amiserial.c (100%) rename drivers/{char => tty}/bfin_jtag_comm.c (100%) rename drivers/{char => tty}/cyclades.c (100%) rename drivers/{char => tty}/isicom.c (100%) rename drivers/{char => tty}/moxa.c (100%) rename drivers/{char => tty}/moxa.h (100%) rename drivers/{char => tty}/mxser.c (100%) rename drivers/{char => tty}/mxser.h (100%) rename drivers/{char => tty}/nozomi.c (100%) rename drivers/{char => tty}/rocket.c (100%) rename drivers/{char => tty}/rocket.h (100%) rename drivers/{char => tty}/rocket_int.h (100%) rename drivers/{char => tty}/synclink.c (100%) rename drivers/{char => tty}/synclink_gt.c (100%) rename drivers/{char => tty}/synclinkmp.c (100%) diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 9b9ab867f50e..1adfac6a7b0b 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -15,36 +15,6 @@ config DEVKMEM kind of kernel debugging operations. When in doubt, say "N". -config BFIN_JTAG_COMM - tristate "Blackfin JTAG Communication" - depends on BLACKFIN - help - Add support for emulating a TTY device over the Blackfin JTAG. - - To compile this driver as a module, choose M here: the - module will be called bfin_jtag_comm. - -config BFIN_JTAG_COMM_CONSOLE - bool "Console on Blackfin JTAG" - depends on BFIN_JTAG_COMM=y - -config SERIAL_NONSTANDARD - bool "Non-standard serial port support" - depends on HAS_IOMEM - ---help--- - Say Y here if you have any non-standard serial boards -- boards - which aren't supported using the standard "dumb" serial driver. - This includes intelligent serial boards such as Cyclades, - Digiboards, etc. These are usually used for systems that need many - serial ports because they serve many terminals or dial-in - connections. - - Note that the answer to this question won't directly affect the - kernel: saying N will just cause the configurator to skip all - the questions about non-standard serial boards. - - Most people can say N here. - config COMPUTONE tristate "Computone IntelliPort Plus serial support" depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) @@ -60,50 +30,6 @@ config COMPUTONE To compile this driver as module, choose M here: the module will be called ip2. -config ROCKETPORT - tristate "Comtrol RocketPort support" - depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) - help - This driver supports Comtrol RocketPort and RocketModem PCI boards. - These boards provide 2, 4, 8, 16, or 32 high-speed serial ports or - modems. For information about the RocketPort/RocketModem boards - and this driver read . - - To compile this driver as a module, choose M here: the - module will be called rocket. - - If you want to compile this driver into the kernel, say Y here. If - you don't have a Comtrol RocketPort/RocketModem card installed, say N. - -config CYCLADES - tristate "Cyclades async mux support" - depends on SERIAL_NONSTANDARD && (PCI || ISA) - select FW_LOADER - ---help--- - This driver supports Cyclades Z and Y multiserial boards. - You would need something like this to connect more than two modems to - your Linux box, for instance in order to become a dial-in server. - - For information about the Cyclades-Z card, read - . - - To compile this driver as a module, choose M here: the - module will be called cyclades. - - If you haven't heard about it, it's safe to say N. - -config CYZ_INTR - bool "Cyclades-Z interrupt mode operation (EXPERIMENTAL)" - depends on EXPERIMENTAL && CYCLADES - help - The Cyclades-Z family of multiport cards allows 2 (two) driver op - modes: polling and interrupt. In polling mode, the driver will check - the status of the Cyclades-Z ports every certain amount of time - (which is called polling cycle and is configurable). In interrupt - mode, it will use an interrupt line (IRQ) in order to check the - status of the Cyclades-Z ports. The default op mode is polling. If - unsure, say N. - config DIGIEPCA tristate "Digiboard Intelligent Async Support" depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) @@ -119,94 +45,6 @@ config DIGIEPCA To compile this driver as a module, choose M here: the module will be called epca. -config MOXA_INTELLIO - tristate "Moxa Intellio support" - depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) - select FW_LOADER - help - Say Y here if you have a Moxa Intellio multiport serial card. - - To compile this driver as a module, choose M here: the - module will be called moxa. - -config MOXA_SMARTIO - tristate "Moxa SmartIO support v. 2.0" - depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) - help - Say Y here if you have a Moxa SmartIO multiport serial card and/or - want to help develop a new version of this driver. - - This is upgraded (1.9.1) driver from original Moxa drivers with - changes finally resulting in PCI probing. - - This driver can also be built as a module. The module will be called - mxser. If you want to do that, say M here. - -config ISI - tristate "Multi-Tech multiport card support (EXPERIMENTAL)" - depends on SERIAL_NONSTANDARD && PCI - select FW_LOADER - help - This is a driver for the Multi-Tech cards which provide several - serial ports. The driver is experimental and can currently only be - built as a module. The module will be called isicom. - If you want to do that, choose M here. - -config SYNCLINK - tristate "Microgate SyncLink card support" - depends on SERIAL_NONSTANDARD && PCI && ISA_DMA_API - help - Provides support for the SyncLink ISA and PCI multiprotocol serial - adapters. These adapters support asynchronous and HDLC bit - synchronous communication up to 10Mbps (PCI adapter). - - This driver can only be built as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module will be called synclink. If you want to do that, say M - here. - -config SYNCLINKMP - tristate "SyncLink Multiport support" - depends on SERIAL_NONSTANDARD && PCI - help - Enable support for the SyncLink Multiport (2 or 4 ports) - serial adapter, running asynchronous and HDLC communications up - to 2.048Mbps. Each ports is independently selectable for - RS-232, V.35, RS-449, RS-530, and X.21 - - This driver may be built as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module will be called synclinkmp. If you want to do that, say M - here. - -config SYNCLINK_GT - tristate "SyncLink GT/AC support" - depends on SERIAL_NONSTANDARD && PCI - help - Support for SyncLink GT and SyncLink AC families of - synchronous and asynchronous serial adapters - manufactured by Microgate Systems, Ltd. (www.microgate.com) - -config N_HDLC - tristate "HDLC line discipline support" - depends on SERIAL_NONSTANDARD - help - Allows synchronous HDLC communications with tty device drivers that - support synchronous HDLC such as the Microgate SyncLink adapter. - - This driver can be built as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module will be called n_hdlc. If you want to do that, say M - here. - -config N_GSM - tristate "GSM MUX line discipline support (EXPERIMENTAL)" - depends on EXPERIMENTAL - depends on NET - help - This line discipline provides support for the GSM MUX protocol and - presents the mux as a set of 61 individual tty devices. - config RISCOM8 tristate "SDL RISCom/8 card support" depends on SERIAL_NONSTANDARD @@ -296,16 +134,6 @@ config ISTALLION To compile this driver as a module, choose M here: the module will be called istallion. -config NOZOMI - tristate "HSDPA Broadband Wireless Data Card - Globe Trotter" - depends on PCI && EXPERIMENTAL - help - If you have a HSDPA driver Broadband Wireless Data Card - - Globe Trotter PCMCIA card, say Y here. - - To compile this driver as a module, choose M here, the module - will be called nozomi. - config A2232 tristate "Commodore A2232 serial support (EXPERIMENTAL)" depends on EXPERIMENTAL && ZORRO && BROKEN diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 5bc765d4c3ca..f5dc7c9bce6b 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -5,29 +5,18 @@ obj-y += mem.o random.o obj-$(CONFIG_TTY_PRINTK) += ttyprintk.o obj-y += misc.o -obj-$(CONFIG_BFIN_JTAG_COMM) += bfin_jtag_comm.o obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o -obj-$(CONFIG_ROCKETPORT) += rocket.o obj-$(CONFIG_SERIAL167) += serial167.o -obj-$(CONFIG_CYCLADES) += cyclades.o obj-$(CONFIG_STALLION) += stallion.o obj-$(CONFIG_ISTALLION) += istallion.o -obj-$(CONFIG_NOZOMI) += nozomi.o obj-$(CONFIG_DIGIEPCA) += epca.o obj-$(CONFIG_SPECIALIX) += specialix.o -obj-$(CONFIG_MOXA_INTELLIO) += moxa.o obj-$(CONFIG_A2232) += ser_a2232.o generic_serial.o obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o -obj-$(CONFIG_MOXA_SMARTIO) += mxser.o obj-$(CONFIG_COMPUTONE) += ip2/ obj-$(CONFIG_RISCOM8) += riscom8.o -obj-$(CONFIG_ISI) += isicom.o -obj-$(CONFIG_SYNCLINK) += synclink.o -obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o -obj-$(CONFIG_SYNCLINK_GT) += synclink_gt.o -obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o obj-$(CONFIG_SX) += sx.o generic_serial.o obj-$(CONFIG_RIO) += rio/ generic_serial.o obj-$(CONFIG_RAW_DRIVER) += raw.o diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig index 9cfbdb318ed9..3fd7199301b6 100644 --- a/drivers/tty/Kconfig +++ b/drivers/tty/Kconfig @@ -147,4 +147,175 @@ config LEGACY_PTY_COUNT When not in use, each legacy PTY occupies 12 bytes on 32-bit architectures and 24 bytes on 64-bit architectures. +config BFIN_JTAG_COMM + tristate "Blackfin JTAG Communication" + depends on BLACKFIN + help + Add support for emulating a TTY device over the Blackfin JTAG. + + To compile this driver as a module, choose M here: the + module will be called bfin_jtag_comm. + +config BFIN_JTAG_COMM_CONSOLE + bool "Console on Blackfin JTAG" + depends on BFIN_JTAG_COMM=y + +config SERIAL_NONSTANDARD + bool "Non-standard serial port support" + depends on HAS_IOMEM + ---help--- + Say Y here if you have any non-standard serial boards -- boards + which aren't supported using the standard "dumb" serial driver. + This includes intelligent serial boards such as Cyclades, + Digiboards, etc. These are usually used for systems that need many + serial ports because they serve many terminals or dial-in + connections. + + Note that the answer to this question won't directly affect the + kernel: saying N will just cause the configurator to skip all + the questions about non-standard serial boards. + + Most people can say N here. + +config ROCKETPORT + tristate "Comtrol RocketPort support" + depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) + help + This driver supports Comtrol RocketPort and RocketModem PCI boards. + These boards provide 2, 4, 8, 16, or 32 high-speed serial ports or + modems. For information about the RocketPort/RocketModem boards + and this driver read . + + To compile this driver as a module, choose M here: the + module will be called rocket. + + If you want to compile this driver into the kernel, say Y here. If + you don't have a Comtrol RocketPort/RocketModem card installed, say N. + +config CYCLADES + tristate "Cyclades async mux support" + depends on SERIAL_NONSTANDARD && (PCI || ISA) + select FW_LOADER + ---help--- + This driver supports Cyclades Z and Y multiserial boards. + You would need something like this to connect more than two modems to + your Linux box, for instance in order to become a dial-in server. + + For information about the Cyclades-Z card, read + . + + To compile this driver as a module, choose M here: the + module will be called cyclades. + + If you haven't heard about it, it's safe to say N. + +config CYZ_INTR + bool "Cyclades-Z interrupt mode operation (EXPERIMENTAL)" + depends on EXPERIMENTAL && CYCLADES + help + The Cyclades-Z family of multiport cards allows 2 (two) driver op + modes: polling and interrupt. In polling mode, the driver will check + the status of the Cyclades-Z ports every certain amount of time + (which is called polling cycle and is configurable). In interrupt + mode, it will use an interrupt line (IRQ) in order to check the + status of the Cyclades-Z ports. The default op mode is polling. If + unsure, say N. + +config MOXA_INTELLIO + tristate "Moxa Intellio support" + depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) + select FW_LOADER + help + Say Y here if you have a Moxa Intellio multiport serial card. + + To compile this driver as a module, choose M here: the + module will be called moxa. + +config MOXA_SMARTIO + tristate "Moxa SmartIO support v. 2.0" + depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) + help + Say Y here if you have a Moxa SmartIO multiport serial card and/or + want to help develop a new version of this driver. + + This is upgraded (1.9.1) driver from original Moxa drivers with + changes finally resulting in PCI probing. + + This driver can also be built as a module. The module will be called + mxser. If you want to do that, say M here. + +config SYNCLINK + tristate "Microgate SyncLink card support" + depends on SERIAL_NONSTANDARD && PCI && ISA_DMA_API + help + Provides support for the SyncLink ISA and PCI multiprotocol serial + adapters. These adapters support asynchronous and HDLC bit + synchronous communication up to 10Mbps (PCI adapter). + + This driver can only be built as a module ( = code which can be + inserted in and removed from the running kernel whenever you want). + The module will be called synclink. If you want to do that, say M + here. + +config SYNCLINKMP + tristate "SyncLink Multiport support" + depends on SERIAL_NONSTANDARD && PCI + help + Enable support for the SyncLink Multiport (2 or 4 ports) + serial adapter, running asynchronous and HDLC communications up + to 2.048Mbps. Each ports is independently selectable for + RS-232, V.35, RS-449, RS-530, and X.21 + + This driver may be built as a module ( = code which can be + inserted in and removed from the running kernel whenever you want). + The module will be called synclinkmp. If you want to do that, say M + here. + +config SYNCLINK_GT + tristate "SyncLink GT/AC support" + depends on SERIAL_NONSTANDARD && PCI + help + Support for SyncLink GT and SyncLink AC families of + synchronous and asynchronous serial adapters + manufactured by Microgate Systems, Ltd. (www.microgate.com) + +config NOZOMI + tristate "HSDPA Broadband Wireless Data Card - Globe Trotter" + depends on PCI && EXPERIMENTAL + help + If you have a HSDPA driver Broadband Wireless Data Card - + Globe Trotter PCMCIA card, say Y here. + + To compile this driver as a module, choose M here, the module + will be called nozomi. + +config ISI + tristate "Multi-Tech multiport card support (EXPERIMENTAL)" + depends on SERIAL_NONSTANDARD && PCI + select FW_LOADER + help + This is a driver for the Multi-Tech cards which provide several + serial ports. The driver is experimental and can currently only be + built as a module. The module will be called isicom. + If you want to do that, choose M here. + +config N_HDLC + tristate "HDLC line discipline support" + depends on SERIAL_NONSTANDARD + help + Allows synchronous HDLC communications with tty device drivers that + support synchronous HDLC such as the Microgate SyncLink adapter. + + This driver can be built as a module ( = code which can be + inserted in and removed from the running kernel whenever you want). + The module will be called n_hdlc. If you want to do that, say M + here. + +config N_GSM + tristate "GSM MUX line discipline support (EXPERIMENTAL)" + depends on EXPERIMENTAL + depends on NET + help + This line discipline provides support for the GSM MUX protocol and + presents the mux as a set of 61 individual tty devices. diff --git a/drivers/tty/Makefile b/drivers/tty/Makefile index 396277216e4f..e549da348a04 100644 --- a/drivers/tty/Makefile +++ b/drivers/tty/Makefile @@ -11,3 +11,16 @@ obj-$(CONFIG_R3964) += n_r3964.o obj-y += vt/ obj-$(CONFIG_HVC_DRIVER) += hvc/ obj-y += serial/ + +# tty drivers +obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o +obj-$(CONFIG_BFIN_JTAG_COMM) += bfin_jtag_comm.o +obj-$(CONFIG_CYCLADES) += cyclades.o +obj-$(CONFIG_ISI) += isicom.o +obj-$(CONFIG_MOXA_INTELLIO) += moxa.o +obj-$(CONFIG_MOXA_SMARTIO) += mxser.o +obj-$(CONFIG_NOZOMI) += nozomi.o +obj-$(CONFIG_ROCKETPORT) += rocket.o +obj-$(CONFIG_SYNCLINK_GT) += synclink_gt.o +obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o +obj-$(CONFIG_SYNCLINK) += synclink.o diff --git a/drivers/char/amiserial.c b/drivers/tty/amiserial.c similarity index 100% rename from drivers/char/amiserial.c rename to drivers/tty/amiserial.c diff --git a/drivers/char/bfin_jtag_comm.c b/drivers/tty/bfin_jtag_comm.c similarity index 100% rename from drivers/char/bfin_jtag_comm.c rename to drivers/tty/bfin_jtag_comm.c diff --git a/drivers/char/cyclades.c b/drivers/tty/cyclades.c similarity index 100% rename from drivers/char/cyclades.c rename to drivers/tty/cyclades.c diff --git a/drivers/char/isicom.c b/drivers/tty/isicom.c similarity index 100% rename from drivers/char/isicom.c rename to drivers/tty/isicom.c diff --git a/drivers/char/moxa.c b/drivers/tty/moxa.c similarity index 100% rename from drivers/char/moxa.c rename to drivers/tty/moxa.c diff --git a/drivers/char/moxa.h b/drivers/tty/moxa.h similarity index 100% rename from drivers/char/moxa.h rename to drivers/tty/moxa.h diff --git a/drivers/char/mxser.c b/drivers/tty/mxser.c similarity index 100% rename from drivers/char/mxser.c rename to drivers/tty/mxser.c diff --git a/drivers/char/mxser.h b/drivers/tty/mxser.h similarity index 100% rename from drivers/char/mxser.h rename to drivers/tty/mxser.h diff --git a/drivers/char/nozomi.c b/drivers/tty/nozomi.c similarity index 100% rename from drivers/char/nozomi.c rename to drivers/tty/nozomi.c diff --git a/drivers/char/rocket.c b/drivers/tty/rocket.c similarity index 100% rename from drivers/char/rocket.c rename to drivers/tty/rocket.c diff --git a/drivers/char/rocket.h b/drivers/tty/rocket.h similarity index 100% rename from drivers/char/rocket.h rename to drivers/tty/rocket.h diff --git a/drivers/char/rocket_int.h b/drivers/tty/rocket_int.h similarity index 100% rename from drivers/char/rocket_int.h rename to drivers/tty/rocket_int.h diff --git a/drivers/char/synclink.c b/drivers/tty/synclink.c similarity index 100% rename from drivers/char/synclink.c rename to drivers/tty/synclink.c diff --git a/drivers/char/synclink_gt.c b/drivers/tty/synclink_gt.c similarity index 100% rename from drivers/char/synclink_gt.c rename to drivers/tty/synclink_gt.c diff --git a/drivers/char/synclinkmp.c b/drivers/tty/synclinkmp.c similarity index 100% rename from drivers/char/synclinkmp.c rename to drivers/tty/synclinkmp.c From 282361a046edd9d58a134f358a3f65a7cb8655d9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 22 Feb 2011 16:23:22 -0800 Subject: [PATCH 51/76] tty: move ipwireless driver from drivers/char/pcmcia/ to drivers/tty/ As planned by Arnd Bergmann, this moves the ipwireless driver to the drivers/tty/ directory as that's where it really belongs. Cc: Arnd Bergmann Cc: Alan Cox Cc: Jiri Slaby Cc: David Sterba Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 2 +- drivers/tty/Makefile | 2 ++ drivers/{char/pcmcia => tty}/ipwireless/Makefile | 0 drivers/{char/pcmcia => tty}/ipwireless/hardware.c | 0 drivers/{char/pcmcia => tty}/ipwireless/hardware.h | 0 drivers/{char/pcmcia => tty}/ipwireless/main.c | 0 drivers/{char/pcmcia => tty}/ipwireless/main.h | 0 drivers/{char/pcmcia => tty}/ipwireless/network.c | 0 drivers/{char/pcmcia => tty}/ipwireless/network.h | 0 drivers/{char/pcmcia => tty}/ipwireless/setup_protocol.h | 0 drivers/{char/pcmcia => tty}/ipwireless/tty.c | 0 drivers/{char/pcmcia => tty}/ipwireless/tty.h | 0 12 files changed, 3 insertions(+), 1 deletion(-) rename drivers/{char/pcmcia => tty}/ipwireless/Makefile (100%) rename drivers/{char/pcmcia => tty}/ipwireless/hardware.c (100%) rename drivers/{char/pcmcia => tty}/ipwireless/hardware.h (100%) rename drivers/{char/pcmcia => tty}/ipwireless/main.c (100%) rename drivers/{char/pcmcia => tty}/ipwireless/main.h (100%) rename drivers/{char/pcmcia => tty}/ipwireless/network.c (100%) rename drivers/{char/pcmcia => tty}/ipwireless/network.h (100%) rename drivers/{char/pcmcia => tty}/ipwireless/setup_protocol.h (100%) rename drivers/{char/pcmcia => tty}/ipwireless/tty.c (100%) rename drivers/{char/pcmcia => tty}/ipwireless/tty.h (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 1eaeda66a525..e39337a1b958 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3423,7 +3423,7 @@ M: Jiri Kosina M: David Sterba S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/ipwireless_cs.git -F: drivers/char/pcmcia/ipwireless/ +F: drivers/tty/ipwireless/ IPX NETWORK LAYER M: Arnaldo Carvalho de Melo diff --git a/drivers/tty/Makefile b/drivers/tty/Makefile index e549da348a04..690522fcb338 100644 --- a/drivers/tty/Makefile +++ b/drivers/tty/Makefile @@ -24,3 +24,5 @@ obj-$(CONFIG_ROCKETPORT) += rocket.o obj-$(CONFIG_SYNCLINK_GT) += synclink_gt.o obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o obj-$(CONFIG_SYNCLINK) += synclink.o + +obj-y += ipwireless/ diff --git a/drivers/char/pcmcia/ipwireless/Makefile b/drivers/tty/ipwireless/Makefile similarity index 100% rename from drivers/char/pcmcia/ipwireless/Makefile rename to drivers/tty/ipwireless/Makefile diff --git a/drivers/char/pcmcia/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c similarity index 100% rename from drivers/char/pcmcia/ipwireless/hardware.c rename to drivers/tty/ipwireless/hardware.c diff --git a/drivers/char/pcmcia/ipwireless/hardware.h b/drivers/tty/ipwireless/hardware.h similarity index 100% rename from drivers/char/pcmcia/ipwireless/hardware.h rename to drivers/tty/ipwireless/hardware.h diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/tty/ipwireless/main.c similarity index 100% rename from drivers/char/pcmcia/ipwireless/main.c rename to drivers/tty/ipwireless/main.c diff --git a/drivers/char/pcmcia/ipwireless/main.h b/drivers/tty/ipwireless/main.h similarity index 100% rename from drivers/char/pcmcia/ipwireless/main.h rename to drivers/tty/ipwireless/main.h diff --git a/drivers/char/pcmcia/ipwireless/network.c b/drivers/tty/ipwireless/network.c similarity index 100% rename from drivers/char/pcmcia/ipwireless/network.c rename to drivers/tty/ipwireless/network.c diff --git a/drivers/char/pcmcia/ipwireless/network.h b/drivers/tty/ipwireless/network.h similarity index 100% rename from drivers/char/pcmcia/ipwireless/network.h rename to drivers/tty/ipwireless/network.h diff --git a/drivers/char/pcmcia/ipwireless/setup_protocol.h b/drivers/tty/ipwireless/setup_protocol.h similarity index 100% rename from drivers/char/pcmcia/ipwireless/setup_protocol.h rename to drivers/tty/ipwireless/setup_protocol.h diff --git a/drivers/char/pcmcia/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c similarity index 100% rename from drivers/char/pcmcia/ipwireless/tty.c rename to drivers/tty/ipwireless/tty.c diff --git a/drivers/char/pcmcia/ipwireless/tty.h b/drivers/tty/ipwireless/tty.h similarity index 100% rename from drivers/char/pcmcia/ipwireless/tty.h rename to drivers/tty/ipwireless/tty.h From 4a6514e6d096716fb7bedf238efaaca877e2a7e8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 22 Feb 2011 16:57:21 -0800 Subject: [PATCH 52/76] tty: move obsolete and broken tty drivers to drivers/staging/tty/ As planned by Arnd Bergmann, this moves the following drivers to the drivers/staging/tty/ directory where they will be removed after 2.6.41 if no one steps up to claim them. epca epca ip2 istallion riscom8 serial167 specialix stallion Cc: Arnd Bergmann Cc: Alan Cox Cc: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- arch/m68k/Kconfig | 8 -- drivers/char/Kconfig | 79 ----------------- drivers/char/Makefile | 7 -- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/tty/Kconfig | 87 +++++++++++++++++++ drivers/staging/tty/Makefile | 7 ++ drivers/staging/tty/TODO | 6 ++ drivers/{char => staging/tty}/epca.c | 0 drivers/{char => staging/tty}/epca.h | 0 drivers/{char => staging/tty}/epcaconfig.h | 0 drivers/{char => staging/tty}/ip2/Makefile | 0 drivers/{char => staging/tty}/ip2/i2cmd.c | 0 drivers/{char => staging/tty}/ip2/i2cmd.h | 0 drivers/{char => staging/tty}/ip2/i2ellis.c | 0 drivers/{char => staging/tty}/ip2/i2ellis.h | 0 drivers/{char => staging/tty}/ip2/i2hw.h | 0 drivers/{char => staging/tty}/ip2/i2lib.c | 0 drivers/{char => staging/tty}/ip2/i2lib.h | 0 drivers/{char => staging/tty}/ip2/i2pack.h | 0 drivers/{char => staging/tty}/ip2/ip2.h | 0 drivers/{char => staging/tty}/ip2/ip2ioctl.h | 0 drivers/{char => staging/tty}/ip2/ip2main.c | 0 drivers/{char => staging/tty}/ip2/ip2trace.h | 0 drivers/{char => staging/tty}/ip2/ip2types.h | 0 drivers/{char => staging/tty}/istallion.c | 0 drivers/{char => staging/tty}/riscom8.c | 0 drivers/{char => staging/tty}/riscom8.h | 0 drivers/{char => staging/tty}/riscom8_reg.h | 0 drivers/{char => staging/tty}/serial167.c | 0 drivers/{char => staging/tty}/specialix.c | 0 drivers/{char => staging/tty}/specialix_io8.h | 0 drivers/{char => staging/tty}/stallion.c | 0 33 files changed, 103 insertions(+), 94 deletions(-) create mode 100644 drivers/staging/tty/Kconfig create mode 100644 drivers/staging/tty/Makefile create mode 100644 drivers/staging/tty/TODO rename drivers/{char => staging/tty}/epca.c (100%) rename drivers/{char => staging/tty}/epca.h (100%) rename drivers/{char => staging/tty}/epcaconfig.h (100%) rename drivers/{char => staging/tty}/ip2/Makefile (100%) rename drivers/{char => staging/tty}/ip2/i2cmd.c (100%) rename drivers/{char => staging/tty}/ip2/i2cmd.h (100%) rename drivers/{char => staging/tty}/ip2/i2ellis.c (100%) rename drivers/{char => staging/tty}/ip2/i2ellis.h (100%) rename drivers/{char => staging/tty}/ip2/i2hw.h (100%) rename drivers/{char => staging/tty}/ip2/i2lib.c (100%) rename drivers/{char => staging/tty}/ip2/i2lib.h (100%) rename drivers/{char => staging/tty}/ip2/i2pack.h (100%) rename drivers/{char => staging/tty}/ip2/ip2.h (100%) rename drivers/{char => staging/tty}/ip2/ip2ioctl.h (100%) rename drivers/{char => staging/tty}/ip2/ip2main.c (100%) rename drivers/{char => staging/tty}/ip2/ip2trace.h (100%) rename drivers/{char => staging/tty}/ip2/ip2types.h (100%) rename drivers/{char => staging/tty}/istallion.c (100%) rename drivers/{char => staging/tty}/riscom8.c (100%) rename drivers/{char => staging/tty}/riscom8.h (100%) rename drivers/{char => staging/tty}/riscom8_reg.h (100%) rename drivers/{char => staging/tty}/serial167.c (100%) rename drivers/{char => staging/tty}/specialix.c (100%) rename drivers/{char => staging/tty}/specialix_io8.h (100%) rename drivers/{char => staging/tty}/stallion.c (100%) diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index bc9271b85759..a85e251c411f 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -554,14 +554,6 @@ config MVME147_SCC This is the driver for the serial ports on the Motorola MVME147 boards. Everyone using one of these boards should say Y here. -config SERIAL167 - bool "CD2401 support for MVME166/7 serial ports" - depends on MVME16x - help - This is the driver for the serial ports on the Motorola MVME166, - 167, and 172 boards. Everyone using one of these boards should say - Y here. - config MVME162_SCC bool "SCC support for MVME162 serial ports" depends on MVME16x && BROKEN diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 1adfac6a7b0b..7b8cf0295f6c 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -15,63 +15,6 @@ config DEVKMEM kind of kernel debugging operations. When in doubt, say "N". -config COMPUTONE - tristate "Computone IntelliPort Plus serial support" - depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) - ---help--- - This driver supports the entire family of Intelliport II/Plus - controllers with the exception of the MicroChannel controllers and - products previous to the Intelliport II. These are multiport cards, - which give you many serial ports. You would need something like this - to connect more than two modems to your Linux box, for instance in - order to become a dial-in server. If you have a card like that, say - Y here and read . - - To compile this driver as module, choose M here: the - module will be called ip2. - -config DIGIEPCA - tristate "Digiboard Intelligent Async Support" - depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) - ---help--- - This is a driver for Digi International's Xx, Xeve, and Xem series - of cards which provide multiple serial ports. You would need - something like this to connect more than two modems to your Linux - box, for instance in order to become a dial-in server. This driver - supports the original PC (ISA) boards as well as PCI, and EISA. If - you have a card like this, say Y here and read the file - . - - To compile this driver as a module, choose M here: the - module will be called epca. - -config RISCOM8 - tristate "SDL RISCom/8 card support" - depends on SERIAL_NONSTANDARD - help - This is a driver for the SDL Communications RISCom/8 multiport card, - which gives you many serial ports. You would need something like - this to connect more than two modems to your Linux box, for instance - in order to become a dial-in server. If you have a card like that, - say Y here and read the file . - - Also it's possible to say M here and compile this driver as kernel - loadable module; the module will be called riscom8. - -config SPECIALIX - tristate "Specialix IO8+ card support" - depends on SERIAL_NONSTANDARD - help - This is a driver for the Specialix IO8+ multiport card (both the - ISA and the PCI version) which gives you many serial ports. You - would need something like this to connect more than two modems to - your Linux box, for instance in order to become a dial-in server. - - If you have a card like that, say Y here and read the file - . Also it's possible to say - M here and compile this driver as kernel loadable module which will be - called specialix. - config SX tristate "Specialix SX (and SI) card support" depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) && BROKEN @@ -112,28 +55,6 @@ config STALDRV in this case. If you have never heard about all this, it's safe to say N. -config STALLION - tristate "Stallion EasyIO or EC8/32 support" - depends on STALDRV && (ISA || EISA || PCI) - help - If you have an EasyIO or EasyConnection 8/32 multiport Stallion - card, then this is for you; say Y. Make sure to read - . - - To compile this driver as a module, choose M here: the - module will be called stallion. - -config ISTALLION - tristate "Stallion EC8/64, ONboard, Brumby support" - depends on STALDRV && (ISA || EISA || PCI) - help - If you have an EasyConnection 8/64, ONboard, Brumby or Stallion - serial multiport card, say Y here. Make sure to read - . - - To compile this driver as a module, choose M here: the - module will be called istallion. - config A2232 tristate "Commodore A2232 serial support (EXPERIMENTAL)" depends on EXPERIMENTAL && ZORRO && BROKEN diff --git a/drivers/char/Makefile b/drivers/char/Makefile index f5dc7c9bce6b..48bb8acbea49 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -8,15 +8,8 @@ obj-y += misc.o obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o -obj-$(CONFIG_SERIAL167) += serial167.o -obj-$(CONFIG_STALLION) += stallion.o -obj-$(CONFIG_ISTALLION) += istallion.o -obj-$(CONFIG_DIGIEPCA) += epca.o -obj-$(CONFIG_SPECIALIX) += specialix.o obj-$(CONFIG_A2232) += ser_a2232.o generic_serial.o obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o -obj-$(CONFIG_COMPUTONE) += ip2/ -obj-$(CONFIG_RISCOM8) += riscom8.o obj-$(CONFIG_SX) += sx.o generic_serial.o obj-$(CONFIG_RIO) += rio/ generic_serial.o obj-$(CONFIG_RAW_DRIVER) += raw.o diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 5c8fcfc42c3e..fb1fc4e5a8cb 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -41,6 +41,8 @@ config STAGING_EXCLUDE_BUILD if !STAGING_EXCLUDE_BUILD +source "drivers/staging/tty/Kconfig" + source "drivers/staging/et131x/Kconfig" source "drivers/staging/slicoss/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index d53886317826..f498e345a01d 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -3,6 +3,7 @@ # fix for build system bug... obj-$(CONFIG_STAGING) += staging.o +obj-y += tty/ obj-$(CONFIG_ET131X) += et131x/ obj-$(CONFIG_SLICOSS) += slicoss/ obj-$(CONFIG_VIDEO_GO7007) += go7007/ diff --git a/drivers/staging/tty/Kconfig b/drivers/staging/tty/Kconfig new file mode 100644 index 000000000000..77103a07abbd --- /dev/null +++ b/drivers/staging/tty/Kconfig @@ -0,0 +1,87 @@ +config STALLION + tristate "Stallion EasyIO or EC8/32 support" + depends on STALDRV && (ISA || EISA || PCI) + help + If you have an EasyIO or EasyConnection 8/32 multiport Stallion + card, then this is for you; say Y. Make sure to read + . + + To compile this driver as a module, choose M here: the + module will be called stallion. + +config ISTALLION + tristate "Stallion EC8/64, ONboard, Brumby support" + depends on STALDRV && (ISA || EISA || PCI) + help + If you have an EasyConnection 8/64, ONboard, Brumby or Stallion + serial multiport card, say Y here. Make sure to read + . + + To compile this driver as a module, choose M here: the + module will be called istallion. + +config DIGIEPCA + tristate "Digiboard Intelligent Async Support" + depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) + ---help--- + This is a driver for Digi International's Xx, Xeve, and Xem series + of cards which provide multiple serial ports. You would need + something like this to connect more than two modems to your Linux + box, for instance in order to become a dial-in server. This driver + supports the original PC (ISA) boards as well as PCI, and EISA. If + you have a card like this, say Y here and read the file + . + + To compile this driver as a module, choose M here: the + module will be called epca. + +config RISCOM8 + tristate "SDL RISCom/8 card support" + depends on SERIAL_NONSTANDARD + help + This is a driver for the SDL Communications RISCom/8 multiport card, + which gives you many serial ports. You would need something like + this to connect more than two modems to your Linux box, for instance + in order to become a dial-in server. If you have a card like that, + say Y here and read the file . + + Also it's possible to say M here and compile this driver as kernel + loadable module; the module will be called riscom8. + +config SPECIALIX + tristate "Specialix IO8+ card support" + depends on SERIAL_NONSTANDARD + help + This is a driver for the Specialix IO8+ multiport card (both the + ISA and the PCI version) which gives you many serial ports. You + would need something like this to connect more than two modems to + your Linux box, for instance in order to become a dial-in server. + + If you have a card like that, say Y here and read the file + . Also it's possible to say + M here and compile this driver as kernel loadable module which will be + called specialix. + +config COMPUTONE + tristate "Computone IntelliPort Plus serial support" + depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) + ---help--- + This driver supports the entire family of Intelliport II/Plus + controllers with the exception of the MicroChannel controllers and + products previous to the Intelliport II. These are multiport cards, + which give you many serial ports. You would need something like this + to connect more than two modems to your Linux box, for instance in + order to become a dial-in server. If you have a card like that, say + Y here and read . + + To compile this driver as module, choose M here: the + module will be called ip2. + +config SERIAL167 + bool "CD2401 support for MVME166/7 serial ports" + depends on MVME16x + help + This is the driver for the serial ports on the Motorola MVME166, + 167, and 172 boards. Everyone using one of these boards should say + Y here. + diff --git a/drivers/staging/tty/Makefile b/drivers/staging/tty/Makefile new file mode 100644 index 000000000000..ac57c105611b --- /dev/null +++ b/drivers/staging/tty/Makefile @@ -0,0 +1,7 @@ +obj-$(CONFIG_STALLION) += stallion.o +obj-$(CONFIG_ISTALLION) += istallion.o +obj-$(CONFIG_DIGIEPCA) += epca.o +obj-$(CONFIG_SERIAL167) += serial167.o +obj-$(CONFIG_SPECIALIX) += specialix.o +obj-$(CONFIG_RISCOM8) += riscom8.o +obj-$(CONFIG_COMPUTONE) += ip2/ diff --git a/drivers/staging/tty/TODO b/drivers/staging/tty/TODO new file mode 100644 index 000000000000..88756453ac6c --- /dev/null +++ b/drivers/staging/tty/TODO @@ -0,0 +1,6 @@ +These are a few tty/serial drivers that either do not build, +or work if they do build, or if they seem to work, are for obsolete +hardware, or are full of unfixable races and no one uses them anymore. + +If no one steps up to adopt any of these drivers, they will be removed +in the 2.6.41 release. diff --git a/drivers/char/epca.c b/drivers/staging/tty/epca.c similarity index 100% rename from drivers/char/epca.c rename to drivers/staging/tty/epca.c diff --git a/drivers/char/epca.h b/drivers/staging/tty/epca.h similarity index 100% rename from drivers/char/epca.h rename to drivers/staging/tty/epca.h diff --git a/drivers/char/epcaconfig.h b/drivers/staging/tty/epcaconfig.h similarity index 100% rename from drivers/char/epcaconfig.h rename to drivers/staging/tty/epcaconfig.h diff --git a/drivers/char/ip2/Makefile b/drivers/staging/tty/ip2/Makefile similarity index 100% rename from drivers/char/ip2/Makefile rename to drivers/staging/tty/ip2/Makefile diff --git a/drivers/char/ip2/i2cmd.c b/drivers/staging/tty/ip2/i2cmd.c similarity index 100% rename from drivers/char/ip2/i2cmd.c rename to drivers/staging/tty/ip2/i2cmd.c diff --git a/drivers/char/ip2/i2cmd.h b/drivers/staging/tty/ip2/i2cmd.h similarity index 100% rename from drivers/char/ip2/i2cmd.h rename to drivers/staging/tty/ip2/i2cmd.h diff --git a/drivers/char/ip2/i2ellis.c b/drivers/staging/tty/ip2/i2ellis.c similarity index 100% rename from drivers/char/ip2/i2ellis.c rename to drivers/staging/tty/ip2/i2ellis.c diff --git a/drivers/char/ip2/i2ellis.h b/drivers/staging/tty/ip2/i2ellis.h similarity index 100% rename from drivers/char/ip2/i2ellis.h rename to drivers/staging/tty/ip2/i2ellis.h diff --git a/drivers/char/ip2/i2hw.h b/drivers/staging/tty/ip2/i2hw.h similarity index 100% rename from drivers/char/ip2/i2hw.h rename to drivers/staging/tty/ip2/i2hw.h diff --git a/drivers/char/ip2/i2lib.c b/drivers/staging/tty/ip2/i2lib.c similarity index 100% rename from drivers/char/ip2/i2lib.c rename to drivers/staging/tty/ip2/i2lib.c diff --git a/drivers/char/ip2/i2lib.h b/drivers/staging/tty/ip2/i2lib.h similarity index 100% rename from drivers/char/ip2/i2lib.h rename to drivers/staging/tty/ip2/i2lib.h diff --git a/drivers/char/ip2/i2pack.h b/drivers/staging/tty/ip2/i2pack.h similarity index 100% rename from drivers/char/ip2/i2pack.h rename to drivers/staging/tty/ip2/i2pack.h diff --git a/drivers/char/ip2/ip2.h b/drivers/staging/tty/ip2/ip2.h similarity index 100% rename from drivers/char/ip2/ip2.h rename to drivers/staging/tty/ip2/ip2.h diff --git a/drivers/char/ip2/ip2ioctl.h b/drivers/staging/tty/ip2/ip2ioctl.h similarity index 100% rename from drivers/char/ip2/ip2ioctl.h rename to drivers/staging/tty/ip2/ip2ioctl.h diff --git a/drivers/char/ip2/ip2main.c b/drivers/staging/tty/ip2/ip2main.c similarity index 100% rename from drivers/char/ip2/ip2main.c rename to drivers/staging/tty/ip2/ip2main.c diff --git a/drivers/char/ip2/ip2trace.h b/drivers/staging/tty/ip2/ip2trace.h similarity index 100% rename from drivers/char/ip2/ip2trace.h rename to drivers/staging/tty/ip2/ip2trace.h diff --git a/drivers/char/ip2/ip2types.h b/drivers/staging/tty/ip2/ip2types.h similarity index 100% rename from drivers/char/ip2/ip2types.h rename to drivers/staging/tty/ip2/ip2types.h diff --git a/drivers/char/istallion.c b/drivers/staging/tty/istallion.c similarity index 100% rename from drivers/char/istallion.c rename to drivers/staging/tty/istallion.c diff --git a/drivers/char/riscom8.c b/drivers/staging/tty/riscom8.c similarity index 100% rename from drivers/char/riscom8.c rename to drivers/staging/tty/riscom8.c diff --git a/drivers/char/riscom8.h b/drivers/staging/tty/riscom8.h similarity index 100% rename from drivers/char/riscom8.h rename to drivers/staging/tty/riscom8.h diff --git a/drivers/char/riscom8_reg.h b/drivers/staging/tty/riscom8_reg.h similarity index 100% rename from drivers/char/riscom8_reg.h rename to drivers/staging/tty/riscom8_reg.h diff --git a/drivers/char/serial167.c b/drivers/staging/tty/serial167.c similarity index 100% rename from drivers/char/serial167.c rename to drivers/staging/tty/serial167.c diff --git a/drivers/char/specialix.c b/drivers/staging/tty/specialix.c similarity index 100% rename from drivers/char/specialix.c rename to drivers/staging/tty/specialix.c diff --git a/drivers/char/specialix_io8.h b/drivers/staging/tty/specialix_io8.h similarity index 100% rename from drivers/char/specialix_io8.h rename to drivers/staging/tty/specialix_io8.h diff --git a/drivers/char/stallion.c b/drivers/staging/tty/stallion.c similarity index 100% rename from drivers/char/stallion.c rename to drivers/staging/tty/stallion.c From 4c37705877e74c02c968735c2eee0f84914cf557 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 22 Feb 2011 17:09:33 -0800 Subject: [PATCH 53/76] tty: move obsolete and broken generic_serial drivers to drivers/staging/generic_serial/ As planned by Arnd Bergmann, this moves the following drivers to the drivers/staging/generic_serial directory where they will be removed after 2.6.41 if no one steps up to claim them. generic_serial rio ser_a2232 sx vme_scc Cc: Arnd Bergmann Cc: Alan Cox Cc: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- drivers/char/Kconfig | 44 ------------------ drivers/char/Makefile | 6 --- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/generic_serial/Kconfig | 45 +++++++++++++++++++ drivers/staging/generic_serial/Makefile | 6 +++ drivers/staging/generic_serial/TODO | 6 +++ .../generic_serial}/generic_serial.c | 0 .../generic_serial}/rio/Makefile | 0 .../generic_serial}/rio/board.h | 0 .../generic_serial}/rio/cirrus.h | 0 .../generic_serial}/rio/cmdblk.h | 0 .../generic_serial}/rio/cmdpkt.h | 0 .../generic_serial}/rio/daemon.h | 0 .../generic_serial}/rio/errors.h | 0 .../generic_serial}/rio/func.h | 0 .../generic_serial}/rio/host.h | 0 .../generic_serial}/rio/link.h | 0 .../generic_serial}/rio/linux_compat.h | 0 .../generic_serial}/rio/map.h | 0 .../generic_serial}/rio/param.h | 0 .../generic_serial}/rio/parmmap.h | 0 .../generic_serial}/rio/pci.h | 0 .../generic_serial}/rio/phb.h | 0 .../generic_serial}/rio/pkt.h | 0 .../generic_serial}/rio/port.h | 0 .../generic_serial}/rio/protsts.h | 0 .../generic_serial}/rio/rio.h | 0 .../generic_serial}/rio/rio_linux.c | 0 .../generic_serial}/rio/rio_linux.h | 0 .../generic_serial}/rio/rioboard.h | 0 .../generic_serial}/rio/rioboot.c | 0 .../generic_serial}/rio/riocmd.c | 0 .../generic_serial}/rio/rioctrl.c | 0 .../generic_serial}/rio/riodrvr.h | 0 .../generic_serial}/rio/rioinfo.h | 0 .../generic_serial}/rio/rioinit.c | 0 .../generic_serial}/rio/riointr.c | 0 .../generic_serial}/rio/rioioctl.h | 0 .../generic_serial}/rio/rioparam.c | 0 .../generic_serial}/rio/rioroute.c | 0 .../generic_serial}/rio/riospace.h | 0 .../generic_serial}/rio/riotable.c | 0 .../generic_serial}/rio/riotty.c | 0 .../generic_serial}/rio/route.h | 0 .../generic_serial}/rio/rup.h | 0 .../generic_serial}/rio/unixrup.h | 0 .../generic_serial}/ser_a2232.c | 0 .../generic_serial}/ser_a2232.h | 0 .../generic_serial}/ser_a2232fw.ax | 0 .../generic_serial}/ser_a2232fw.h | 0 drivers/{char => staging/generic_serial}/sx.c | 0 drivers/{char => staging/generic_serial}/sx.h | 0 .../generic_serial}/sxboards.h | 0 .../generic_serial}/sxwindow.h | 0 .../generic_serial}/vme_scc.c | 0 56 files changed, 60 insertions(+), 50 deletions(-) create mode 100644 drivers/staging/generic_serial/Kconfig create mode 100644 drivers/staging/generic_serial/Makefile create mode 100644 drivers/staging/generic_serial/TODO rename drivers/{char => staging/generic_serial}/generic_serial.c (100%) rename drivers/{char => staging/generic_serial}/rio/Makefile (100%) rename drivers/{char => staging/generic_serial}/rio/board.h (100%) rename drivers/{char => staging/generic_serial}/rio/cirrus.h (100%) rename drivers/{char => staging/generic_serial}/rio/cmdblk.h (100%) rename drivers/{char => staging/generic_serial}/rio/cmdpkt.h (100%) rename drivers/{char => staging/generic_serial}/rio/daemon.h (100%) rename drivers/{char => staging/generic_serial}/rio/errors.h (100%) rename drivers/{char => staging/generic_serial}/rio/func.h (100%) rename drivers/{char => staging/generic_serial}/rio/host.h (100%) rename drivers/{char => staging/generic_serial}/rio/link.h (100%) rename drivers/{char => staging/generic_serial}/rio/linux_compat.h (100%) rename drivers/{char => staging/generic_serial}/rio/map.h (100%) rename drivers/{char => staging/generic_serial}/rio/param.h (100%) rename drivers/{char => staging/generic_serial}/rio/parmmap.h (100%) rename drivers/{char => staging/generic_serial}/rio/pci.h (100%) rename drivers/{char => staging/generic_serial}/rio/phb.h (100%) rename drivers/{char => staging/generic_serial}/rio/pkt.h (100%) rename drivers/{char => staging/generic_serial}/rio/port.h (100%) rename drivers/{char => staging/generic_serial}/rio/protsts.h (100%) rename drivers/{char => staging/generic_serial}/rio/rio.h (100%) rename drivers/{char => staging/generic_serial}/rio/rio_linux.c (100%) rename drivers/{char => staging/generic_serial}/rio/rio_linux.h (100%) rename drivers/{char => staging/generic_serial}/rio/rioboard.h (100%) rename drivers/{char => staging/generic_serial}/rio/rioboot.c (100%) rename drivers/{char => staging/generic_serial}/rio/riocmd.c (100%) rename drivers/{char => staging/generic_serial}/rio/rioctrl.c (100%) rename drivers/{char => staging/generic_serial}/rio/riodrvr.h (100%) rename drivers/{char => staging/generic_serial}/rio/rioinfo.h (100%) rename drivers/{char => staging/generic_serial}/rio/rioinit.c (100%) rename drivers/{char => staging/generic_serial}/rio/riointr.c (100%) rename drivers/{char => staging/generic_serial}/rio/rioioctl.h (100%) rename drivers/{char => staging/generic_serial}/rio/rioparam.c (100%) rename drivers/{char => staging/generic_serial}/rio/rioroute.c (100%) rename drivers/{char => staging/generic_serial}/rio/riospace.h (100%) rename drivers/{char => staging/generic_serial}/rio/riotable.c (100%) rename drivers/{char => staging/generic_serial}/rio/riotty.c (100%) rename drivers/{char => staging/generic_serial}/rio/route.h (100%) rename drivers/{char => staging/generic_serial}/rio/rup.h (100%) rename drivers/{char => staging/generic_serial}/rio/unixrup.h (100%) rename drivers/{char => staging/generic_serial}/ser_a2232.c (100%) rename drivers/{char => staging/generic_serial}/ser_a2232.h (100%) rename drivers/{char => staging/generic_serial}/ser_a2232fw.ax (100%) rename drivers/{char => staging/generic_serial}/ser_a2232fw.h (100%) rename drivers/{char => staging/generic_serial}/sx.c (100%) rename drivers/{char => staging/generic_serial}/sx.h (100%) rename drivers/{char => staging/generic_serial}/sxboards.h (100%) rename drivers/{char => staging/generic_serial}/sxwindow.h (100%) rename drivers/{char => staging/generic_serial}/vme_scc.c (100%) diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 7b8cf0295f6c..04f8b2d083c6 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -15,34 +15,6 @@ config DEVKMEM kind of kernel debugging operations. When in doubt, say "N". -config SX - tristate "Specialix SX (and SI) card support" - depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) && BROKEN - help - This is a driver for the SX and SI multiport serial cards. - Please read the file for details. - - This driver can only be built as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module will be called sx. If you want to do that, say M here. - -config RIO - tristate "Specialix RIO system support" - depends on SERIAL_NONSTANDARD && BROKEN - help - This is a driver for the Specialix RIO, a smart serial card which - drives an outboard box that can support up to 128 ports. Product - information is at . - There are both ISA and PCI versions. - -config RIO_OLDPCI - bool "Support really old RIO/PCI cards" - depends on RIO - help - Older RIO PCI cards need some initialization-time configuration to - determine the IRQ and some control addresses. If you have a RIO and - this doesn't seem to work, try setting this to Y. - config STALDRV bool "Stallion multiport serial support" depends on SERIAL_NONSTANDARD @@ -55,22 +27,6 @@ config STALDRV in this case. If you have never heard about all this, it's safe to say N. -config A2232 - tristate "Commodore A2232 serial support (EXPERIMENTAL)" - depends on EXPERIMENTAL && ZORRO && BROKEN - ---help--- - This option supports the 2232 7-port serial card shipped with the - Amiga 2000 and other Zorro-bus machines, dating from 1989. At - a max of 19,200 bps, the ports are served by a 6551 ACIA UART chip - each, plus a 8520 CIA, and a master 6502 CPU and buffer as well. The - ports were connected with 8 pin DIN connectors on the card bracket, - for which 8 pin to DB25 adapters were supplied. The card also had - jumpers internally to toggle various pinning configurations. - - This driver can be built as a module; but then "generic_serial" - will also be built as a module. This has to be loaded before - "ser_a2232". If you want to do this, answer M here. - config SGI_SNSC bool "SGI Altix system controller communication support" depends on (IA64_SGI_SN2 || IA64_GENERIC) diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 48bb8acbea49..3ca1f627be8a 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -5,13 +5,7 @@ obj-y += mem.o random.o obj-$(CONFIG_TTY_PRINTK) += ttyprintk.o obj-y += misc.o -obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o -obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o -obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o -obj-$(CONFIG_A2232) += ser_a2232.o generic_serial.o obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o -obj-$(CONFIG_SX) += sx.o generic_serial.o -obj-$(CONFIG_RIO) += rio/ generic_serial.o obj-$(CONFIG_RAW_DRIVER) += raw.o obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o obj-$(CONFIG_MSPEC) += mspec.o diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index fb1fc4e5a8cb..58e4a8e15a0e 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -43,6 +43,8 @@ if !STAGING_EXCLUDE_BUILD source "drivers/staging/tty/Kconfig" +source "drivers/staging/generic_serial/Kconfig" + source "drivers/staging/et131x/Kconfig" source "drivers/staging/slicoss/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index f498e345a01d..ff7372d25c91 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_STAGING) += staging.o obj-y += tty/ +obj-y += generic_serial/ obj-$(CONFIG_ET131X) += et131x/ obj-$(CONFIG_SLICOSS) += slicoss/ obj-$(CONFIG_VIDEO_GO7007) += go7007/ diff --git a/drivers/staging/generic_serial/Kconfig b/drivers/staging/generic_serial/Kconfig new file mode 100644 index 000000000000..795daea37750 --- /dev/null +++ b/drivers/staging/generic_serial/Kconfig @@ -0,0 +1,45 @@ +config A2232 + tristate "Commodore A2232 serial support (EXPERIMENTAL)" + depends on EXPERIMENTAL && ZORRO && BROKEN + ---help--- + This option supports the 2232 7-port serial card shipped with the + Amiga 2000 and other Zorro-bus machines, dating from 1989. At + a max of 19,200 bps, the ports are served by a 6551 ACIA UART chip + each, plus a 8520 CIA, and a master 6502 CPU and buffer as well. The + ports were connected with 8 pin DIN connectors on the card bracket, + for which 8 pin to DB25 adapters were supplied. The card also had + jumpers internally to toggle various pinning configurations. + + This driver can be built as a module; but then "generic_serial" + will also be built as a module. This has to be loaded before + "ser_a2232". If you want to do this, answer M here. + +config SX + tristate "Specialix SX (and SI) card support" + depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) && BROKEN + help + This is a driver for the SX and SI multiport serial cards. + Please read the file for details. + + This driver can only be built as a module ( = code which can be + inserted in and removed from the running kernel whenever you want). + The module will be called sx. If you want to do that, say M here. + +config RIO + tristate "Specialix RIO system support" + depends on SERIAL_NONSTANDARD && BROKEN + help + This is a driver for the Specialix RIO, a smart serial card which + drives an outboard box that can support up to 128 ports. Product + information is at . + There are both ISA and PCI versions. + +config RIO_OLDPCI + bool "Support really old RIO/PCI cards" + depends on RIO + help + Older RIO PCI cards need some initialization-time configuration to + determine the IRQ and some control addresses. If you have a RIO and + this doesn't seem to work, try setting this to Y. + + diff --git a/drivers/staging/generic_serial/Makefile b/drivers/staging/generic_serial/Makefile new file mode 100644 index 000000000000..ffc90c8b013c --- /dev/null +++ b/drivers/staging/generic_serial/Makefile @@ -0,0 +1,6 @@ +obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o +obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o +obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o +obj-$(CONFIG_A2232) += ser_a2232.o generic_serial.o +obj-$(CONFIG_SX) += sx.o generic_serial.o +obj-$(CONFIG_RIO) += rio/ generic_serial.o diff --git a/drivers/staging/generic_serial/TODO b/drivers/staging/generic_serial/TODO new file mode 100644 index 000000000000..88756453ac6c --- /dev/null +++ b/drivers/staging/generic_serial/TODO @@ -0,0 +1,6 @@ +These are a few tty/serial drivers that either do not build, +or work if they do build, or if they seem to work, are for obsolete +hardware, or are full of unfixable races and no one uses them anymore. + +If no one steps up to adopt any of these drivers, they will be removed +in the 2.6.41 release. diff --git a/drivers/char/generic_serial.c b/drivers/staging/generic_serial/generic_serial.c similarity index 100% rename from drivers/char/generic_serial.c rename to drivers/staging/generic_serial/generic_serial.c diff --git a/drivers/char/rio/Makefile b/drivers/staging/generic_serial/rio/Makefile similarity index 100% rename from drivers/char/rio/Makefile rename to drivers/staging/generic_serial/rio/Makefile diff --git a/drivers/char/rio/board.h b/drivers/staging/generic_serial/rio/board.h similarity index 100% rename from drivers/char/rio/board.h rename to drivers/staging/generic_serial/rio/board.h diff --git a/drivers/char/rio/cirrus.h b/drivers/staging/generic_serial/rio/cirrus.h similarity index 100% rename from drivers/char/rio/cirrus.h rename to drivers/staging/generic_serial/rio/cirrus.h diff --git a/drivers/char/rio/cmdblk.h b/drivers/staging/generic_serial/rio/cmdblk.h similarity index 100% rename from drivers/char/rio/cmdblk.h rename to drivers/staging/generic_serial/rio/cmdblk.h diff --git a/drivers/char/rio/cmdpkt.h b/drivers/staging/generic_serial/rio/cmdpkt.h similarity index 100% rename from drivers/char/rio/cmdpkt.h rename to drivers/staging/generic_serial/rio/cmdpkt.h diff --git a/drivers/char/rio/daemon.h b/drivers/staging/generic_serial/rio/daemon.h similarity index 100% rename from drivers/char/rio/daemon.h rename to drivers/staging/generic_serial/rio/daemon.h diff --git a/drivers/char/rio/errors.h b/drivers/staging/generic_serial/rio/errors.h similarity index 100% rename from drivers/char/rio/errors.h rename to drivers/staging/generic_serial/rio/errors.h diff --git a/drivers/char/rio/func.h b/drivers/staging/generic_serial/rio/func.h similarity index 100% rename from drivers/char/rio/func.h rename to drivers/staging/generic_serial/rio/func.h diff --git a/drivers/char/rio/host.h b/drivers/staging/generic_serial/rio/host.h similarity index 100% rename from drivers/char/rio/host.h rename to drivers/staging/generic_serial/rio/host.h diff --git a/drivers/char/rio/link.h b/drivers/staging/generic_serial/rio/link.h similarity index 100% rename from drivers/char/rio/link.h rename to drivers/staging/generic_serial/rio/link.h diff --git a/drivers/char/rio/linux_compat.h b/drivers/staging/generic_serial/rio/linux_compat.h similarity index 100% rename from drivers/char/rio/linux_compat.h rename to drivers/staging/generic_serial/rio/linux_compat.h diff --git a/drivers/char/rio/map.h b/drivers/staging/generic_serial/rio/map.h similarity index 100% rename from drivers/char/rio/map.h rename to drivers/staging/generic_serial/rio/map.h diff --git a/drivers/char/rio/param.h b/drivers/staging/generic_serial/rio/param.h similarity index 100% rename from drivers/char/rio/param.h rename to drivers/staging/generic_serial/rio/param.h diff --git a/drivers/char/rio/parmmap.h b/drivers/staging/generic_serial/rio/parmmap.h similarity index 100% rename from drivers/char/rio/parmmap.h rename to drivers/staging/generic_serial/rio/parmmap.h diff --git a/drivers/char/rio/pci.h b/drivers/staging/generic_serial/rio/pci.h similarity index 100% rename from drivers/char/rio/pci.h rename to drivers/staging/generic_serial/rio/pci.h diff --git a/drivers/char/rio/phb.h b/drivers/staging/generic_serial/rio/phb.h similarity index 100% rename from drivers/char/rio/phb.h rename to drivers/staging/generic_serial/rio/phb.h diff --git a/drivers/char/rio/pkt.h b/drivers/staging/generic_serial/rio/pkt.h similarity index 100% rename from drivers/char/rio/pkt.h rename to drivers/staging/generic_serial/rio/pkt.h diff --git a/drivers/char/rio/port.h b/drivers/staging/generic_serial/rio/port.h similarity index 100% rename from drivers/char/rio/port.h rename to drivers/staging/generic_serial/rio/port.h diff --git a/drivers/char/rio/protsts.h b/drivers/staging/generic_serial/rio/protsts.h similarity index 100% rename from drivers/char/rio/protsts.h rename to drivers/staging/generic_serial/rio/protsts.h diff --git a/drivers/char/rio/rio.h b/drivers/staging/generic_serial/rio/rio.h similarity index 100% rename from drivers/char/rio/rio.h rename to drivers/staging/generic_serial/rio/rio.h diff --git a/drivers/char/rio/rio_linux.c b/drivers/staging/generic_serial/rio/rio_linux.c similarity index 100% rename from drivers/char/rio/rio_linux.c rename to drivers/staging/generic_serial/rio/rio_linux.c diff --git a/drivers/char/rio/rio_linux.h b/drivers/staging/generic_serial/rio/rio_linux.h similarity index 100% rename from drivers/char/rio/rio_linux.h rename to drivers/staging/generic_serial/rio/rio_linux.h diff --git a/drivers/char/rio/rioboard.h b/drivers/staging/generic_serial/rio/rioboard.h similarity index 100% rename from drivers/char/rio/rioboard.h rename to drivers/staging/generic_serial/rio/rioboard.h diff --git a/drivers/char/rio/rioboot.c b/drivers/staging/generic_serial/rio/rioboot.c similarity index 100% rename from drivers/char/rio/rioboot.c rename to drivers/staging/generic_serial/rio/rioboot.c diff --git a/drivers/char/rio/riocmd.c b/drivers/staging/generic_serial/rio/riocmd.c similarity index 100% rename from drivers/char/rio/riocmd.c rename to drivers/staging/generic_serial/rio/riocmd.c diff --git a/drivers/char/rio/rioctrl.c b/drivers/staging/generic_serial/rio/rioctrl.c similarity index 100% rename from drivers/char/rio/rioctrl.c rename to drivers/staging/generic_serial/rio/rioctrl.c diff --git a/drivers/char/rio/riodrvr.h b/drivers/staging/generic_serial/rio/riodrvr.h similarity index 100% rename from drivers/char/rio/riodrvr.h rename to drivers/staging/generic_serial/rio/riodrvr.h diff --git a/drivers/char/rio/rioinfo.h b/drivers/staging/generic_serial/rio/rioinfo.h similarity index 100% rename from drivers/char/rio/rioinfo.h rename to drivers/staging/generic_serial/rio/rioinfo.h diff --git a/drivers/char/rio/rioinit.c b/drivers/staging/generic_serial/rio/rioinit.c similarity index 100% rename from drivers/char/rio/rioinit.c rename to drivers/staging/generic_serial/rio/rioinit.c diff --git a/drivers/char/rio/riointr.c b/drivers/staging/generic_serial/rio/riointr.c similarity index 100% rename from drivers/char/rio/riointr.c rename to drivers/staging/generic_serial/rio/riointr.c diff --git a/drivers/char/rio/rioioctl.h b/drivers/staging/generic_serial/rio/rioioctl.h similarity index 100% rename from drivers/char/rio/rioioctl.h rename to drivers/staging/generic_serial/rio/rioioctl.h diff --git a/drivers/char/rio/rioparam.c b/drivers/staging/generic_serial/rio/rioparam.c similarity index 100% rename from drivers/char/rio/rioparam.c rename to drivers/staging/generic_serial/rio/rioparam.c diff --git a/drivers/char/rio/rioroute.c b/drivers/staging/generic_serial/rio/rioroute.c similarity index 100% rename from drivers/char/rio/rioroute.c rename to drivers/staging/generic_serial/rio/rioroute.c diff --git a/drivers/char/rio/riospace.h b/drivers/staging/generic_serial/rio/riospace.h similarity index 100% rename from drivers/char/rio/riospace.h rename to drivers/staging/generic_serial/rio/riospace.h diff --git a/drivers/char/rio/riotable.c b/drivers/staging/generic_serial/rio/riotable.c similarity index 100% rename from drivers/char/rio/riotable.c rename to drivers/staging/generic_serial/rio/riotable.c diff --git a/drivers/char/rio/riotty.c b/drivers/staging/generic_serial/rio/riotty.c similarity index 100% rename from drivers/char/rio/riotty.c rename to drivers/staging/generic_serial/rio/riotty.c diff --git a/drivers/char/rio/route.h b/drivers/staging/generic_serial/rio/route.h similarity index 100% rename from drivers/char/rio/route.h rename to drivers/staging/generic_serial/rio/route.h diff --git a/drivers/char/rio/rup.h b/drivers/staging/generic_serial/rio/rup.h similarity index 100% rename from drivers/char/rio/rup.h rename to drivers/staging/generic_serial/rio/rup.h diff --git a/drivers/char/rio/unixrup.h b/drivers/staging/generic_serial/rio/unixrup.h similarity index 100% rename from drivers/char/rio/unixrup.h rename to drivers/staging/generic_serial/rio/unixrup.h diff --git a/drivers/char/ser_a2232.c b/drivers/staging/generic_serial/ser_a2232.c similarity index 100% rename from drivers/char/ser_a2232.c rename to drivers/staging/generic_serial/ser_a2232.c diff --git a/drivers/char/ser_a2232.h b/drivers/staging/generic_serial/ser_a2232.h similarity index 100% rename from drivers/char/ser_a2232.h rename to drivers/staging/generic_serial/ser_a2232.h diff --git a/drivers/char/ser_a2232fw.ax b/drivers/staging/generic_serial/ser_a2232fw.ax similarity index 100% rename from drivers/char/ser_a2232fw.ax rename to drivers/staging/generic_serial/ser_a2232fw.ax diff --git a/drivers/char/ser_a2232fw.h b/drivers/staging/generic_serial/ser_a2232fw.h similarity index 100% rename from drivers/char/ser_a2232fw.h rename to drivers/staging/generic_serial/ser_a2232fw.h diff --git a/drivers/char/sx.c b/drivers/staging/generic_serial/sx.c similarity index 100% rename from drivers/char/sx.c rename to drivers/staging/generic_serial/sx.c diff --git a/drivers/char/sx.h b/drivers/staging/generic_serial/sx.h similarity index 100% rename from drivers/char/sx.h rename to drivers/staging/generic_serial/sx.h diff --git a/drivers/char/sxboards.h b/drivers/staging/generic_serial/sxboards.h similarity index 100% rename from drivers/char/sxboards.h rename to drivers/staging/generic_serial/sxboards.h diff --git a/drivers/char/sxwindow.h b/drivers/staging/generic_serial/sxwindow.h similarity index 100% rename from drivers/char/sxwindow.h rename to drivers/staging/generic_serial/sxwindow.h diff --git a/drivers/char/vme_scc.c b/drivers/staging/generic_serial/vme_scc.c similarity index 100% rename from drivers/char/vme_scc.c rename to drivers/staging/generic_serial/vme_scc.c From da3564ee027e788a5ff8e520fb2d2b00a78b2464 Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Wed, 23 Feb 2011 10:03:12 +0900 Subject: [PATCH 54/76] pch_uart: add multi-scatter processing Currently, this driver can handle only single scatterlist. Thus, it can't send data beyond FIFO size. This patch enables this driver can handle multiple scatter list. Signed-off-by: Tomoya MORINAGA Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 115 ++++++++++++++++++++++++++-------- 1 file changed, 88 insertions(+), 27 deletions(-) diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 3b2fb93e1fa1..c1386eb255d3 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -226,7 +226,8 @@ struct eg20t_port { struct pch_dma_slave param_rx; struct dma_chan *chan_tx; struct dma_chan *chan_rx; - struct scatterlist sg_tx; + struct scatterlist *sg_tx_p; + int nent; struct scatterlist sg_rx; int tx_dma_use; void *rx_buf_virt; @@ -595,16 +596,20 @@ static void pch_dma_rx_complete(void *arg) struct eg20t_port *priv = arg; struct uart_port *port = &priv->port; struct tty_struct *tty = tty_port_tty_get(&port->state->port); + int count; if (!tty) { pr_debug("%s:tty is busy now", __func__); return; } - if (dma_push_rx(priv, priv->trigger_level)) + dma_sync_sg_for_cpu(port->dev, &priv->sg_rx, 1, DMA_FROM_DEVICE); + count = dma_push_rx(priv, priv->trigger_level); + if (count) tty_flip_buffer_push(tty); - tty_kref_put(tty); + async_tx_ack(priv->desc_rx); + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_RX_INT); } static void pch_dma_tx_complete(void *arg) @@ -612,13 +617,21 @@ static void pch_dma_tx_complete(void *arg) struct eg20t_port *priv = arg; struct uart_port *port = &priv->port; struct circ_buf *xmit = &port->state->xmit; + struct scatterlist *sg = priv->sg_tx_p; + int i; - xmit->tail += sg_dma_len(&priv->sg_tx); + for (i = 0; i < priv->nent; i++, sg++) { + xmit->tail += sg_dma_len(sg); + port->icount.tx += sg_dma_len(sg); + } xmit->tail &= UART_XMIT_SIZE - 1; - port->icount.tx += sg_dma_len(&priv->sg_tx); - async_tx_ack(priv->desc_tx); + dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE); priv->tx_dma_use = 0; + priv->nent = 0; + kfree(priv->sg_tx_p); + if (uart_circ_chars_pending(xmit)) + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); } static int pop_tx(struct eg20t_port *priv, unsigned char *buf, int size) @@ -682,7 +695,7 @@ static int dma_handle_rx(struct eg20t_port *priv) sg_init_table(&priv->sg_rx, 1); /* Initialize SG table */ - sg_dma_len(sg) = priv->fifo_size; + sg_dma_len(sg) = priv->trigger_level; sg_set_page(&priv->sg_rx, virt_to_page(priv->rx_buf_virt), sg_dma_len(sg), (unsigned long)priv->rx_buf_virt & @@ -692,7 +705,8 @@ static int dma_handle_rx(struct eg20t_port *priv) desc = priv->chan_rx->device->device_prep_slave_sg(priv->chan_rx, sg, 1, DMA_FROM_DEVICE, - DMA_PREP_INTERRUPT); + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + if (!desc) return 0; @@ -731,6 +745,9 @@ static unsigned int handle_tx(struct eg20t_port *priv) fifo_size--; } size = min(xmit->head - xmit->tail, fifo_size); + if (size < 0) + size = fifo_size; + tx_size = pop_tx(priv, xmit->buf, size); if (tx_size > 0) { ret = pch_uart_hal_write(priv, xmit->buf, tx_size); @@ -740,8 +757,10 @@ static unsigned int handle_tx(struct eg20t_port *priv) priv->tx_empty = tx_empty; - if (tx_empty) + if (tx_empty) { pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); + uart_write_wakeup(port); + } return PCH_UART_HANDLED_TX_INT; } @@ -750,11 +769,16 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) { struct uart_port *port = &priv->port; struct circ_buf *xmit = &port->state->xmit; - struct scatterlist *sg = &priv->sg_tx; + struct scatterlist *sg; int nent; int fifo_size; int tx_empty; struct dma_async_tx_descriptor *desc; + int num; + int i; + int bytes; + int size; + int rem; if (!priv->start_tx) { pr_info("%s:Tx isn't started. (%lu)\n", __func__, jiffies); @@ -772,37 +796,68 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) fifo_size--; } - pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); + bytes = min((int)CIRC_CNT(xmit->head, xmit->tail, + UART_XMIT_SIZE), CIRC_CNT_TO_END(xmit->head, + xmit->tail, UART_XMIT_SIZE)); + if (!bytes) { + pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); + uart_write_wakeup(port); + return 0; + } + + if (bytes > fifo_size) { + num = bytes / fifo_size + 1; + size = fifo_size; + rem = bytes % fifo_size; + } else { + num = 1; + size = bytes; + rem = bytes; + } priv->tx_dma_use = 1; - sg_init_table(&priv->sg_tx, 1); /* Initialize SG table */ + priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC); - sg_set_page(&priv->sg_tx, virt_to_page(xmit->buf), - UART_XMIT_SIZE, (int)xmit->buf & ~PAGE_MASK); + sg_init_table(priv->sg_tx_p, num); /* Initialize SG table */ + sg = priv->sg_tx_p; - nent = dma_map_sg(port->dev, &priv->sg_tx, 1, DMA_TO_DEVICE); + for (i = 0; i < num; i++, sg++) { + if (i == (num - 1)) + sg_set_page(sg, virt_to_page(xmit->buf), + rem, fifo_size * i); + else + sg_set_page(sg, virt_to_page(xmit->buf), + size, fifo_size * i); + } + + sg = priv->sg_tx_p; + nent = dma_map_sg(port->dev, sg, num, DMA_TO_DEVICE); if (!nent) { pr_err("%s:dma_map_sg Failed\n", __func__); return 0; } + priv->nent = nent; - sg->offset = xmit->tail & (UART_XMIT_SIZE - 1); - sg_dma_address(sg) = (sg_dma_address(sg) & ~(UART_XMIT_SIZE - 1)) + - sg->offset; - sg_dma_len(sg) = min((int)CIRC_CNT(xmit->head, xmit->tail, - UART_XMIT_SIZE), CIRC_CNT_TO_END(xmit->head, - xmit->tail, UART_XMIT_SIZE)); + for (i = 0; i < nent; i++, sg++) { + sg->offset = (xmit->tail & (UART_XMIT_SIZE - 1)) + + fifo_size * i; + sg_dma_address(sg) = (sg_dma_address(sg) & + ~(UART_XMIT_SIZE - 1)) + sg->offset; + if (i == (nent - 1)) + sg_dma_len(sg) = rem; + else + sg_dma_len(sg) = size; + } desc = priv->chan_tx->device->device_prep_slave_sg(priv->chan_tx, - sg, nent, DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + priv->sg_tx_p, nent, DMA_TO_DEVICE, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); if (!desc) { pr_err("%s:device_prep_slave_sg Failed\n", __func__); return 0; } - - dma_sync_sg_for_device(port->dev, sg, 1, DMA_TO_DEVICE); - + dma_sync_sg_for_device(port->dev, priv->sg_tx_p, nent, DMA_TO_DEVICE); priv->desc_tx = desc; desc->callback = pch_dma_tx_complete; desc->callback_param = priv; @@ -857,10 +912,16 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id) } break; case PCH_UART_IID_RDR: /* Received Data Ready */ - if (priv->use_dma) + if (priv->use_dma) { + pch_uart_hal_disable_interrupt(priv, + PCH_UART_HAL_RX_INT); ret = dma_handle_rx(priv); - else + if (!ret) + pch_uart_hal_enable_interrupt(priv, + PCH_UART_HAL_RX_INT); + } else { ret = handle_rx(priv); + } break; case PCH_UART_IID_RDR_TO: /* Received Data Ready (FIFO Timeout) */ From 7e4613296576c843643ceb97091d98da1e8caab8 Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Wed, 23 Feb 2011 10:03:13 +0900 Subject: [PATCH 55/76] pch_uart: add spin_lock_init Currently, spin_lock is not initialized. Thus, add spin_lock_init(). Signed-off-by: Tomoya MORINAGA Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index c1386eb255d3..9e1b8652de7f 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -1370,6 +1370,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, priv->port.line = num++; priv->trigger = PCH_UART_HAL_TRIGGER_M; + spin_lock_init(&priv->port.lock); + pci_set_drvdata(pdev, priv); pch_uart_hal_request(pdev, fifosize, base_baud); From 1822076cf324dde1eb9678ae2174dc8b4662417c Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Wed, 23 Feb 2011 10:03:14 +0900 Subject: [PATCH 56/76] pch_uart : Reduce memcpy Reduce memcpy for performance improvement. Signed-off-by: Tomoya MORINAGA Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 9e1b8652de7f..0e171b8f0700 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -390,7 +390,7 @@ static u8 pch_uart_hal_get_modem(struct eg20t_port *priv) return get_msr(priv, priv->membase); } -static int pch_uart_hal_write(struct eg20t_port *priv, +static void pch_uart_hal_write(struct eg20t_port *priv, const unsigned char *buf, int tx_size) { int i; @@ -400,7 +400,6 @@ static int pch_uart_hal_write(struct eg20t_port *priv, thr = buf[i++]; iowrite8(thr, priv->membase + PCH_UART_THR); } - return i; } static int pch_uart_hal_read(struct eg20t_port *priv, unsigned char *buf, @@ -634,7 +633,7 @@ static void pch_dma_tx_complete(void *arg) pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); } -static int pop_tx(struct eg20t_port *priv, unsigned char *buf, int size) +static int pop_tx(struct eg20t_port *priv, int size) { int count = 0; struct uart_port *port = &priv->port; @@ -647,7 +646,7 @@ static int pop_tx(struct eg20t_port *priv, unsigned char *buf, int size) int cnt_to_end = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); int sz = min(size - count, cnt_to_end); - memcpy(&buf[count], &xmit->buf[xmit->tail], sz); + pch_uart_hal_write(priv, &xmit->buf[xmit->tail], sz); xmit->tail = (xmit->tail + sz) & (UART_XMIT_SIZE - 1); count += sz; } while (!uart_circ_empty(xmit) && count < size); @@ -723,7 +722,6 @@ static unsigned int handle_tx(struct eg20t_port *priv) { struct uart_port *port = &priv->port; struct circ_buf *xmit = &port->state->xmit; - int ret; int fifo_size; int tx_size; int size; @@ -748,10 +746,9 @@ static unsigned int handle_tx(struct eg20t_port *priv) if (size < 0) size = fifo_size; - tx_size = pop_tx(priv, xmit->buf, size); + tx_size = pop_tx(priv, size); if (tx_size > 0) { - ret = pch_uart_hal_write(priv, xmit->buf, tx_size); - port->icount.tx += ret; + port->icount.tx += tx_size; tx_empty = 0; } From 23877fdc6df3306037d81d2ac71c2d6e26ec08f4 Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Wed, 23 Feb 2011 10:03:15 +0900 Subject: [PATCH 57/76] pch_uart : Use dev_xxx not pr_xxx For easy to understad which port the message is out, replace pr_xxx with dev_xxx. Signed-off-by: Tomoya MORINAGA Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 77 ++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 28 deletions(-) diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 0e171b8f0700..68855351c76e 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -282,7 +282,7 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud, div = DIV_ROUND(priv->base_baud / 16, baud); if (div < 0 || USHRT_MAX <= div) { - pr_err("Invalid Baud(div=0x%x)\n", div); + dev_err(priv->port.dev, "Invalid Baud(div=0x%x)\n", div); return -EINVAL; } @@ -290,17 +290,17 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud, dlm = ((unsigned int)div >> 8) & 0x00FFU; if (parity & ~(PCH_UART_LCR_PEN | PCH_UART_LCR_EPS | PCH_UART_LCR_SP)) { - pr_err("Invalid parity(0x%x)\n", parity); + dev_err(priv->port.dev, "Invalid parity(0x%x)\n", parity); return -EINVAL; } if (bits & ~PCH_UART_LCR_WLS) { - pr_err("Invalid bits(0x%x)\n", bits); + dev_err(priv->port.dev, "Invalid bits(0x%x)\n", bits); return -EINVAL; } if (stb & ~PCH_UART_LCR_STB) { - pr_err("Invalid STB(0x%x)\n", stb); + dev_err(priv->port.dev, "Invalid STB(0x%x)\n", stb); return -EINVAL; } @@ -308,7 +308,7 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud, lcr |= bits; lcr |= stb; - pr_debug("%s:baud = %d, div = %04x, lcr = %02x (%lu)\n", + dev_dbg(priv->port.dev, "%s:baud = %d, div = %04x, lcr = %02x (%lu)\n", __func__, baud, div, lcr, jiffies); iowrite8(PCH_UART_LCR_DLAB, priv->membase + UART_LCR); iowrite8(dll, priv->membase + PCH_UART_DLL); @@ -322,7 +322,8 @@ static int pch_uart_hal_fifo_reset(struct eg20t_port *priv, unsigned int flag) { if (flag & ~(PCH_UART_FCR_TFR | PCH_UART_FCR_RFR)) { - pr_err("%s:Invalid flag(0x%x)\n", __func__, flag); + dev_err(priv->port.dev, "%s:Invalid flag(0x%x)\n", + __func__, flag); return -EINVAL; } @@ -341,17 +342,20 @@ static int pch_uart_hal_set_fifo(struct eg20t_port *priv, u8 fcr; if (dmamode & ~PCH_UART_FCR_DMS) { - pr_err("%s:Invalid DMA Mode(0x%x)\n", __func__, dmamode); + dev_err(priv->port.dev, "%s:Invalid DMA Mode(0x%x)\n", + __func__, dmamode); return -EINVAL; } if (fifo_size & ~(PCH_UART_FCR_FIFOE | PCH_UART_FCR_FIFO256)) { - pr_err("%s:Invalid FIFO SIZE(0x%x)\n", __func__, fifo_size); + dev_err(priv->port.dev, "%s:Invalid FIFO SIZE(0x%x)\n", + __func__, fifo_size); return -EINVAL; } if (trigger & ~PCH_UART_FCR_RFTL) { - pr_err("%s:Invalid TRIGGER(0x%x)\n", __func__, trigger); + dev_err(priv->port.dev, "%s:Invalid TRIGGER(0x%x)\n", + __func__, trigger); return -EINVAL; } @@ -455,7 +459,7 @@ static int push_rx(struct eg20t_port *priv, const unsigned char *buf, port = &priv->port; tty = tty_port_tty_get(&port->state->port); if (!tty) { - pr_debug("%s:tty is busy now", __func__); + dev_dbg(priv->port.dev, "%s:tty is busy now", __func__); return -EBUSY; } @@ -472,8 +476,8 @@ static int pop_tx_x(struct eg20t_port *priv, unsigned char *buf) struct uart_port *port = &priv->port; if (port->x_char) { - pr_debug("%s:X character send %02x (%lu)\n", __func__, - port->x_char, jiffies); + dev_dbg(priv->port.dev, "%s:X character send %02x (%lu)\n", + __func__, port->x_char, jiffies); buf[0] = port->x_char; port->x_char = 0; ret = 1; @@ -493,7 +497,7 @@ static int dma_push_rx(struct eg20t_port *priv, int size) port = &priv->port; tty = tty_port_tty_get(&port->state->port); if (!tty) { - pr_debug("%s:tty is busy now", __func__); + dev_dbg(priv->port.dev, "%s:tty is busy now", __func__); return 0; } @@ -567,7 +571,8 @@ static void pch_request_dma(struct uart_port *port) param->tx_reg = port->mapbase + UART_TX; chan = dma_request_channel(mask, filter, param); if (!chan) { - pr_err("%s:dma_request_channel FAILS(Tx)\n", __func__); + dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Tx)\n", + __func__); return; } priv->chan_tx = chan; @@ -579,7 +584,8 @@ static void pch_request_dma(struct uart_port *port) param->rx_reg = port->mapbase + UART_RX; chan = dma_request_channel(mask, filter, param); if (!chan) { - pr_err("%s:dma_request_channel FAILS(Rx)\n", __func__); + dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Rx)\n", + __func__); dma_release_channel(priv->chan_tx); return; } @@ -598,7 +604,7 @@ static void pch_dma_rx_complete(void *arg) int count; if (!tty) { - pr_debug("%s:tty is busy now", __func__); + dev_dbg(priv->port.dev, "%s:tty is busy now", __func__); return; } @@ -652,7 +658,7 @@ static int pop_tx(struct eg20t_port *priv, int size) } while (!uart_circ_empty(xmit) && count < size); pop_tx_end: - pr_debug("%d characters. Remained %d characters. (%lu)\n", + dev_dbg(priv->port.dev, "%d characters. Remained %d characters.(%lu)\n", count, size - count, jiffies); return count; @@ -728,7 +734,8 @@ static unsigned int handle_tx(struct eg20t_port *priv) int tx_empty; if (!priv->start_tx) { - pr_info("%s:Tx isn't started. (%lu)\n", __func__, jiffies); + dev_info(priv->port.dev, "%s:Tx isn't started. (%lu)\n", + __func__, jiffies); pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); priv->tx_empty = 1; return 0; @@ -778,7 +785,8 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) int rem; if (!priv->start_tx) { - pr_info("%s:Tx isn't started. (%lu)\n", __func__, jiffies); + dev_info(priv->port.dev, "%s:Tx isn't started. (%lu)\n", + __func__, jiffies); pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); priv->tx_empty = 1; return 0; @@ -797,6 +805,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) UART_XMIT_SIZE), CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE)); if (!bytes) { + dev_dbg(priv->port.dev, "%s 0 bytes return\n", __func__); pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); uart_write_wakeup(port); return 0; @@ -812,6 +821,9 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) rem = bytes; } + dev_dbg(priv->port.dev, "%s num=%d size=%d rem=%d\n", + __func__, num, size, rem); + priv->tx_dma_use = 1; priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC); @@ -831,7 +843,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) sg = priv->sg_tx_p; nent = dma_map_sg(port->dev, sg, num, DMA_TO_DEVICE); if (!nent) { - pr_err("%s:dma_map_sg Failed\n", __func__); + dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__); return 0; } priv->nent = nent; @@ -851,7 +863,8 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) priv->sg_tx_p, nent, DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); if (!desc) { - pr_err("%s:device_prep_slave_sg Failed\n", __func__); + dev_err(priv->port.dev, "%s:device_prep_slave_sg Failed\n", + __func__); return 0; } dma_sync_sg_for_device(port->dev, priv->sg_tx_p, nent, DMA_TO_DEVICE); @@ -935,7 +948,8 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id) ret = PCH_UART_HANDLED_MS_INT; break; default: /* Never junp to this label */ - pr_err("%s:iid=%d (%lu)\n", __func__, iid, jiffies); + dev_err(priv->port.dev, "%s:iid=%d (%lu)\n", __func__, + iid, jiffies); ret = -1; break; } @@ -1024,9 +1038,13 @@ static void pch_uart_start_tx(struct uart_port *port) priv = container_of(port, struct eg20t_port, port); - if (priv->use_dma) - if (priv->tx_dma_use) + if (priv->use_dma) { + if (priv->tx_dma_use) { + dev_dbg(priv->port.dev, "%s : Tx DMA is NOT empty.\n", + __func__); return; + } + } priv->start_tx = 1; pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); @@ -1142,7 +1160,8 @@ static void pch_uart_shutdown(struct uart_port *port) ret = pch_uart_hal_set_fifo(priv, PCH_UART_HAL_DMA_MODE0, PCH_UART_HAL_FIFO_DIS, PCH_UART_HAL_TRIGGER1); if (ret) - pr_err("pch_uart_hal_set_fifo Failed(ret=%d)\n", ret); + dev_err(priv->port.dev, + "pch_uart_hal_set_fifo Failed(ret=%d)\n", ret); if (priv->use_dma_flag) pch_free_dma(port); @@ -1263,17 +1282,19 @@ static int pch_uart_verify_port(struct uart_port *port, priv = container_of(port, struct eg20t_port, port); if (serinfo->flags & UPF_LOW_LATENCY) { - pr_info("PCH UART : Use PIO Mode (without DMA)\n"); + dev_info(priv->port.dev, + "PCH UART : Use PIO Mode (without DMA)\n"); priv->use_dma = 0; serinfo->flags &= ~UPF_LOW_LATENCY; } else { #ifndef CONFIG_PCH_DMA - pr_err("%s : PCH DMA is not Loaded.\n", __func__); + dev_err(priv->port.dev, "%s : PCH DMA is not Loaded.\n", + __func__); return -EOPNOTSUPP; #endif priv->use_dma = 1; priv->use_dma_flag = 1; - pr_info("PCH UART : Use DMA Mode\n"); + dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); } return 0; From aac6c0b0fd6458f166651fc102695fb8836a4d95 Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Wed, 23 Feb 2011 10:03:16 +0900 Subject: [PATCH 58/76] pch_uart: fix uart clock setting issue Currently, uart clock is not set correctly. This patch fixes the issue. Signed-off-by: Tomoya MORINAGA Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 68855351c76e..189886122516 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -1089,7 +1089,12 @@ static int pch_uart_startup(struct uart_port *port) priv = container_of(port, struct eg20t_port, port); priv->tx_empty = 1; - port->uartclk = priv->base_baud; + + if (port->uartclk) + priv->base_baud = port->uartclk; + else + port->uartclk = priv->base_baud; + pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_ALL_INT); ret = pch_uart_hal_set_line(priv, default_baud, PCH_UART_HAL_PARITY_NONE, PCH_UART_HAL_8BIT, From 9af7155bb03675ba2d4d68428a4345e0511ce8dd Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Wed, 23 Feb 2011 10:03:17 +0900 Subject: [PATCH 59/76] pch_uart: fix auto flow control miss-setting issue Currently, auto-flow control setting processing is not set correctly. This patch fixes the issue. Signed-off-by: Tomoya MORINAGA Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 189886122516..0c95051fa0a4 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -218,6 +218,7 @@ struct eg20t_port { struct pch_uart_buffer rxbuf; unsigned int dmsr; unsigned int fcr; + unsigned int mcr; unsigned int use_dma; unsigned int use_dma_flag; struct dma_async_tx_descriptor *desc_tx; @@ -1007,7 +1008,6 @@ static unsigned int pch_uart_get_mctrl(struct uart_port *port) static void pch_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) { u32 mcr = 0; - unsigned int dat; struct eg20t_port *priv = container_of(port, struct eg20t_port, port); if (mctrl & TIOCM_DTR) @@ -1017,11 +1017,11 @@ static void pch_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) if (mctrl & TIOCM_LOOP) mcr |= UART_MCR_LOOP; - if (mctrl) { - dat = pch_uart_get_mctrl(port); - dat |= mcr; - iowrite8(dat, priv->membase + UART_MCR); - } + if (priv->mcr & UART_MCR_AFE) + mcr |= UART_MCR_AFE; + + if (mctrl) + iowrite8(mcr, priv->membase + UART_MCR); } static void pch_uart_stop_tx(struct uart_port *port) @@ -1215,6 +1215,13 @@ static void pch_uart_set_termios(struct uart_port *port, } else { parity = PCH_UART_HAL_PARITY_NONE; } + + /* Only UART0 has auto hardware flow function */ + if ((termios->c_cflag & CRTSCTS) && (priv->fifo_size == 256)) + priv->mcr |= UART_MCR_AFE; + else + priv->mcr &= ~UART_MCR_AFE; + termios->c_cflag &= ~CMSPAR; /* Mark/Space parity is not supported */ baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16); From 60d1031e114a3e96e4420421e34ddc0dcd10cbae Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Wed, 23 Feb 2011 10:03:18 +0900 Subject: [PATCH 60/76] pch_uart: fix exclusive access issue Signed-off-by: Tomoya MORINAGA Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 0c95051fa0a4..da0ba0fa2b99 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -636,8 +636,7 @@ static void pch_dma_tx_complete(void *arg) priv->tx_dma_use = 0; priv->nent = 0; kfree(priv->sg_tx_p); - if (uart_circ_chars_pending(xmit)) - pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); } static int pop_tx(struct eg20t_port *priv, int size) @@ -793,6 +792,14 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) return 0; } + if (priv->tx_dma_use) { + dev_dbg(priv->port.dev, "%s:Tx is not completed. (%lu)\n", + __func__, jiffies); + pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); + priv->tx_empty = 1; + return 0; + } + fifo_size = max(priv->fifo_size, 1); tx_empty = 1; if (pop_tx_x(priv, xmit->buf)) { From fec38d1752c01ad72789bac9f1a128f7e933735d Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Wed, 23 Feb 2011 10:03:19 +0900 Subject: [PATCH 61/76] pch_uart: Fix DMA channel miss-setting issue. Signed-off-by: Tomoya MORINAGA Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 59 ++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index da0ba0fa2b99..a5ce9a5c018d 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -235,6 +235,36 @@ struct eg20t_port { dma_addr_t rx_buf_dma; }; +/** + * struct pch_uart_driver_data - private data structure for UART-DMA + * @port_type: The number of DMA channel + * @line_no: UART port line number (0, 1, 2...) + */ +struct pch_uart_driver_data { + int port_type; + int line_no; +}; + +enum pch_uart_num_t { + pch_et20t_uart0 = 0, + pch_et20t_uart1, + pch_et20t_uart2, + pch_et20t_uart3, + pch_ml7213_uart0, + pch_ml7213_uart1, + pch_ml7213_uart2, +}; + +static struct pch_uart_driver_data drv_dat[] = { + [pch_et20t_uart0] = {PCH_UART_8LINE, 0}, + [pch_et20t_uart1] = {PCH_UART_2LINE, 1}, + [pch_et20t_uart2] = {PCH_UART_2LINE, 2}, + [pch_et20t_uart3] = {PCH_UART_2LINE, 3}, + [pch_ml7213_uart0] = {PCH_UART_8LINE, 0}, + [pch_ml7213_uart1] = {PCH_UART_2LINE, 1}, + [pch_ml7213_uart2] = {PCH_UART_2LINE, 2}, +}; + static unsigned int default_baud = 9600; static const int trigger_level_256[4] = { 1, 64, 128, 224 }; static const int trigger_level_64[4] = { 1, 16, 32, 56 }; @@ -568,7 +598,8 @@ static void pch_request_dma(struct uart_port *port) /* Set Tx DMA */ param = &priv->param_tx; param->dma_dev = &dma_dev->dev; - param->chan_id = priv->port.line; + param->chan_id = priv->port.line * 2; /* Tx = 0, 2, 4, ... */ + param->tx_reg = port->mapbase + UART_TX; chan = dma_request_channel(mask, filter, param); if (!chan) { @@ -581,7 +612,8 @@ static void pch_request_dma(struct uart_port *port) /* Set Rx DMA */ param = &priv->param_rx; param->dma_dev = &dma_dev->dev; - param->chan_id = priv->port.line + 1; /* Rx = Tx + 1 */ + param->chan_id = priv->port.line * 2 + 1; /* Rx = Tx + 1 */ + param->rx_reg = port->mapbase + UART_RX; chan = dma_request_channel(mask, filter, param); if (!chan) { @@ -1358,8 +1390,11 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, unsigned int mapbase; unsigned char *rxbuf; int fifosize, base_baud; - static int num; - int port_type = id->driver_data; + int port_type; + struct pch_uart_driver_data *board; + + board = &drv_dat[id->driver_data]; + port_type = board->port_type; priv = kzalloc(sizeof(struct eg20t_port), GFP_KERNEL); if (priv == NULL) @@ -1404,7 +1439,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, priv->port.ops = &pch_uart_ops; priv->port.flags = UPF_BOOT_AUTOCONF; priv->port.fifosize = fifosize; - priv->port.line = num++; + priv->port.line = board->line_no; priv->trigger = PCH_UART_HAL_TRIGGER_M; spin_lock_init(&priv->port.lock); @@ -1482,19 +1517,19 @@ static int pch_uart_pci_resume(struct pci_dev *pdev) static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = { {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8811), - .driver_data = PCH_UART_8LINE}, + .driver_data = pch_et20t_uart0}, {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8812), - .driver_data = PCH_UART_2LINE}, + .driver_data = pch_et20t_uart1}, {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8813), - .driver_data = PCH_UART_2LINE}, + .driver_data = pch_et20t_uart2}, {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8814), - .driver_data = PCH_UART_2LINE}, + .driver_data = pch_et20t_uart3}, {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8027), - .driver_data = PCH_UART_8LINE}, + .driver_data = pch_ml7213_uart0}, {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8028), - .driver_data = PCH_UART_2LINE}, + .driver_data = pch_ml7213_uart1}, {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8029), - .driver_data = PCH_UART_2LINE}, + .driver_data = pch_ml7213_uart2}, {0,}, }; From 310388beea4d00bb1c56e81ded82bdc25bdcf719 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 25 Feb 2011 09:53:41 -0800 Subject: [PATCH 62/76] tty: forgot to remove ipwireless from drivers/char/pcmcia/Makefile This caused a build error. Many thanks to Stephen Rothwell for pointing this mistake out. Reported-by: Stephen Rothwell Signed-off-by: Greg Kroah-Hartman --- drivers/char/pcmcia/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/char/pcmcia/Makefile b/drivers/char/pcmcia/Makefile index be8f287aa398..0aae20985d57 100644 --- a/drivers/char/pcmcia/Makefile +++ b/drivers/char/pcmcia/Makefile @@ -4,8 +4,6 @@ # Makefile for the Linux PCMCIA char device drivers. # -obj-y += ipwireless/ - obj-$(CONFIG_SYNCLINK_CS) += synclink_cs.o obj-$(CONFIG_CARDMAN_4000) += cm4000_cs.o obj-$(CONFIG_CARDMAN_4040) += cm4040_cs.o From 65c56e073e4fd10385283561b91189572e33b519 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Fri, 25 Feb 2011 14:28:30 +0100 Subject: [PATCH 63/76] tty: phase out of ioctl file pointer for tty3270 as well The patch "tty: now phase out the ioctl file pointer for good" missed the tty3270 driver. This is the missing piece. Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- drivers/s390/char/keyboard.c | 4 +--- drivers/s390/char/keyboard.h | 2 +- drivers/s390/char/tty3270.c | 14 ++++++-------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c index 8cd58e412b5e..d6673345c5f4 100644 --- a/drivers/s390/char/keyboard.c +++ b/drivers/s390/char/keyboard.c @@ -455,9 +455,7 @@ do_kdgkb_ioctl(struct kbd_data *kbd, struct kbsentry __user *u_kbs, return 0; } -int -kbd_ioctl(struct kbd_data *kbd, struct file *file, - unsigned int cmd, unsigned long arg) +int kbd_ioctl(struct kbd_data *kbd, unsigned int cmd, unsigned long arg) { void __user *argp; int ct, perm; diff --git a/drivers/s390/char/keyboard.h b/drivers/s390/char/keyboard.h index 5ccfe9cf126d..7e736aaeae6e 100644 --- a/drivers/s390/char/keyboard.h +++ b/drivers/s390/char/keyboard.h @@ -36,7 +36,7 @@ void kbd_free(struct kbd_data *); void kbd_ascebc(struct kbd_data *, unsigned char *); void kbd_keycode(struct kbd_data *, unsigned int); -int kbd_ioctl(struct kbd_data *, struct file *, unsigned int, unsigned long); +int kbd_ioctl(struct kbd_data *, unsigned int, unsigned long); /* * Helper Functions. diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index 911822db614d..d33554df2b06 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c @@ -1718,9 +1718,8 @@ tty3270_wait_until_sent(struct tty_struct *tty, int timeout) { } -static int -tty3270_ioctl(struct tty_struct *tty, struct file *file, - unsigned int cmd, unsigned long arg) +static int tty3270_ioctl(struct tty_struct *tty, unsigned int cmd, + unsigned long arg) { struct tty3270 *tp; @@ -1729,13 +1728,12 @@ tty3270_ioctl(struct tty_struct *tty, struct file *file, return -ENODEV; if (tty->flags & (1 << TTY_IO_ERROR)) return -EIO; - return kbd_ioctl(tp->kbd, file, cmd, arg); + return kbd_ioctl(tp->kbd, cmd, arg); } #ifdef CONFIG_COMPAT -static long -tty3270_compat_ioctl(struct tty_struct *tty, struct file *file, - unsigned int cmd, unsigned long arg) +static long tty3270_compat_ioctl(struct tty_struct *tty, + unsigned int cmd, unsigned long arg) { struct tty3270 *tp; @@ -1744,7 +1742,7 @@ tty3270_compat_ioctl(struct tty_struct *tty, struct file *file, return -ENODEV; if (tty->flags & (1 << TTY_IO_ERROR)) return -EIO; - return kbd_ioctl(tp->kbd, file, cmd, (unsigned long)compat_ptr(arg)); + return kbd_ioctl(tp->kbd, cmd, (unsigned long)compat_ptr(arg)); } #endif From a2e6093c638a9846cfe81b84ea9a0643f9540c1f Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 22 Feb 2011 21:42:01 -0800 Subject: [PATCH 64/76] MAINTAINERS: Update HVC file patterns Commit 728674a7e466628df2aeec6d11a2ae1ef968fb67 ("tty: move hvc drivers to drivers/tty/hvc/") moved the files, update the patterns as appropriate. Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 5099856ee15e..ab3a9ac2e212 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2819,7 +2819,7 @@ F: mm/hwpoison-inject.c HYPERVISOR VIRTUAL CONSOLE DRIVER L: linuxppc-dev@lists.ozlabs.org S: Odd Fixes -F: drivers/char/hvc_* +F: drivers/tty/hvc/ iSCSI BOOT FIRMWARE TABLE (iBFT) DRIVER M: Peter Jones @@ -6090,7 +6090,7 @@ M: Chris Metcalf W: http://www.tilera.com/scm/ S: Supported F: arch/tile/ -F: drivers/char/hvc_tile.c +F: drivers/tty/hvc/hvc_tile.c F: drivers/net/tile/ TLAN NETWORK DRIVER From 8c6e9112ebc7ba5a782e986152c8e766dad1486f Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 22 Feb 2011 19:12:21 -0700 Subject: [PATCH 65/76] tty/serial: Relax the device_type restriction from of_serial There is no need to test for a device_type property in ns8250 compatible serial ports. device_type is an OpenFirmware property that is not required when using the flattened tree representation. Signed-off-by: Grant Likely Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/of_serial.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index 5c7abe4c94dd..6a18ca6ddaa9 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c @@ -160,17 +160,17 @@ static int of_platform_serial_remove(struct platform_device *ofdev) * A few common types, add more as needed. */ static struct of_device_id __devinitdata of_platform_serial_table[] = { - { .type = "serial", .compatible = "ns8250", .data = (void *)PORT_8250, }, - { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, }, - { .type = "serial", .compatible = "ns16550a", .data = (void *)PORT_16550A, }, - { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, }, - { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, }, - { .type = "serial", .compatible = "ns16850", .data = (void *)PORT_16850, }, + { .compatible = "ns8250", .data = (void *)PORT_8250, }, + { .compatible = "ns16450", .data = (void *)PORT_16450, }, + { .compatible = "ns16550a", .data = (void *)PORT_16550A, }, + { .compatible = "ns16550", .data = (void *)PORT_16550, }, + { .compatible = "ns16750", .data = (void *)PORT_16750, }, + { .compatible = "ns16850", .data = (void *)PORT_16850, }, #ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL - { .type = "serial", .compatible = "ibm,qpace-nwp-serial", - .data = (void *)PORT_NWPSERIAL, }, + { .compatible = "ibm,qpace-nwp-serial", + .data = (void *)PORT_NWPSERIAL, }, #endif - { .type = "serial", .data = (void *)PORT_UNKNOWN, }, + { .type = "serial", .data = (void *)PORT_UNKNOWN, }, { /* end of list */ }, }; From 2c590f3ca99c193a04fe90ec89046138b66fcc1e Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Mon, 24 Jan 2011 17:54:48 +0100 Subject: [PATCH 66/76] nozomi: don't use flush_scheduled_work() flush_scheduled_work() in tty_exit() doesn't seem to target any specific work. If it was to flush work items used in tty generic layer, they're already flushed properly during tty release. flush_scheduled_work() is going away. Remove the seemingly redundant usage. Signed-off-by: Tejun Heo Cc: Jiri Slaby Cc: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/tty/nozomi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index 513ba12064ea..f4f11164efe5 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c @@ -1514,8 +1514,6 @@ static void __devexit tty_exit(struct nozomi *dc) DBG1(" "); - flush_scheduled_work(); - for (i = 0; i < MAX_PORT; ++i) { struct tty_struct *tty = tty_port_tty_get(&dc->port[i].port); if (tty && list_empty(&tty->hangup_work.entry)) From c976cc3aa99e813084fc4bd295c9f7b706738b48 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 28 Feb 2011 22:28:31 +0300 Subject: [PATCH 67/76] Staging: generic_serial: fix double locking bug spin_lock_irqsave() is not nestable. The second time that it gets called it overwrites the "flags" variable and so IRQs can't be restored properly. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/generic_serial/generic_serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/generic_serial/generic_serial.c b/drivers/staging/generic_serial/generic_serial.c index 5954ee1dc953..466988dbc37d 100644 --- a/drivers/staging/generic_serial/generic_serial.c +++ b/drivers/staging/generic_serial/generic_serial.c @@ -566,9 +566,9 @@ void gs_close(struct tty_struct * tty, struct file * filp) * line status register. */ - spin_lock_irqsave(&port->driver_lock, flags); + spin_lock(&port->driver_lock); port->rd->disable_rx_interrupts (port); - spin_unlock_irqrestore(&port->driver_lock, flags); + spin_unlock(&port->driver_lock); spin_unlock_irqrestore(&port->port.lock, flags); /* close has no way of returning "EINTR", so discard return value */ From 751b3840d216f1ecd3b91ff5251bf7703b690cd8 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 1 Mar 2011 13:12:47 +0800 Subject: [PATCH 68/76] pcmcia: synclink_cs: fix prototype for mgslpc_ioctl() The ioctl file pointer was removed in commit 6caa76 "tty: now phase out the ioctl file pointer for good". Thus fix the prototype for mgslpc_ioctl() and eliminate below warning: CC [M] drivers/char/pcmcia/synclink_cs.o drivers/char/pcmcia/synclink_cs.c:2787: warning: initialization from incompatible pointer type Signed-off-by: Axel Lin Cc: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/char/pcmcia/synclink_cs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 02127cad0980..beca80bb9bdb 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -2222,13 +2222,12 @@ static int mgslpc_get_icount(struct tty_struct *tty, * Arguments: * * tty pointer to tty instance data - * file pointer to associated file object for device * cmd IOCTL command code * arg command argument/context * * Return Value: 0 if success, otherwise error code */ -static int mgslpc_ioctl(struct tty_struct *tty, struct file * file, +static int mgslpc_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; From 8d971e98a7be749445ac6eb9eb37b116f1a6d3c0 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 7 Mar 2011 12:03:07 -0800 Subject: [PATCH 69/76] Staging: tty: fix build with epca.c driver I forgot to move the digi*.h files from drivers/char/ to drivers/staging/tty/ Thanks to Randy for pointing out the issue. Reported-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman --- drivers/{char => staging/tty}/digi1.h | 0 drivers/{char => staging/tty}/digiFep1.h | 0 drivers/{char => staging/tty}/digiPCI.h | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename drivers/{char => staging/tty}/digi1.h (100%) rename drivers/{char => staging/tty}/digiFep1.h (100%) rename drivers/{char => staging/tty}/digiPCI.h (100%) diff --git a/drivers/char/digi1.h b/drivers/staging/tty/digi1.h similarity index 100% rename from drivers/char/digi1.h rename to drivers/staging/tty/digi1.h diff --git a/drivers/char/digiFep1.h b/drivers/staging/tty/digiFep1.h similarity index 100% rename from drivers/char/digiFep1.h rename to drivers/staging/tty/digiFep1.h diff --git a/drivers/char/digiPCI.h b/drivers/staging/tty/digiPCI.h similarity index 100% rename from drivers/char/digiPCI.h rename to drivers/staging/tty/digiPCI.h From b71dc8873427bb5bf0ce31b968c3f219a1d6d014 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 3 Mar 2011 18:38:22 +0100 Subject: [PATCH 70/76] tty: move cd1865.h to drivers/staging/tty/ The file is required by the specialix driver, which was moved to drivers/staging/. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/{char => staging/tty}/cd1865.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename drivers/{char => staging/tty}/cd1865.h (100%) diff --git a/drivers/char/cd1865.h b/drivers/staging/tty/cd1865.h similarity index 100% rename from drivers/char/cd1865.h rename to drivers/staging/tty/cd1865.h From 00bff392c81e4fb1901e5160fdd5afdb2546a6ab Mon Sep 17 00:00:00 2001 From: Xiaotian Feng Date: Thu, 3 Mar 2011 18:08:24 +0800 Subject: [PATCH 71/76] tty_audit: fix tty_audit_add_data live lock on audit disabled The current tty_audit_add_data code: do { size_t run; run = N_TTY_BUF_SIZE - buf->valid; if (run > size) run = size; memcpy(buf->data + buf->valid, data, run); buf->valid += run; data += run; size -= run; if (buf->valid == N_TTY_BUF_SIZE) tty_audit_buf_push_current(buf); } while (size != 0); If the current buffer is full, kernel will then call tty_audit_buf_push_current to empty the buffer. But if we disabled audit at the same time, tty_audit_buf_push() returns immediately if audit_enabled is zero. Without emptying the buffer. With obvious effect on tty_audit_add_data() that ends up spinning in that loop, copying 0 bytes at each iteration and attempting to push each time without any effect. Holding the lock all along. Suggested-by: Alexander Viro Signed-off-by: Xiaotian Feng Signed-off-by: Greg Kroah-Hartman --- drivers/tty/tty_audit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c index f64582b0f623..7c5866920622 100644 --- a/drivers/tty/tty_audit.c +++ b/drivers/tty/tty_audit.c @@ -95,8 +95,10 @@ static void tty_audit_buf_push(struct task_struct *tsk, uid_t loginuid, { if (buf->valid == 0) return; - if (audit_enabled == 0) + if (audit_enabled == 0) { + buf->valid = 0; return; + } tty_audit_log("tty", tsk, loginuid, sessionid, buf->major, buf->minor, buf->data, buf->valid); buf->valid = 0; From 550462378515a82279e07f12e2c105f617f112f8 Mon Sep 17 00:00:00 2001 From: Mayank Rana Date: Mon, 7 Mar 2011 10:28:42 +0530 Subject: [PATCH 72/76] serial: msm_serial_hs: Add MSM high speed UART driver This driver supports UART-DM HW on MSM platforms. It uses the on chip DMA to drive data transfers and has optional support for UART power management independent of Linux suspend/resume and wakeup from Rx. The driver was originally developed by Google. It is functionally equivalent to the version available at: http://android.git.kernel.org/?p=kernel/experimental.git the differences being: 1) Remove wakelocks and change unsupported DMA API. 2) Replace clock selection register codes by macros. 3) Fix checkpatch errors and add inline documentation. 4) Add runtime PM hooks for active power state transitions. 5) Handle error path and cleanup resources if required. CC: Nick Pelly Signed-off-by: Sankalp Bose Signed-off-by: Mayank Rana Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/Kconfig | 12 + drivers/tty/serial/Makefile | 1 + drivers/tty/serial/msm_serial_hs.c | 1880 +++++++++++++++++++ include/linux/platform_data/msm_serial_hs.h | 49 + 4 files changed, 1942 insertions(+) create mode 100644 drivers/tty/serial/msm_serial_hs.c create mode 100644 include/linux/platform_data/msm_serial_hs.h diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 90d939a4ee5d..d9ccbf825095 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1319,6 +1319,18 @@ config SERIAL_MSM_CONSOLE depends on SERIAL_MSM=y select SERIAL_CORE_CONSOLE +config SERIAL_MSM_HS + tristate "MSM UART High Speed: Serial Driver" + depends on ARCH_MSM + select SERIAL_CORE + help + If you have a machine based on MSM family of SoCs, you + can enable its onboard high speed serial port by enabling + this option. + + Choose M here to compile it as a module. The module will be + called msm_serial_hs. + config SERIAL_VT8500 bool "VIA VT8500 on-chip serial port support" depends on ARM && ARCH_VT8500 diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile index 0c6aefb55acf..d94dc005c8a6 100644 --- a/drivers/tty/serial/Makefile +++ b/drivers/tty/serial/Makefile @@ -76,6 +76,7 @@ obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o obj-$(CONFIG_SERIAL_MSM) += msm_serial.o +obj-$(CONFIG_SERIAL_MSM_HS) += msm_serial_hs.o obj-$(CONFIG_SERIAL_NETX) += netx-serial.o obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c new file mode 100644 index 000000000000..2e7fc9cee9cc --- /dev/null +++ b/drivers/tty/serial/msm_serial_hs.c @@ -0,0 +1,1880 @@ +/* + * MSM 7k/8k High speed uart driver + * + * Copyright (c) 2007-2011, Code Aurora Forum. All rights reserved. + * Copyright (c) 2008 Google Inc. + * Modified: Nick Pelly + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * Has optional support for uart power management independent of linux + * suspend/resume: + * + * RX wakeup. + * UART wakeup can be triggered by RX activity (using a wakeup GPIO on the + * UART RX pin). This should only be used if there is not a wakeup + * GPIO on the UART CTS, and the first RX byte is known (for example, with the + * Bluetooth Texas Instruments HCILL protocol), since the first RX byte will + * always be lost. RTS will be asserted even while the UART is off in this mode + * of operation. See msm_serial_hs_platform_data.rx_wakeup_irq. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +/* HSUART Registers */ +#define UARTDM_MR1_ADDR 0x0 +#define UARTDM_MR2_ADDR 0x4 + +/* Data Mover result codes */ +#define RSLT_FIFO_CNTR_BMSK (0xE << 28) +#define RSLT_VLD BIT(1) + +/* write only register */ +#define UARTDM_CSR_ADDR 0x8 +#define UARTDM_CSR_115200 0xFF +#define UARTDM_CSR_57600 0xEE +#define UARTDM_CSR_38400 0xDD +#define UARTDM_CSR_28800 0xCC +#define UARTDM_CSR_19200 0xBB +#define UARTDM_CSR_14400 0xAA +#define UARTDM_CSR_9600 0x99 +#define UARTDM_CSR_7200 0x88 +#define UARTDM_CSR_4800 0x77 +#define UARTDM_CSR_3600 0x66 +#define UARTDM_CSR_2400 0x55 +#define UARTDM_CSR_1200 0x44 +#define UARTDM_CSR_600 0x33 +#define UARTDM_CSR_300 0x22 +#define UARTDM_CSR_150 0x11 +#define UARTDM_CSR_75 0x00 + +/* write only register */ +#define UARTDM_TF_ADDR 0x70 +#define UARTDM_TF2_ADDR 0x74 +#define UARTDM_TF3_ADDR 0x78 +#define UARTDM_TF4_ADDR 0x7C + +/* write only register */ +#define UARTDM_CR_ADDR 0x10 +#define UARTDM_IMR_ADDR 0x14 + +#define UARTDM_IPR_ADDR 0x18 +#define UARTDM_TFWR_ADDR 0x1c +#define UARTDM_RFWR_ADDR 0x20 +#define UARTDM_HCR_ADDR 0x24 +#define UARTDM_DMRX_ADDR 0x34 +#define UARTDM_IRDA_ADDR 0x38 +#define UARTDM_DMEN_ADDR 0x3c + +/* UART_DM_NO_CHARS_FOR_TX */ +#define UARTDM_NCF_TX_ADDR 0x40 + +#define UARTDM_BADR_ADDR 0x44 + +#define UARTDM_SIM_CFG_ADDR 0x80 +/* Read Only register */ +#define UARTDM_SR_ADDR 0x8 + +/* Read Only register */ +#define UARTDM_RF_ADDR 0x70 +#define UARTDM_RF2_ADDR 0x74 +#define UARTDM_RF3_ADDR 0x78 +#define UARTDM_RF4_ADDR 0x7C + +/* Read Only register */ +#define UARTDM_MISR_ADDR 0x10 + +/* Read Only register */ +#define UARTDM_ISR_ADDR 0x14 +#define UARTDM_RX_TOTAL_SNAP_ADDR 0x38 + +#define UARTDM_RXFS_ADDR 0x50 + +/* Register field Mask Mapping */ +#define UARTDM_SR_PAR_FRAME_BMSK BIT(5) +#define UARTDM_SR_OVERRUN_BMSK BIT(4) +#define UARTDM_SR_TXEMT_BMSK BIT(3) +#define UARTDM_SR_TXRDY_BMSK BIT(2) +#define UARTDM_SR_RXRDY_BMSK BIT(0) + +#define UARTDM_CR_TX_DISABLE_BMSK BIT(3) +#define UARTDM_CR_RX_DISABLE_BMSK BIT(1) +#define UARTDM_CR_TX_EN_BMSK BIT(2) +#define UARTDM_CR_RX_EN_BMSK BIT(0) + +/* UARTDM_CR channel_comman bit value (register field is bits 8:4) */ +#define RESET_RX 0x10 +#define RESET_TX 0x20 +#define RESET_ERROR_STATUS 0x30 +#define RESET_BREAK_INT 0x40 +#define START_BREAK 0x50 +#define STOP_BREAK 0x60 +#define RESET_CTS 0x70 +#define RESET_STALE_INT 0x80 +#define RFR_LOW 0xD0 +#define RFR_HIGH 0xE0 +#define CR_PROTECTION_EN 0x100 +#define STALE_EVENT_ENABLE 0x500 +#define STALE_EVENT_DISABLE 0x600 +#define FORCE_STALE_EVENT 0x400 +#define CLEAR_TX_READY 0x300 +#define RESET_TX_ERROR 0x800 +#define RESET_TX_DONE 0x810 + +#define UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK 0xffffff00 +#define UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK 0x3f +#define UARTDM_MR1_CTS_CTL_BMSK 0x40 +#define UARTDM_MR1_RX_RDY_CTL_BMSK 0x80 + +#define UARTDM_MR2_ERROR_MODE_BMSK 0x40 +#define UARTDM_MR2_BITS_PER_CHAR_BMSK 0x30 + +/* bits per character configuration */ +#define FIVE_BPC (0 << 4) +#define SIX_BPC (1 << 4) +#define SEVEN_BPC (2 << 4) +#define EIGHT_BPC (3 << 4) + +#define UARTDM_MR2_STOP_BIT_LEN_BMSK 0xc +#define STOP_BIT_ONE (1 << 2) +#define STOP_BIT_TWO (3 << 2) + +#define UARTDM_MR2_PARITY_MODE_BMSK 0x3 + +/* Parity configuration */ +#define NO_PARITY 0x0 +#define EVEN_PARITY 0x1 +#define ODD_PARITY 0x2 +#define SPACE_PARITY 0x3 + +#define UARTDM_IPR_STALE_TIMEOUT_MSB_BMSK 0xffffff80 +#define UARTDM_IPR_STALE_LSB_BMSK 0x1f + +/* These can be used for both ISR and IMR register */ +#define UARTDM_ISR_TX_READY_BMSK BIT(7) +#define UARTDM_ISR_CURRENT_CTS_BMSK BIT(6) +#define UARTDM_ISR_DELTA_CTS_BMSK BIT(5) +#define UARTDM_ISR_RXLEV_BMSK BIT(4) +#define UARTDM_ISR_RXSTALE_BMSK BIT(3) +#define UARTDM_ISR_RXBREAK_BMSK BIT(2) +#define UARTDM_ISR_RXHUNT_BMSK BIT(1) +#define UARTDM_ISR_TXLEV_BMSK BIT(0) + +/* Field definitions for UART_DM_DMEN*/ +#define UARTDM_TX_DM_EN_BMSK 0x1 +#define UARTDM_RX_DM_EN_BMSK 0x2 + +#define UART_FIFOSIZE 64 +#define UARTCLK 7372800 + +/* Rx DMA request states */ +enum flush_reason { + FLUSH_NONE, + FLUSH_DATA_READY, + FLUSH_DATA_INVALID, /* values after this indicate invalid data */ + FLUSH_IGNORE = FLUSH_DATA_INVALID, + FLUSH_STOP, + FLUSH_SHUTDOWN, +}; + +/* UART clock states */ +enum msm_hs_clk_states_e { + MSM_HS_CLK_PORT_OFF, /* port not in use */ + MSM_HS_CLK_OFF, /* clock disabled */ + MSM_HS_CLK_REQUEST_OFF, /* disable after TX and RX flushed */ + MSM_HS_CLK_ON, /* clock enabled */ +}; + +/* Track the forced RXSTALE flush during clock off sequence. + * These states are only valid during MSM_HS_CLK_REQUEST_OFF */ +enum msm_hs_clk_req_off_state_e { + CLK_REQ_OFF_START, + CLK_REQ_OFF_RXSTALE_ISSUED, + CLK_REQ_OFF_FLUSH_ISSUED, + CLK_REQ_OFF_RXSTALE_FLUSHED, +}; + +/** + * struct msm_hs_tx + * @tx_ready_int_en: ok to dma more tx? + * @dma_in_flight: tx dma in progress + * @xfer: top level DMA command pointer structure + * @command_ptr: third level command struct pointer + * @command_ptr_ptr: second level command list struct pointer + * @mapped_cmd_ptr: DMA view of third level command struct + * @mapped_cmd_ptr_ptr: DMA view of second level command list struct + * @tx_count: number of bytes to transfer in DMA transfer + * @dma_base: DMA view of UART xmit buffer + * + * This structure describes a single Tx DMA transaction. MSM DMA + * commands have two levels of indirection. The top level command + * ptr points to a list of command ptr which in turn points to a + * single DMA 'command'. In our case each Tx transaction consists + * of a single second level pointer pointing to a 'box type' command. + */ +struct msm_hs_tx { + unsigned int tx_ready_int_en; + unsigned int dma_in_flight; + struct msm_dmov_cmd xfer; + dmov_box *command_ptr; + u32 *command_ptr_ptr; + dma_addr_t mapped_cmd_ptr; + dma_addr_t mapped_cmd_ptr_ptr; + int tx_count; + dma_addr_t dma_base; +}; + +/** + * struct msm_hs_rx + * @flush: Rx DMA request state + * @xfer: top level DMA command pointer structure + * @cmdptr_dmaaddr: DMA view of second level command structure + * @command_ptr: third level DMA command pointer structure + * @command_ptr_ptr: second level DMA command list pointer + * @mapped_cmd_ptr: DMA view of the third level command structure + * @wait: wait for DMA completion before shutdown + * @buffer: destination buffer for RX DMA + * @rbuffer: DMA view of buffer + * @pool: dma pool out of which coherent rx buffer is allocated + * @tty_work: private work-queue for tty flip buffer push task + * + * This structure describes a single Rx DMA transaction. Rx DMA + * transactions use box mode DMA commands. + */ +struct msm_hs_rx { + enum flush_reason flush; + struct msm_dmov_cmd xfer; + dma_addr_t cmdptr_dmaaddr; + dmov_box *command_ptr; + u32 *command_ptr_ptr; + dma_addr_t mapped_cmd_ptr; + wait_queue_head_t wait; + dma_addr_t rbuffer; + unsigned char *buffer; + struct dma_pool *pool; + struct work_struct tty_work; +}; + +/** + * struct msm_hs_rx_wakeup + * @irq: IRQ line to be configured as interrupt source on Rx activity + * @ignore: boolean value. 1 = ignore the wakeup interrupt + * @rx_to_inject: extra character to be inserted to Rx tty on wakeup + * @inject_rx: 1 = insert rx_to_inject. 0 = do not insert extra character + * + * This is an optional structure required for UART Rx GPIO IRQ based + * wakeup from low power state. UART wakeup can be triggered by RX activity + * (using a wakeup GPIO on the UART RX pin). This should only be used if + * there is not a wakeup GPIO on the UART CTS, and the first RX byte is + * known (eg., with the Bluetooth Texas Instruments HCILL protocol), + * since the first RX byte will always be lost. RTS will be asserted even + * while the UART is clocked off in this mode of operation. + */ +struct msm_hs_rx_wakeup { + int irq; /* < 0 indicates low power wakeup disabled */ + unsigned char ignore; + unsigned char inject_rx; + char rx_to_inject; +}; + +/** + * struct msm_hs_port + * @uport: embedded uart port structure + * @imr_reg: shadow value of UARTDM_IMR + * @clk: uart input clock handle + * @tx: Tx transaction related data structure + * @rx: Rx transaction related data structure + * @dma_tx_channel: Tx DMA command channel + * @dma_rx_channel Rx DMA command channel + * @dma_tx_crci: Tx channel rate control interface number + * @dma_rx_crci: Rx channel rate control interface number + * @clk_off_timer: Timer to poll DMA event completion before clock off + * @clk_off_delay: clk_off_timer poll interval + * @clk_state: overall clock state + * @clk_req_off_state: post flush clock states + * @rx_wakeup: optional rx_wakeup feature related data + * @exit_lpm_cb: optional callback to exit low power mode + * + * Low level serial port structure. + */ +struct msm_hs_port { + struct uart_port uport; + unsigned long imr_reg; + struct clk *clk; + struct msm_hs_tx tx; + struct msm_hs_rx rx; + + int dma_tx_channel; + int dma_rx_channel; + int dma_tx_crci; + int dma_rx_crci; + + struct hrtimer clk_off_timer; + ktime_t clk_off_delay; + enum msm_hs_clk_states_e clk_state; + enum msm_hs_clk_req_off_state_e clk_req_off_state; + + struct msm_hs_rx_wakeup rx_wakeup; + void (*exit_lpm_cb)(struct uart_port *); +}; + +#define MSM_UARTDM_BURST_SIZE 16 /* DM burst size (in bytes) */ +#define UARTDM_TX_BUF_SIZE UART_XMIT_SIZE +#define UARTDM_RX_BUF_SIZE 512 + +#define UARTDM_NR 2 + +static struct msm_hs_port q_uart_port[UARTDM_NR]; +static struct platform_driver msm_serial_hs_platform_driver; +static struct uart_driver msm_hs_driver; +static struct uart_ops msm_hs_ops; +static struct workqueue_struct *msm_hs_workqueue; + +#define UARTDM_TO_MSM(uart_port) \ + container_of((uart_port), struct msm_hs_port, uport) + +static unsigned int use_low_power_rx_wakeup(struct msm_hs_port + *msm_uport) +{ + return (msm_uport->rx_wakeup.irq >= 0); +} + +static unsigned int msm_hs_read(struct uart_port *uport, + unsigned int offset) +{ + return ioread32(uport->membase + offset); +} + +static void msm_hs_write(struct uart_port *uport, unsigned int offset, + unsigned int value) +{ + iowrite32(value, uport->membase + offset); +} + +static void msm_hs_release_port(struct uart_port *port) +{ + iounmap(port->membase); +} + +static int msm_hs_request_port(struct uart_port *port) +{ + port->membase = ioremap(port->mapbase, PAGE_SIZE); + if (unlikely(!port->membase)) + return -ENOMEM; + + /* configure the CR Protection to Enable */ + msm_hs_write(port, UARTDM_CR_ADDR, CR_PROTECTION_EN); + return 0; +} + +static int __devexit msm_hs_remove(struct platform_device *pdev) +{ + + struct msm_hs_port *msm_uport; + struct device *dev; + + if (pdev->id < 0 || pdev->id >= UARTDM_NR) { + printk(KERN_ERR "Invalid plaform device ID = %d\n", pdev->id); + return -EINVAL; + } + + msm_uport = &q_uart_port[pdev->id]; + dev = msm_uport->uport.dev; + + dma_unmap_single(dev, msm_uport->rx.mapped_cmd_ptr, sizeof(dmov_box), + DMA_TO_DEVICE); + dma_pool_free(msm_uport->rx.pool, msm_uport->rx.buffer, + msm_uport->rx.rbuffer); + dma_pool_destroy(msm_uport->rx.pool); + + dma_unmap_single(dev, msm_uport->rx.cmdptr_dmaaddr, sizeof(u32 *), + DMA_TO_DEVICE); + dma_unmap_single(dev, msm_uport->tx.mapped_cmd_ptr_ptr, sizeof(u32 *), + DMA_TO_DEVICE); + dma_unmap_single(dev, msm_uport->tx.mapped_cmd_ptr, sizeof(dmov_box), + DMA_TO_DEVICE); + + uart_remove_one_port(&msm_hs_driver, &msm_uport->uport); + clk_put(msm_uport->clk); + + /* Free the tx resources */ + kfree(msm_uport->tx.command_ptr); + kfree(msm_uport->tx.command_ptr_ptr); + + /* Free the rx resources */ + kfree(msm_uport->rx.command_ptr); + kfree(msm_uport->rx.command_ptr_ptr); + + iounmap(msm_uport->uport.membase); + + return 0; +} + +static int msm_hs_init_clk_locked(struct uart_port *uport) +{ + int ret; + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + ret = clk_enable(msm_uport->clk); + if (ret) { + printk(KERN_ERR "Error could not turn on UART clk\n"); + return ret; + } + + /* Set up the MREG/NREG/DREG/MNDREG */ + ret = clk_set_rate(msm_uport->clk, uport->uartclk); + if (ret) { + printk(KERN_WARNING "Error setting clock rate on UART\n"); + clk_disable(msm_uport->clk); + return ret; + } + + msm_uport->clk_state = MSM_HS_CLK_ON; + return 0; +} + +/* Enable and Disable clocks (Used for power management) */ +static void msm_hs_pm(struct uart_port *uport, unsigned int state, + unsigned int oldstate) +{ + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + if (use_low_power_rx_wakeup(msm_uport) || + msm_uport->exit_lpm_cb) + return; /* ignore linux PM states, + use msm_hs_request_clock API */ + + switch (state) { + case 0: + clk_enable(msm_uport->clk); + break; + case 3: + clk_disable(msm_uport->clk); + break; + default: + dev_err(uport->dev, "msm_serial: Unknown PM state %d\n", + state); + } +} + +/* + * programs the UARTDM_CSR register with correct bit rates + * + * Interrupts should be disabled before we are called, as + * we modify Set Baud rate + * Set receive stale interrupt level, dependant on Bit Rate + * Goal is to have around 8 ms before indicate stale. + * roundup (((Bit Rate * .008) / 10) + 1 + */ +static void msm_hs_set_bps_locked(struct uart_port *uport, + unsigned int bps) +{ + unsigned long rxstale; + unsigned long data; + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + switch (bps) { + case 300: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_75); + rxstale = 1; + break; + case 600: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_150); + rxstale = 1; + break; + case 1200: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_300); + rxstale = 1; + break; + case 2400: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_600); + rxstale = 1; + break; + case 4800: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_1200); + rxstale = 1; + break; + case 9600: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_2400); + rxstale = 2; + break; + case 14400: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_3600); + rxstale = 3; + break; + case 19200: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_4800); + rxstale = 4; + break; + case 28800: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_7200); + rxstale = 6; + break; + case 38400: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_9600); + rxstale = 8; + break; + case 57600: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_14400); + rxstale = 16; + break; + case 76800: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_19200); + rxstale = 16; + break; + case 115200: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_28800); + rxstale = 31; + break; + case 230400: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_57600); + rxstale = 31; + break; + case 460800: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_115200); + rxstale = 31; + break; + case 4000000: + case 3686400: + case 3200000: + case 3500000: + case 3000000: + case 2500000: + case 1500000: + case 1152000: + case 1000000: + case 921600: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_115200); + rxstale = 31; + break; + default: + msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_2400); + /* default to 9600 */ + bps = 9600; + rxstale = 2; + break; + } + if (bps > 460800) + uport->uartclk = bps * 16; + else + uport->uartclk = UARTCLK; + + if (clk_set_rate(msm_uport->clk, uport->uartclk)) { + printk(KERN_WARNING "Error setting clock rate on UART\n"); + return; + } + + data = rxstale & UARTDM_IPR_STALE_LSB_BMSK; + data |= UARTDM_IPR_STALE_TIMEOUT_MSB_BMSK & (rxstale << 2); + + msm_hs_write(uport, UARTDM_IPR_ADDR, data); +} + +/* + * termios : new ktermios + * oldtermios: old ktermios previous setting + * + * Configure the serial port + */ +static void msm_hs_set_termios(struct uart_port *uport, + struct ktermios *termios, + struct ktermios *oldtermios) +{ + unsigned int bps; + unsigned long data; + unsigned long flags; + unsigned int c_cflag = termios->c_cflag; + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + spin_lock_irqsave(&uport->lock, flags); + clk_enable(msm_uport->clk); + + /* 300 is the minimum baud support by the driver */ + bps = uart_get_baud_rate(uport, termios, oldtermios, 200, 4000000); + + /* Temporary remapping 200 BAUD to 3.2 mbps */ + if (bps == 200) + bps = 3200000; + + msm_hs_set_bps_locked(uport, bps); + + data = msm_hs_read(uport, UARTDM_MR2_ADDR); + data &= ~UARTDM_MR2_PARITY_MODE_BMSK; + /* set parity */ + if (PARENB == (c_cflag & PARENB)) { + if (PARODD == (c_cflag & PARODD)) + data |= ODD_PARITY; + else if (CMSPAR == (c_cflag & CMSPAR)) + data |= SPACE_PARITY; + else + data |= EVEN_PARITY; + } + + /* Set bits per char */ + data &= ~UARTDM_MR2_BITS_PER_CHAR_BMSK; + + switch (c_cflag & CSIZE) { + case CS5: + data |= FIVE_BPC; + break; + case CS6: + data |= SIX_BPC; + break; + case CS7: + data |= SEVEN_BPC; + break; + default: + data |= EIGHT_BPC; + break; + } + /* stop bits */ + if (c_cflag & CSTOPB) { + data |= STOP_BIT_TWO; + } else { + /* otherwise 1 stop bit */ + data |= STOP_BIT_ONE; + } + data |= UARTDM_MR2_ERROR_MODE_BMSK; + /* write parity/bits per char/stop bit configuration */ + msm_hs_write(uport, UARTDM_MR2_ADDR, data); + + /* Configure HW flow control */ + data = msm_hs_read(uport, UARTDM_MR1_ADDR); + + data &= ~(UARTDM_MR1_CTS_CTL_BMSK | UARTDM_MR1_RX_RDY_CTL_BMSK); + + if (c_cflag & CRTSCTS) { + data |= UARTDM_MR1_CTS_CTL_BMSK; + data |= UARTDM_MR1_RX_RDY_CTL_BMSK; + } + + msm_hs_write(uport, UARTDM_MR1_ADDR, data); + + uport->ignore_status_mask = termios->c_iflag & INPCK; + uport->ignore_status_mask |= termios->c_iflag & IGNPAR; + uport->read_status_mask = (termios->c_cflag & CREAD); + + msm_hs_write(uport, UARTDM_IMR_ADDR, 0); + + /* Set Transmit software time out */ + uart_update_timeout(uport, c_cflag, bps); + + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_RX); + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_TX); + + if (msm_uport->rx.flush == FLUSH_NONE) { + msm_uport->rx.flush = FLUSH_IGNORE; + msm_dmov_stop_cmd(msm_uport->dma_rx_channel, NULL, 1); + } + + msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg); + + clk_disable(msm_uport->clk); + spin_unlock_irqrestore(&uport->lock, flags); +} + +/* + * Standard API, Transmitter + * Any character in the transmit shift register is sent + */ +static unsigned int msm_hs_tx_empty(struct uart_port *uport) +{ + unsigned int data; + unsigned int ret = 0; + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + clk_enable(msm_uport->clk); + + data = msm_hs_read(uport, UARTDM_SR_ADDR); + if (data & UARTDM_SR_TXEMT_BMSK) + ret = TIOCSER_TEMT; + + clk_disable(msm_uport->clk); + + return ret; +} + +/* + * Standard API, Stop transmitter. + * Any character in the transmit shift register is sent as + * well as the current data mover transfer . + */ +static void msm_hs_stop_tx_locked(struct uart_port *uport) +{ + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + msm_uport->tx.tx_ready_int_en = 0; +} + +/* + * Standard API, Stop receiver as soon as possible. + * + * Function immediately terminates the operation of the + * channel receiver and any incoming characters are lost. None + * of the receiver status bits are affected by this command and + * characters that are already in the receive FIFO there. + */ +static void msm_hs_stop_rx_locked(struct uart_port *uport) +{ + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + unsigned int data; + + clk_enable(msm_uport->clk); + + /* disable dlink */ + data = msm_hs_read(uport, UARTDM_DMEN_ADDR); + data &= ~UARTDM_RX_DM_EN_BMSK; + msm_hs_write(uport, UARTDM_DMEN_ADDR, data); + + /* Disable the receiver */ + if (msm_uport->rx.flush == FLUSH_NONE) + msm_dmov_stop_cmd(msm_uport->dma_rx_channel, NULL, 1); + + if (msm_uport->rx.flush != FLUSH_SHUTDOWN) + msm_uport->rx.flush = FLUSH_STOP; + + clk_disable(msm_uport->clk); +} + +/* Transmit the next chunk of data */ +static void msm_hs_submit_tx_locked(struct uart_port *uport) +{ + int left; + int tx_count; + dma_addr_t src_addr; + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + struct msm_hs_tx *tx = &msm_uport->tx; + struct circ_buf *tx_buf = &msm_uport->uport.state->xmit; + + if (uart_circ_empty(tx_buf) || uport->state->port.tty->stopped) { + msm_hs_stop_tx_locked(uport); + return; + } + + tx->dma_in_flight = 1; + + tx_count = uart_circ_chars_pending(tx_buf); + + if (UARTDM_TX_BUF_SIZE < tx_count) + tx_count = UARTDM_TX_BUF_SIZE; + + left = UART_XMIT_SIZE - tx_buf->tail; + + if (tx_count > left) + tx_count = left; + + src_addr = tx->dma_base + tx_buf->tail; + dma_sync_single_for_device(uport->dev, src_addr, tx_count, + DMA_TO_DEVICE); + + tx->command_ptr->num_rows = (((tx_count + 15) >> 4) << 16) | + ((tx_count + 15) >> 4); + tx->command_ptr->src_row_addr = src_addr; + + dma_sync_single_for_device(uport->dev, tx->mapped_cmd_ptr, + sizeof(dmov_box), DMA_TO_DEVICE); + + *tx->command_ptr_ptr = CMD_PTR_LP | DMOV_CMD_ADDR(tx->mapped_cmd_ptr); + + dma_sync_single_for_device(uport->dev, tx->mapped_cmd_ptr_ptr, + sizeof(u32 *), DMA_TO_DEVICE); + + /* Save tx_count to use in Callback */ + tx->tx_count = tx_count; + msm_hs_write(uport, UARTDM_NCF_TX_ADDR, tx_count); + + /* Disable the tx_ready interrupt */ + msm_uport->imr_reg &= ~UARTDM_ISR_TX_READY_BMSK; + msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg); + msm_dmov_enqueue_cmd(msm_uport->dma_tx_channel, &tx->xfer); +} + +/* Start to receive the next chunk of data */ +static void msm_hs_start_rx_locked(struct uart_port *uport) +{ + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_STALE_INT); + msm_hs_write(uport, UARTDM_DMRX_ADDR, UARTDM_RX_BUF_SIZE); + msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_ENABLE); + msm_uport->imr_reg |= UARTDM_ISR_RXLEV_BMSK; + msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg); + + msm_uport->rx.flush = FLUSH_NONE; + msm_dmov_enqueue_cmd(msm_uport->dma_rx_channel, &msm_uport->rx.xfer); + + /* might have finished RX and be ready to clock off */ + hrtimer_start(&msm_uport->clk_off_timer, msm_uport->clk_off_delay, + HRTIMER_MODE_REL); +} + +/* Enable the transmitter Interrupt */ +static void msm_hs_start_tx_locked(struct uart_port *uport) +{ + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + clk_enable(msm_uport->clk); + + if (msm_uport->exit_lpm_cb) + msm_uport->exit_lpm_cb(uport); + + if (msm_uport->tx.tx_ready_int_en == 0) { + msm_uport->tx.tx_ready_int_en = 1; + msm_hs_submit_tx_locked(uport); + } + + clk_disable(msm_uport->clk); +} + +/* + * This routine is called when we are done with a DMA transfer + * + * This routine is registered with Data mover when we set + * up a Data Mover transfer. It is called from Data mover ISR + * when the DMA transfer is done. + */ +static void msm_hs_dmov_tx_callback(struct msm_dmov_cmd *cmd_ptr, + unsigned int result, + struct msm_dmov_errdata *err) +{ + unsigned long flags; + struct msm_hs_port *msm_uport; + + /* DMA did not finish properly */ + WARN_ON((((result & RSLT_FIFO_CNTR_BMSK) >> 28) == 1) && + !(result & RSLT_VLD)); + + msm_uport = container_of(cmd_ptr, struct msm_hs_port, tx.xfer); + + spin_lock_irqsave(&msm_uport->uport.lock, flags); + clk_enable(msm_uport->clk); + + msm_uport->imr_reg |= UARTDM_ISR_TX_READY_BMSK; + msm_hs_write(&msm_uport->uport, UARTDM_IMR_ADDR, msm_uport->imr_reg); + + clk_disable(msm_uport->clk); + spin_unlock_irqrestore(&msm_uport->uport.lock, flags); +} + +/* + * This routine is called when we are done with a DMA transfer or the + * a flush has been sent to the data mover driver. + * + * This routine is registered with Data mover when we set up a Data Mover + * transfer. It is called from Data mover ISR when the DMA transfer is done. + */ +static void msm_hs_dmov_rx_callback(struct msm_dmov_cmd *cmd_ptr, + unsigned int result, + struct msm_dmov_errdata *err) +{ + int retval; + int rx_count; + unsigned long status; + unsigned int error_f = 0; + unsigned long flags; + unsigned int flush; + struct tty_struct *tty; + struct uart_port *uport; + struct msm_hs_port *msm_uport; + + msm_uport = container_of(cmd_ptr, struct msm_hs_port, rx.xfer); + uport = &msm_uport->uport; + + spin_lock_irqsave(&uport->lock, flags); + clk_enable(msm_uport->clk); + + tty = uport->state->port.tty; + + msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_DISABLE); + + status = msm_hs_read(uport, UARTDM_SR_ADDR); + + /* overflow is not connect to data in a FIFO */ + if (unlikely((status & UARTDM_SR_OVERRUN_BMSK) && + (uport->read_status_mask & CREAD))) { + tty_insert_flip_char(tty, 0, TTY_OVERRUN); + uport->icount.buf_overrun++; + error_f = 1; + } + + if (!(uport->ignore_status_mask & INPCK)) + status = status & ~(UARTDM_SR_PAR_FRAME_BMSK); + + if (unlikely(status & UARTDM_SR_PAR_FRAME_BMSK)) { + /* Can not tell difference between parity & frame error */ + uport->icount.parity++; + error_f = 1; + if (uport->ignore_status_mask & IGNPAR) + tty_insert_flip_char(tty, 0, TTY_PARITY); + } + + if (error_f) + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_ERROR_STATUS); + + if (msm_uport->clk_req_off_state == CLK_REQ_OFF_FLUSH_ISSUED) + msm_uport->clk_req_off_state = CLK_REQ_OFF_RXSTALE_FLUSHED; + + flush = msm_uport->rx.flush; + if (flush == FLUSH_IGNORE) + msm_hs_start_rx_locked(uport); + if (flush == FLUSH_STOP) + msm_uport->rx.flush = FLUSH_SHUTDOWN; + if (flush >= FLUSH_DATA_INVALID) + goto out; + + rx_count = msm_hs_read(uport, UARTDM_RX_TOTAL_SNAP_ADDR); + + if (0 != (uport->read_status_mask & CREAD)) { + retval = tty_insert_flip_string(tty, msm_uport->rx.buffer, + rx_count); + BUG_ON(retval != rx_count); + } + + msm_hs_start_rx_locked(uport); + +out: + clk_disable(msm_uport->clk); + + spin_unlock_irqrestore(&uport->lock, flags); + + if (flush < FLUSH_DATA_INVALID) + queue_work(msm_hs_workqueue, &msm_uport->rx.tty_work); +} + +static void msm_hs_tty_flip_buffer_work(struct work_struct *work) +{ + struct msm_hs_port *msm_uport = + container_of(work, struct msm_hs_port, rx.tty_work); + struct tty_struct *tty = msm_uport->uport.state->port.tty; + + tty_flip_buffer_push(tty); +} + +/* + * Standard API, Current states of modem control inputs + * + * Since CTS can be handled entirely by HARDWARE we always + * indicate clear to send and count on the TX FIFO to block when + * it fills up. + * + * - TIOCM_DCD + * - TIOCM_CTS + * - TIOCM_DSR + * - TIOCM_RI + * (Unsupported) DCD and DSR will return them high. RI will return low. + */ +static unsigned int msm_hs_get_mctrl_locked(struct uart_port *uport) +{ + return TIOCM_DSR | TIOCM_CAR | TIOCM_CTS; +} + +/* + * True enables UART auto RFR, which indicates we are ready for data if the RX + * buffer is not full. False disables auto RFR, and deasserts RFR to indicate + * we are not ready for data. Must be called with UART clock on. + */ +static void set_rfr_locked(struct uart_port *uport, int auto_rfr) +{ + unsigned int data; + + data = msm_hs_read(uport, UARTDM_MR1_ADDR); + + if (auto_rfr) { + /* enable auto ready-for-receiving */ + data |= UARTDM_MR1_RX_RDY_CTL_BMSK; + msm_hs_write(uport, UARTDM_MR1_ADDR, data); + } else { + /* disable auto ready-for-receiving */ + data &= ~UARTDM_MR1_RX_RDY_CTL_BMSK; + msm_hs_write(uport, UARTDM_MR1_ADDR, data); + /* RFR is active low, set high */ + msm_hs_write(uport, UARTDM_CR_ADDR, RFR_HIGH); + } +} + +/* + * Standard API, used to set or clear RFR + */ +static void msm_hs_set_mctrl_locked(struct uart_port *uport, + unsigned int mctrl) +{ + unsigned int auto_rfr; + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + clk_enable(msm_uport->clk); + + auto_rfr = TIOCM_RTS & mctrl ? 1 : 0; + set_rfr_locked(uport, auto_rfr); + + clk_disable(msm_uport->clk); +} + +/* Standard API, Enable modem status (CTS) interrupt */ +static void msm_hs_enable_ms_locked(struct uart_port *uport) +{ + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + clk_enable(msm_uport->clk); + + /* Enable DELTA_CTS Interrupt */ + msm_uport->imr_reg |= UARTDM_ISR_DELTA_CTS_BMSK; + msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg); + + clk_disable(msm_uport->clk); + +} + +/* + * Standard API, Break Signal + * + * Control the transmission of a break signal. ctl eq 0 => break + * signal terminate ctl ne 0 => start break signal + */ +static void msm_hs_break_ctl(struct uart_port *uport, int ctl) +{ + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + clk_enable(msm_uport->clk); + msm_hs_write(uport, UARTDM_CR_ADDR, ctl ? START_BREAK : STOP_BREAK); + clk_disable(msm_uport->clk); +} + +static void msm_hs_config_port(struct uart_port *uport, int cfg_flags) +{ + unsigned long flags; + + spin_lock_irqsave(&uport->lock, flags); + if (cfg_flags & UART_CONFIG_TYPE) { + uport->type = PORT_MSM; + msm_hs_request_port(uport); + } + spin_unlock_irqrestore(&uport->lock, flags); +} + +/* Handle CTS changes (Called from interrupt handler) */ +static void msm_hs_handle_delta_cts(struct uart_port *uport) +{ + unsigned long flags; + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + spin_lock_irqsave(&uport->lock, flags); + clk_enable(msm_uport->clk); + + /* clear interrupt */ + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_CTS); + uport->icount.cts++; + + clk_disable(msm_uport->clk); + spin_unlock_irqrestore(&uport->lock, flags); + + /* clear the IOCTL TIOCMIWAIT if called */ + wake_up_interruptible(&uport->state->port.delta_msr_wait); +} + +/* check if the TX path is flushed, and if so clock off + * returns 0 did not clock off, need to retry (still sending final byte) + * -1 did not clock off, do not retry + * 1 if we clocked off + */ +static int msm_hs_check_clock_off_locked(struct uart_port *uport) +{ + unsigned long sr_status; + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + struct circ_buf *tx_buf = &uport->state->xmit; + + /* Cancel if tx tty buffer is not empty, dma is in flight, + * or tx fifo is not empty, or rx fifo is not empty */ + if (msm_uport->clk_state != MSM_HS_CLK_REQUEST_OFF || + !uart_circ_empty(tx_buf) || msm_uport->tx.dma_in_flight || + (msm_uport->imr_reg & UARTDM_ISR_TXLEV_BMSK) || + !(msm_uport->imr_reg & UARTDM_ISR_RXLEV_BMSK)) { + return -1; + } + + /* Make sure the uart is finished with the last byte */ + sr_status = msm_hs_read(uport, UARTDM_SR_ADDR); + if (!(sr_status & UARTDM_SR_TXEMT_BMSK)) + return 0; /* retry */ + + /* Make sure forced RXSTALE flush complete */ + switch (msm_uport->clk_req_off_state) { + case CLK_REQ_OFF_START: + msm_uport->clk_req_off_state = CLK_REQ_OFF_RXSTALE_ISSUED; + msm_hs_write(uport, UARTDM_CR_ADDR, FORCE_STALE_EVENT); + return 0; /* RXSTALE flush not complete - retry */ + case CLK_REQ_OFF_RXSTALE_ISSUED: + case CLK_REQ_OFF_FLUSH_ISSUED: + return 0; /* RXSTALE flush not complete - retry */ + case CLK_REQ_OFF_RXSTALE_FLUSHED: + break; /* continue */ + } + + if (msm_uport->rx.flush != FLUSH_SHUTDOWN) { + if (msm_uport->rx.flush == FLUSH_NONE) + msm_hs_stop_rx_locked(uport); + return 0; /* come back later to really clock off */ + } + + /* we really want to clock off */ + clk_disable(msm_uport->clk); + msm_uport->clk_state = MSM_HS_CLK_OFF; + + if (use_low_power_rx_wakeup(msm_uport)) { + msm_uport->rx_wakeup.ignore = 1; + enable_irq(msm_uport->rx_wakeup.irq); + } + return 1; +} + +static enum hrtimer_restart msm_hs_clk_off_retry(struct hrtimer *timer) +{ + unsigned long flags; + int ret = HRTIMER_NORESTART; + struct msm_hs_port *msm_uport = container_of(timer, struct msm_hs_port, + clk_off_timer); + struct uart_port *uport = &msm_uport->uport; + + spin_lock_irqsave(&uport->lock, flags); + + if (!msm_hs_check_clock_off_locked(uport)) { + hrtimer_forward_now(timer, msm_uport->clk_off_delay); + ret = HRTIMER_RESTART; + } + + spin_unlock_irqrestore(&uport->lock, flags); + + return ret; +} + +static irqreturn_t msm_hs_isr(int irq, void *dev) +{ + unsigned long flags; + unsigned long isr_status; + struct msm_hs_port *msm_uport = dev; + struct uart_port *uport = &msm_uport->uport; + struct circ_buf *tx_buf = &uport->state->xmit; + struct msm_hs_tx *tx = &msm_uport->tx; + struct msm_hs_rx *rx = &msm_uport->rx; + + spin_lock_irqsave(&uport->lock, flags); + + isr_status = msm_hs_read(uport, UARTDM_MISR_ADDR); + + /* Uart RX starting */ + if (isr_status & UARTDM_ISR_RXLEV_BMSK) { + msm_uport->imr_reg &= ~UARTDM_ISR_RXLEV_BMSK; + msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg); + } + /* Stale rx interrupt */ + if (isr_status & UARTDM_ISR_RXSTALE_BMSK) { + msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_DISABLE); + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_STALE_INT); + + if (msm_uport->clk_req_off_state == CLK_REQ_OFF_RXSTALE_ISSUED) + msm_uport->clk_req_off_state = + CLK_REQ_OFF_FLUSH_ISSUED; + if (rx->flush == FLUSH_NONE) { + rx->flush = FLUSH_DATA_READY; + msm_dmov_stop_cmd(msm_uport->dma_rx_channel, NULL, 1); + } + } + /* tx ready interrupt */ + if (isr_status & UARTDM_ISR_TX_READY_BMSK) { + /* Clear TX Ready */ + msm_hs_write(uport, UARTDM_CR_ADDR, CLEAR_TX_READY); + + if (msm_uport->clk_state == MSM_HS_CLK_REQUEST_OFF) { + msm_uport->imr_reg |= UARTDM_ISR_TXLEV_BMSK; + msm_hs_write(uport, UARTDM_IMR_ADDR, + msm_uport->imr_reg); + } + + /* Complete DMA TX transactions and submit new transactions */ + tx_buf->tail = (tx_buf->tail + tx->tx_count) & ~UART_XMIT_SIZE; + + tx->dma_in_flight = 0; + + uport->icount.tx += tx->tx_count; + if (tx->tx_ready_int_en) + msm_hs_submit_tx_locked(uport); + + if (uart_circ_chars_pending(tx_buf) < WAKEUP_CHARS) + uart_write_wakeup(uport); + } + if (isr_status & UARTDM_ISR_TXLEV_BMSK) { + /* TX FIFO is empty */ + msm_uport->imr_reg &= ~UARTDM_ISR_TXLEV_BMSK; + msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg); + if (!msm_hs_check_clock_off_locked(uport)) + hrtimer_start(&msm_uport->clk_off_timer, + msm_uport->clk_off_delay, + HRTIMER_MODE_REL); + } + + /* Change in CTS interrupt */ + if (isr_status & UARTDM_ISR_DELTA_CTS_BMSK) + msm_hs_handle_delta_cts(uport); + + spin_unlock_irqrestore(&uport->lock, flags); + + return IRQ_HANDLED; +} + +void msm_hs_request_clock_off_locked(struct uart_port *uport) +{ + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + if (msm_uport->clk_state == MSM_HS_CLK_ON) { + msm_uport->clk_state = MSM_HS_CLK_REQUEST_OFF; + msm_uport->clk_req_off_state = CLK_REQ_OFF_START; + if (!use_low_power_rx_wakeup(msm_uport)) + set_rfr_locked(uport, 0); + msm_uport->imr_reg |= UARTDM_ISR_TXLEV_BMSK; + msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg); + } +} + +/** + * msm_hs_request_clock_off - request to (i.e. asynchronously) turn off uart + * clock once pending TX is flushed and Rx DMA command is terminated. + * @uport: uart_port structure for the device instance. + * + * This functions puts the device into a partially active low power mode. It + * waits to complete all pending tx transactions, flushes ongoing Rx DMA + * command and terminates UART side Rx transaction, puts UART HW in non DMA + * mode and then clocks off the device. A client calls this when no UART + * data is expected. msm_request_clock_on() must be called before any further + * UART can be sent or received. + */ +void msm_hs_request_clock_off(struct uart_port *uport) +{ + unsigned long flags; + + spin_lock_irqsave(&uport->lock, flags); + msm_hs_request_clock_off_locked(uport); + spin_unlock_irqrestore(&uport->lock, flags); +} + +void msm_hs_request_clock_on_locked(struct uart_port *uport) +{ + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + unsigned int data; + + switch (msm_uport->clk_state) { + case MSM_HS_CLK_OFF: + clk_enable(msm_uport->clk); + disable_irq_nosync(msm_uport->rx_wakeup.irq); + /* fall-through */ + case MSM_HS_CLK_REQUEST_OFF: + if (msm_uport->rx.flush == FLUSH_STOP || + msm_uport->rx.flush == FLUSH_SHUTDOWN) { + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_RX); + data = msm_hs_read(uport, UARTDM_DMEN_ADDR); + data |= UARTDM_RX_DM_EN_BMSK; + msm_hs_write(uport, UARTDM_DMEN_ADDR, data); + } + hrtimer_try_to_cancel(&msm_uport->clk_off_timer); + if (msm_uport->rx.flush == FLUSH_SHUTDOWN) + msm_hs_start_rx_locked(uport); + if (!use_low_power_rx_wakeup(msm_uport)) + set_rfr_locked(uport, 1); + if (msm_uport->rx.flush == FLUSH_STOP) + msm_uport->rx.flush = FLUSH_IGNORE; + msm_uport->clk_state = MSM_HS_CLK_ON; + break; + case MSM_HS_CLK_ON: + break; + case MSM_HS_CLK_PORT_OFF: + break; + } +} + +/** + * msm_hs_request_clock_on - Switch the device from partially active low + * power mode to fully active (i.e. clock on) mode. + * @uport: uart_port structure for the device. + * + * This function switches on the input clock, puts UART HW into DMA mode + * and enqueues an Rx DMA command if the device was in partially active + * mode. It has no effect if called with the device in inactive state. + */ +void msm_hs_request_clock_on(struct uart_port *uport) +{ + unsigned long flags; + + spin_lock_irqsave(&uport->lock, flags); + msm_hs_request_clock_on_locked(uport); + spin_unlock_irqrestore(&uport->lock, flags); +} + +static irqreturn_t msm_hs_rx_wakeup_isr(int irq, void *dev) +{ + unsigned int wakeup = 0; + unsigned long flags; + struct msm_hs_port *msm_uport = dev; + struct uart_port *uport = &msm_uport->uport; + struct tty_struct *tty = NULL; + + spin_lock_irqsave(&uport->lock, flags); + if (msm_uport->clk_state == MSM_HS_CLK_OFF) { + /* ignore the first irq - it is a pending irq that occured + * before enable_irq() */ + if (msm_uport->rx_wakeup.ignore) + msm_uport->rx_wakeup.ignore = 0; + else + wakeup = 1; + } + + if (wakeup) { + /* the uart was clocked off during an rx, wake up and + * optionally inject char into tty rx */ + msm_hs_request_clock_on_locked(uport); + if (msm_uport->rx_wakeup.inject_rx) { + tty = uport->state->port.tty; + tty_insert_flip_char(tty, + msm_uport->rx_wakeup.rx_to_inject, + TTY_NORMAL); + queue_work(msm_hs_workqueue, &msm_uport->rx.tty_work); + } + } + + spin_unlock_irqrestore(&uport->lock, flags); + + return IRQ_HANDLED; +} + +static const char *msm_hs_type(struct uart_port *port) +{ + return (port->type == PORT_MSM) ? "MSM_HS_UART" : NULL; +} + +/* Called when port is opened */ +static int msm_hs_startup(struct uart_port *uport) +{ + int ret; + int rfr_level; + unsigned long flags; + unsigned int data; + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + struct circ_buf *tx_buf = &uport->state->xmit; + struct msm_hs_tx *tx = &msm_uport->tx; + struct msm_hs_rx *rx = &msm_uport->rx; + + rfr_level = uport->fifosize; + if (rfr_level > 16) + rfr_level -= 16; + + tx->dma_base = dma_map_single(uport->dev, tx_buf->buf, UART_XMIT_SIZE, + DMA_TO_DEVICE); + + /* do not let tty layer execute RX in global workqueue, use a + * dedicated workqueue managed by this driver */ + uport->state->port.tty->low_latency = 1; + + /* turn on uart clk */ + ret = msm_hs_init_clk_locked(uport); + if (unlikely(ret)) { + printk(KERN_ERR "Turning uartclk failed!\n"); + goto err_msm_hs_init_clk; + } + + /* Set auto RFR Level */ + data = msm_hs_read(uport, UARTDM_MR1_ADDR); + data &= ~UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK; + data &= ~UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK; + data |= (UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK & (rfr_level << 2)); + data |= (UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK & rfr_level); + msm_hs_write(uport, UARTDM_MR1_ADDR, data); + + /* Make sure RXSTALE count is non-zero */ + data = msm_hs_read(uport, UARTDM_IPR_ADDR); + if (!data) { + data |= 0x1f & UARTDM_IPR_STALE_LSB_BMSK; + msm_hs_write(uport, UARTDM_IPR_ADDR, data); + } + + /* Enable Data Mover Mode */ + data = UARTDM_TX_DM_EN_BMSK | UARTDM_RX_DM_EN_BMSK; + msm_hs_write(uport, UARTDM_DMEN_ADDR, data); + + /* Reset TX */ + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_TX); + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_RX); + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_ERROR_STATUS); + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_BREAK_INT); + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_STALE_INT); + msm_hs_write(uport, UARTDM_CR_ADDR, RESET_CTS); + msm_hs_write(uport, UARTDM_CR_ADDR, RFR_LOW); + /* Turn on Uart Receiver */ + msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_RX_EN_BMSK); + + /* Turn on Uart Transmitter */ + msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_TX_EN_BMSK); + + /* Initialize the tx */ + tx->tx_ready_int_en = 0; + tx->dma_in_flight = 0; + + tx->xfer.complete_func = msm_hs_dmov_tx_callback; + tx->xfer.execute_func = NULL; + + tx->command_ptr->cmd = CMD_LC | + CMD_DST_CRCI(msm_uport->dma_tx_crci) | CMD_MODE_BOX; + + tx->command_ptr->src_dst_len = (MSM_UARTDM_BURST_SIZE << 16) + | (MSM_UARTDM_BURST_SIZE); + + tx->command_ptr->row_offset = (MSM_UARTDM_BURST_SIZE << 16); + + tx->command_ptr->dst_row_addr = + msm_uport->uport.mapbase + UARTDM_TF_ADDR; + + + /* Turn on Uart Receive */ + rx->xfer.complete_func = msm_hs_dmov_rx_callback; + rx->xfer.execute_func = NULL; + + rx->command_ptr->cmd = CMD_LC | + CMD_SRC_CRCI(msm_uport->dma_rx_crci) | CMD_MODE_BOX; + + rx->command_ptr->src_dst_len = (MSM_UARTDM_BURST_SIZE << 16) + | (MSM_UARTDM_BURST_SIZE); + rx->command_ptr->row_offset = MSM_UARTDM_BURST_SIZE; + rx->command_ptr->src_row_addr = uport->mapbase + UARTDM_RF_ADDR; + + + msm_uport->imr_reg |= UARTDM_ISR_RXSTALE_BMSK; + /* Enable reading the current CTS, no harm even if CTS is ignored */ + msm_uport->imr_reg |= UARTDM_ISR_CURRENT_CTS_BMSK; + + msm_hs_write(uport, UARTDM_TFWR_ADDR, 0); /* TXLEV on empty TX fifo */ + + + ret = request_irq(uport->irq, msm_hs_isr, IRQF_TRIGGER_HIGH, + "msm_hs_uart", msm_uport); + if (unlikely(ret)) { + printk(KERN_ERR "Request msm_hs_uart IRQ failed!\n"); + goto err_request_irq; + } + if (use_low_power_rx_wakeup(msm_uport)) { + ret = request_irq(msm_uport->rx_wakeup.irq, + msm_hs_rx_wakeup_isr, + IRQF_TRIGGER_FALLING, + "msm_hs_rx_wakeup", msm_uport); + if (unlikely(ret)) { + printk(KERN_ERR "Request msm_hs_rx_wakeup IRQ failed!\n"); + free_irq(uport->irq, msm_uport); + goto err_request_irq; + } + disable_irq(msm_uport->rx_wakeup.irq); + } + + spin_lock_irqsave(&uport->lock, flags); + + msm_hs_write(uport, UARTDM_RFWR_ADDR, 0); + msm_hs_start_rx_locked(uport); + + spin_unlock_irqrestore(&uport->lock, flags); + ret = pm_runtime_set_active(uport->dev); + if (ret) + dev_err(uport->dev, "set active error:%d\n", ret); + pm_runtime_enable(uport->dev); + + return 0; + +err_request_irq: +err_msm_hs_init_clk: + dma_unmap_single(uport->dev, tx->dma_base, + UART_XMIT_SIZE, DMA_TO_DEVICE); + return ret; +} + +/* Initialize tx and rx data structures */ +static int __devinit uartdm_init_port(struct uart_port *uport) +{ + int ret = 0; + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + struct msm_hs_tx *tx = &msm_uport->tx; + struct msm_hs_rx *rx = &msm_uport->rx; + + /* Allocate the command pointer. Needs to be 64 bit aligned */ + tx->command_ptr = kmalloc(sizeof(dmov_box), GFP_KERNEL | __GFP_DMA); + if (!tx->command_ptr) + return -ENOMEM; + + tx->command_ptr_ptr = kmalloc(sizeof(u32 *), GFP_KERNEL | __GFP_DMA); + if (!tx->command_ptr_ptr) { + ret = -ENOMEM; + goto err_tx_command_ptr_ptr; + } + + tx->mapped_cmd_ptr = dma_map_single(uport->dev, tx->command_ptr, + sizeof(dmov_box), DMA_TO_DEVICE); + tx->mapped_cmd_ptr_ptr = dma_map_single(uport->dev, + tx->command_ptr_ptr, + sizeof(u32 *), DMA_TO_DEVICE); + tx->xfer.cmdptr = DMOV_CMD_ADDR(tx->mapped_cmd_ptr_ptr); + + init_waitqueue_head(&rx->wait); + + rx->pool = dma_pool_create("rx_buffer_pool", uport->dev, + UARTDM_RX_BUF_SIZE, 16, 0); + if (!rx->pool) { + pr_err("%s(): cannot allocate rx_buffer_pool", __func__); + ret = -ENOMEM; + goto err_dma_pool_create; + } + + rx->buffer = dma_pool_alloc(rx->pool, GFP_KERNEL, &rx->rbuffer); + if (!rx->buffer) { + pr_err("%s(): cannot allocate rx->buffer", __func__); + ret = -ENOMEM; + goto err_dma_pool_alloc; + } + + /* Allocate the command pointer. Needs to be 64 bit aligned */ + rx->command_ptr = kmalloc(sizeof(dmov_box), GFP_KERNEL | __GFP_DMA); + if (!rx->command_ptr) { + pr_err("%s(): cannot allocate rx->command_ptr", __func__); + ret = -ENOMEM; + goto err_rx_command_ptr; + } + + rx->command_ptr_ptr = kmalloc(sizeof(u32 *), GFP_KERNEL | __GFP_DMA); + if (!rx->command_ptr_ptr) { + pr_err("%s(): cannot allocate rx->command_ptr_ptr", __func__); + ret = -ENOMEM; + goto err_rx_command_ptr_ptr; + } + + rx->command_ptr->num_rows = ((UARTDM_RX_BUF_SIZE >> 4) << 16) | + (UARTDM_RX_BUF_SIZE >> 4); + + rx->command_ptr->dst_row_addr = rx->rbuffer; + + rx->mapped_cmd_ptr = dma_map_single(uport->dev, rx->command_ptr, + sizeof(dmov_box), DMA_TO_DEVICE); + + *rx->command_ptr_ptr = CMD_PTR_LP | DMOV_CMD_ADDR(rx->mapped_cmd_ptr); + + rx->cmdptr_dmaaddr = dma_map_single(uport->dev, rx->command_ptr_ptr, + sizeof(u32 *), DMA_TO_DEVICE); + rx->xfer.cmdptr = DMOV_CMD_ADDR(rx->cmdptr_dmaaddr); + + INIT_WORK(&rx->tty_work, msm_hs_tty_flip_buffer_work); + + return ret; + +err_rx_command_ptr_ptr: + kfree(rx->command_ptr); +err_rx_command_ptr: + dma_pool_free(msm_uport->rx.pool, msm_uport->rx.buffer, + msm_uport->rx.rbuffer); +err_dma_pool_alloc: + dma_pool_destroy(msm_uport->rx.pool); +err_dma_pool_create: + dma_unmap_single(uport->dev, msm_uport->tx.mapped_cmd_ptr_ptr, + sizeof(u32 *), DMA_TO_DEVICE); + dma_unmap_single(uport->dev, msm_uport->tx.mapped_cmd_ptr, + sizeof(dmov_box), DMA_TO_DEVICE); + kfree(msm_uport->tx.command_ptr_ptr); +err_tx_command_ptr_ptr: + kfree(msm_uport->tx.command_ptr); + return ret; +} + +static int __devinit msm_hs_probe(struct platform_device *pdev) +{ + int ret; + struct uart_port *uport; + struct msm_hs_port *msm_uport; + struct resource *resource; + const struct msm_serial_hs_platform_data *pdata = + pdev->dev.platform_data; + + if (pdev->id < 0 || pdev->id >= UARTDM_NR) { + printk(KERN_ERR "Invalid plaform device ID = %d\n", pdev->id); + return -EINVAL; + } + + msm_uport = &q_uart_port[pdev->id]; + uport = &msm_uport->uport; + + uport->dev = &pdev->dev; + + resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (unlikely(!resource)) + return -ENXIO; + + uport->mapbase = resource->start; + uport->irq = platform_get_irq(pdev, 0); + if (unlikely(uport->irq < 0)) + return -ENXIO; + + if (unlikely(set_irq_wake(uport->irq, 1))) + return -ENXIO; + + if (pdata == NULL || pdata->rx_wakeup_irq < 0) + msm_uport->rx_wakeup.irq = -1; + else { + msm_uport->rx_wakeup.irq = pdata->rx_wakeup_irq; + msm_uport->rx_wakeup.ignore = 1; + msm_uport->rx_wakeup.inject_rx = pdata->inject_rx_on_wakeup; + msm_uport->rx_wakeup.rx_to_inject = pdata->rx_to_inject; + + if (unlikely(msm_uport->rx_wakeup.irq < 0)) + return -ENXIO; + + if (unlikely(set_irq_wake(msm_uport->rx_wakeup.irq, 1))) + return -ENXIO; + } + + if (pdata == NULL) + msm_uport->exit_lpm_cb = NULL; + else + msm_uport->exit_lpm_cb = pdata->exit_lpm_cb; + + resource = platform_get_resource_byname(pdev, IORESOURCE_DMA, + "uartdm_channels"); + if (unlikely(!resource)) + return -ENXIO; + + msm_uport->dma_tx_channel = resource->start; + msm_uport->dma_rx_channel = resource->end; + + resource = platform_get_resource_byname(pdev, IORESOURCE_DMA, + "uartdm_crci"); + if (unlikely(!resource)) + return -ENXIO; + + msm_uport->dma_tx_crci = resource->start; + msm_uport->dma_rx_crci = resource->end; + + uport->iotype = UPIO_MEM; + uport->fifosize = UART_FIFOSIZE; + uport->ops = &msm_hs_ops; + uport->flags = UPF_BOOT_AUTOCONF; + uport->uartclk = UARTCLK; + msm_uport->imr_reg = 0x0; + msm_uport->clk = clk_get(&pdev->dev, "uartdm_clk"); + if (IS_ERR(msm_uport->clk)) + return PTR_ERR(msm_uport->clk); + + ret = uartdm_init_port(uport); + if (unlikely(ret)) + return ret; + + msm_uport->clk_state = MSM_HS_CLK_PORT_OFF; + hrtimer_init(&msm_uport->clk_off_timer, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); + msm_uport->clk_off_timer.function = msm_hs_clk_off_retry; + msm_uport->clk_off_delay = ktime_set(0, 1000000); /* 1ms */ + + uport->line = pdev->id; + return uart_add_one_port(&msm_hs_driver, uport); +} + +static int __init msm_serial_hs_init(void) +{ + int ret, i; + + /* Init all UARTS as non-configured */ + for (i = 0; i < UARTDM_NR; i++) + q_uart_port[i].uport.type = PORT_UNKNOWN; + + msm_hs_workqueue = create_singlethread_workqueue("msm_serial_hs"); + if (unlikely(!msm_hs_workqueue)) + return -ENOMEM; + + ret = uart_register_driver(&msm_hs_driver); + if (unlikely(ret)) { + printk(KERN_ERR "%s failed to load\n", __func__); + goto err_uart_register_driver; + } + + ret = platform_driver_register(&msm_serial_hs_platform_driver); + if (ret) { + printk(KERN_ERR "%s failed to load\n", __func__); + goto err_platform_driver_register; + } + + return ret; + +err_platform_driver_register: + uart_unregister_driver(&msm_hs_driver); +err_uart_register_driver: + destroy_workqueue(msm_hs_workqueue); + return ret; +} +module_init(msm_serial_hs_init); + +/* + * Called by the upper layer when port is closed. + * - Disables the port + * - Unhook the ISR + */ +static void msm_hs_shutdown(struct uart_port *uport) +{ + unsigned long flags; + struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); + + BUG_ON(msm_uport->rx.flush < FLUSH_STOP); + + spin_lock_irqsave(&uport->lock, flags); + clk_enable(msm_uport->clk); + + /* Disable the transmitter */ + msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_TX_DISABLE_BMSK); + /* Disable the receiver */ + msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_RX_DISABLE_BMSK); + + pm_runtime_disable(uport->dev); + pm_runtime_set_suspended(uport->dev); + + /* Free the interrupt */ + free_irq(uport->irq, msm_uport); + if (use_low_power_rx_wakeup(msm_uport)) + free_irq(msm_uport->rx_wakeup.irq, msm_uport); + + msm_uport->imr_reg = 0; + msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg); + + wait_event(msm_uport->rx.wait, msm_uport->rx.flush == FLUSH_SHUTDOWN); + + clk_disable(msm_uport->clk); /* to balance local clk_enable() */ + if (msm_uport->clk_state != MSM_HS_CLK_OFF) + clk_disable(msm_uport->clk); /* to balance clk_state */ + msm_uport->clk_state = MSM_HS_CLK_PORT_OFF; + + dma_unmap_single(uport->dev, msm_uport->tx.dma_base, + UART_XMIT_SIZE, DMA_TO_DEVICE); + + spin_unlock_irqrestore(&uport->lock, flags); + + if (cancel_work_sync(&msm_uport->rx.tty_work)) + msm_hs_tty_flip_buffer_work(&msm_uport->rx.tty_work); +} + +static void __exit msm_serial_hs_exit(void) +{ + flush_workqueue(msm_hs_workqueue); + destroy_workqueue(msm_hs_workqueue); + platform_driver_unregister(&msm_serial_hs_platform_driver); + uart_unregister_driver(&msm_hs_driver); +} +module_exit(msm_serial_hs_exit); + +#ifdef CONFIG_PM_RUNTIME +static int msm_hs_runtime_idle(struct device *dev) +{ + /* + * returning success from idle results in runtime suspend to be + * called + */ + return 0; +} + +static int msm_hs_runtime_resume(struct device *dev) +{ + struct platform_device *pdev = container_of(dev, struct + platform_device, dev); + struct msm_hs_port *msm_uport = &q_uart_port[pdev->id]; + + msm_hs_request_clock_on(&msm_uport->uport); + return 0; +} + +static int msm_hs_runtime_suspend(struct device *dev) +{ + struct platform_device *pdev = container_of(dev, struct + platform_device, dev); + struct msm_hs_port *msm_uport = &q_uart_port[pdev->id]; + + msm_hs_request_clock_off(&msm_uport->uport); + return 0; +} +#else +#define msm_hs_runtime_idle NULL +#define msm_hs_runtime_resume NULL +#define msm_hs_runtime_suspend NULL +#endif + +static const struct dev_pm_ops msm_hs_dev_pm_ops = { + .runtime_suspend = msm_hs_runtime_suspend, + .runtime_resume = msm_hs_runtime_resume, + .runtime_idle = msm_hs_runtime_idle, +}; + +static struct platform_driver msm_serial_hs_platform_driver = { + .probe = msm_hs_probe, + .remove = __devexit_p(msm_hs_remove), + .driver = { + .name = "msm_serial_hs", + .owner = THIS_MODULE, + .pm = &msm_hs_dev_pm_ops, + }, +}; + +static struct uart_driver msm_hs_driver = { + .owner = THIS_MODULE, + .driver_name = "msm_serial_hs", + .dev_name = "ttyHS", + .nr = UARTDM_NR, + .cons = 0, +}; + +static struct uart_ops msm_hs_ops = { + .tx_empty = msm_hs_tx_empty, + .set_mctrl = msm_hs_set_mctrl_locked, + .get_mctrl = msm_hs_get_mctrl_locked, + .stop_tx = msm_hs_stop_tx_locked, + .start_tx = msm_hs_start_tx_locked, + .stop_rx = msm_hs_stop_rx_locked, + .enable_ms = msm_hs_enable_ms_locked, + .break_ctl = msm_hs_break_ctl, + .startup = msm_hs_startup, + .shutdown = msm_hs_shutdown, + .set_termios = msm_hs_set_termios, + .pm = msm_hs_pm, + .type = msm_hs_type, + .config_port = msm_hs_config_port, + .release_port = msm_hs_release_port, + .request_port = msm_hs_request_port, +}; + +MODULE_DESCRIPTION("High Speed UART Driver for the MSM chipset"); +MODULE_VERSION("1.2"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/platform_data/msm_serial_hs.h b/include/linux/platform_data/msm_serial_hs.h new file mode 100644 index 000000000000..98a2046f8b31 --- /dev/null +++ b/include/linux/platform_data/msm_serial_hs.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2008 Google, Inc. + * Author: Nick Pelly + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __ASM_ARCH_MSM_SERIAL_HS_H +#define __ASM_ARCH_MSM_SERIAL_HS_H + +#include + +/* API to request the uart clock off or on for low power management + * Clients should call request_clock_off() when no uart data is expected, + * and must call request_clock_on() before any further uart data can be + * received. */ +extern void msm_hs_request_clock_off(struct uart_port *uport); +extern void msm_hs_request_clock_on(struct uart_port *uport); + +/** + * struct msm_serial_hs_platform_data + * @rx_wakeup_irq: Rx activity irq + * @rx_to_inject: extra character to be inserted to Rx tty on wakeup + * @inject_rx: 1 = insert rx_to_inject. 0 = do not insert extra character + * @exit_lpm_cb: function called before every Tx transaction + * + * This is an optional structure required for UART Rx GPIO IRQ based + * wakeup from low power state. UART wakeup can be triggered by RX activity + * (using a wakeup GPIO on the UART RX pin). This should only be used if + * there is not a wakeup GPIO on the UART CTS, and the first RX byte is + * known (eg., with the Bluetooth Texas Instruments HCILL protocol), + * since the first RX byte will always be lost. RTS will be asserted even + * while the UART is clocked off in this mode of operation. + */ +struct msm_serial_hs_platform_data { + int rx_wakeup_irq; + unsigned char inject_rx_on_wakeup; + char rx_to_inject; + void (*exit_lpm_cb)(struct uart_port *); +}; + +#endif From 323e84122ec6447a5a18de42b0dc7114f77e76c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20B=C3=A9nard?= Date: Wed, 9 Mar 2011 19:24:48 +0100 Subject: [PATCH 73/76] n_gsm: add a documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * this documentation gives some details on how to get the n_gsm line discipline to work with modems supporting 07.10 basic option. * it was tested on Telit and Simcom modems. Signed-off-by: Eric Bénard Cc: Alan Cox Signed-off-by: Greg Kroah-Hartman --- Documentation/serial/n_gsm.txt | 89 ++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Documentation/serial/n_gsm.txt diff --git a/Documentation/serial/n_gsm.txt b/Documentation/serial/n_gsm.txt new file mode 100644 index 000000000000..397f41a1f153 --- /dev/null +++ b/Documentation/serial/n_gsm.txt @@ -0,0 +1,89 @@ +n_gsm.c GSM 0710 tty multiplexor HOWTO +=================================================== + +This line discipline implements the GSM 07.10 multiplexing protocol +detailed in the following 3GPP document : +http://www.3gpp.org/ftp/Specs/archive/07_series/07.10/0710-720.zip + +This document give some hints on how to use this driver with GPRS and 3G +modems connected to a physical serial port. + +How to use it +------------- +1- initialize the modem in 0710 mux mode (usually AT+CMUX= command) through +its serial port. Depending on the modem used, you can pass more or less +parameters to this command, +2- switch the serial line to using the n_gsm line discipline by using +TIOCSETD ioctl, +3- configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl, + +Major parts of the initialization program : +(a good starting point is util-linux-ng/sys-utils/ldattach.c) +#include +#define N_GSM0710 21 /* GSM 0710 Mux */ +#define DEFAULT_SPEED B115200 +#define SERIAL_PORT /dev/ttyS0 + + int ldisc = N_GSM0710; + struct gsm_config c; + struct termios configuration; + + /* open the serial port connected to the modem */ + fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY); + + /* configure the serial port : speed, flow control ... */ + + /* send the AT commands to switch the modem to CMUX mode + and check that it's succesful (should return OK) */ + write(fd, "AT+CMUX=0\r", 10); + + /* experience showed that some modems need some time before + being able to answer to the first MUX packet so a delay + may be needed here in some case */ + sleep(3); + + /* use n_gsm line discipline */ + ioctl(fd, TIOCSETD, &ldisc); + + /* get n_gsm configuration */ + ioctl(fd, GSMIOC_GETCONF, &c); + /* we are initiator and need encoding 0 (basic) */ + c.initiator = 1; + c.encapsulation = 0; + /* our modem defaults to a maximum size of 127 bytes */ + c.mru = 127; + c.mtu = 127; + /* set the new configuration */ + ioctl(fd, GSMIOC_SETCONF, &c); + + /* and wait for ever to keep the line discipline enabled */ + daemon(0,0); + pause(); + +4- create the devices corresponding to the "virtual" serial ports (take care, +each modem has its configuration and some DLC have dedicated functions, +for example GPS), starting with minor 1 (DLC0 is reserved for the management +of the mux) + +MAJOR=`cat /proc/devices |grep gsmtty | awk '{print $1}` +for i in `seq 1 4`; do + mknod /dev/ttygsm$i c $MAJOR $i +done + +5- use these devices as plain serial ports. +for example, it's possible : +- and to use gnokii to send / receive SMS on ttygsm1 +- to use ppp to establish a datalink on ttygsm2 + +6- first close all virtual ports before closing the physical port. + +Additional Documentation +------------------------ +More practical details on the protocol and how it's supported by industrial +modems can be found in the following documents : +http://www.telit.com/module/infopool/download.php?id=616 +http://www.u-blox.com/images/downloads/Product_Docs/LEON-G100-G200-MuxImplementation_ApplicationNote_%28GSM%20G1-CS-10002%29.pdf +http://www.sierrawireless.com/Support/Downloads/AirPrime/WMP_Series/~/media/Support_Downloads/AirPrime/Application_notes/CMUX_Feature_Application_Note-Rev004.ashx +http://wm.sim.com/sim/News/photo/2010721161442.pdf + +11-03-08 - Eric Bénard - From ed43b47b29bce303f86e1bff69b6f9924f5afcc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20B=C3=A9nard?= Date: Wed, 9 Mar 2011 19:24:49 +0100 Subject: [PATCH 74/76] n_gsm: fix UIH control byte : P bit should be 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * the GSM 07.10 specification says in 5.4.3.1 that 'both stations shall set the P bit to 0' thanks to Alan Cox for finding this explanation in the spec * without this fix, on Telit & Sim.com modems, opening a new DLC randomly fails. Not setting PF bit of the control byte gives a reliable behaviour on these modems. Signed-off-by: Eric Bénard Cc: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/tty/n_gsm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 0d90be48463d..176f63256b37 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1250,8 +1250,7 @@ static void gsm_control_response(struct gsm_mux *gsm, unsigned int command, static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control *ctrl) { - struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, - gsm->ftype|PF); + struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, gsm->ftype); if (msg == NULL) return; msg->data[0] = (ctrl->cmd << 1) | 2 | EA; /* command */ From 1a738dcf6dac74a0ce10853a068d822f66f73268 Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Wed, 22 Dec 2010 21:04:11 +0900 Subject: [PATCH 75/76] pch_phub: add new device ML7213 Add ML7213 device information. ML7213 is companion chip of Intel Atom E6xx series for IVI(In-Vehicle Infotainment). ML7213 is completely compatible for Intel EG20T PCH. Signed-off-by: Tomoya MORINAGA Signed-off-by: Greg Kroah-Hartman --- drivers/misc/Kconfig | 7 ++++- drivers/misc/pch_phub.c | 69 ++++++++++++++++++++++++++++------------- 2 files changed, 53 insertions(+), 23 deletions(-) diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index cc8e49db45fe..b7d5ef234ac9 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -441,7 +441,7 @@ config BMP085 module will be called bmp085. config PCH_PHUB - tristate "PCH Packet Hub of Intel Topcliff" + tristate "PCH Packet Hub of Intel Topcliff / OKI SEMICONDUCTOR ML7213" depends on PCI help This driver is for PCH(Platform controller Hub) PHUB(Packet Hub) of @@ -449,6 +449,11 @@ config PCH_PHUB processor. The Topcliff has MAC address and Option ROM data in SROM. This driver can access MAC address and Option ROM data in SROM. + This driver also can be used for OKI SEMICONDUCTOR's ML7213 which is + for IVI(In-Vehicle Infotainment) use. + ML7213 is companion chip for Intel Atom E6xx series. + ML7213 is completely compatible for Intel EG20T PCH. + To compile this driver as a module, choose M here: the module will be called pch_phub. diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c index 744b804aca15..98bffc471b17 100644 --- a/drivers/misc/pch_phub.c +++ b/drivers/misc/pch_phub.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 OKI SEMICONDUCTOR Co., LTD. + * Copyright (C) 2010 OKI SEMICONDUCTOR CO., LTD. * * 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 @@ -33,7 +33,12 @@ #define PHUB_TIMEOUT 0x05 /* Time out value for Status Register */ #define PCH_PHUB_ROM_WRITE_ENABLE 0x01 /* Enabling for writing ROM */ #define PCH_PHUB_ROM_WRITE_DISABLE 0x00 /* Disabling for writing ROM */ -#define PCH_PHUB_ROM_START_ADDR 0x14 /* ROM data area start address offset */ +#define PCH_PHUB_MAC_START_ADDR 0x20C /* MAC data area start address offset */ +#define PCH_PHUB_ROM_START_ADDR_EG20T 0x14 /* ROM data area start address offset + (Intel EG20T PCH)*/ +#define PCH_PHUB_ROM_START_ADDR_ML7213 0x400 /* ROM data area start address + offset(OKI SEMICONDUCTOR ML7213) + */ /* MAX number of INT_REDUCE_CONTROL registers */ #define MAX_NUM_INT_REDUCE_CONTROL_REG 128 @@ -42,6 +47,10 @@ #define CLKCFG_CAN_50MHZ 0x12000000 #define CLKCFG_CANCLK_MASK 0xFF000000 +/* Macros for ML7213 */ +#define PCI_VENDOR_ID_ROHM 0x10db +#define PCI_DEVICE_ID_ROHM_ML7213_PHUB 0x801A + /* SROM ACCESS Macro */ #define PCH_WORD_ADDR_MASK (~((1 << 2) - 1)) @@ -298,7 +307,7 @@ static void pch_phub_read_serial_rom_val(struct pch_phub_reg *chip, { unsigned int mem_addr; - mem_addr = PCH_PHUB_ROM_START_ADDR + + mem_addr = PCH_PHUB_ROM_START_ADDR_EG20T + pch_phub_mac_offset[offset_address]; pch_phub_read_serial_rom(chip, mem_addr, data); @@ -315,7 +324,7 @@ static int pch_phub_write_serial_rom_val(struct pch_phub_reg *chip, int retval; unsigned int mem_addr; - mem_addr = PCH_PHUB_ROM_START_ADDR + + mem_addr = PCH_PHUB_ROM_START_ADDR_EG20T + pch_phub_mac_offset[offset_address]; retval = pch_phub_write_serial_rom(chip, mem_addr, data); @@ -594,24 +603,39 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev, "pch_phub_extrom_base_address variable is %p\n", __func__, chip->pch_phub_extrom_base_address); + if (id->driver_data == 1) { + retval = sysfs_create_file(&pdev->dev.kobj, + &dev_attr_pch_mac.attr); + if (retval) + goto err_sysfs_create; + + retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); + if (retval) + goto exit_bin_attr; + + pch_phub_read_modify_write_reg(chip, + (unsigned int)CLKCFG_REG_OFFSET, + CLKCFG_CAN_50MHZ, + CLKCFG_CANCLK_MASK); + + /* set the prefech value */ + iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14); + /* set the interrupt delay value */ + iowrite32(0x25, chip->pch_phub_base_address + 0x44); + } else if (id->driver_data == 2) { + retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); + if (retval) + goto err_sysfs_create; + /* set the prefech value + * Device2(USB OHCI #1/ USB EHCI #1/ USB Device):a + * Device4(SDIO #0,1,2):f + * Device6(SATA 2):f + * Device8(USB OHCI #0/ USB EHCI #0):a + */ + iowrite32(0x000affa0, chip->pch_phub_base_address + 0x14); + } pci_set_drvdata(pdev, chip); - retval = sysfs_create_file(&pdev->dev.kobj, &dev_attr_pch_mac.attr); - if (retval) - goto err_sysfs_create; - - retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); - if (retval) - goto exit_bin_attr; - - pch_phub_read_modify_write_reg(chip, (unsigned int)CLKCFG_REG_OFFSET, - CLKCFG_CAN_50MHZ, CLKCFG_CANCLK_MASK); - - /* set the prefech value */ - iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14); - /* set the interrupt delay value */ - iowrite32(0x25, chip->pch_phub_base_address + 0x44); - return 0; exit_bin_attr: sysfs_remove_file(&pdev->dev.kobj, &dev_attr_pch_mac.attr); @@ -687,8 +711,9 @@ static int pch_phub_resume(struct pci_dev *pdev) #endif /* CONFIG_PM */ static struct pci_device_id pch_phub_pcidev_id[] = { - {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PCH1_PHUB)}, - {0,} + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PCH1_PHUB), 1, }, + { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7213_PHUB), 2, }, + { } }; static struct pci_driver pch_phub_driver = { From 6ae705b23be8da52d3163be9d81e9b767876aaf9 Mon Sep 17 00:00:00 2001 From: Denis Turischev Date: Thu, 10 Mar 2011 15:14:00 +0200 Subject: [PATCH 76/76] pch_uart: reference clock on CM-iTC Default clock source for UARTs on Topcliff is external UART_CLK. On CM-iTC USB_48MHz is used instead. After VCO2PLL and DIV manipulations UARTs will receive 192 MHz. Clock manipulations on Topcliff are controlled in pch_phub.c v2: redone against the linux-next tree v3: redone against linux/kernel/git/next/linux-next.git snapshot Signed-off-by: Denis Turischev Signed-off-by: Greg Kroah-Hartman --- drivers/misc/pch_phub.c | 16 ++++++++++++++++ drivers/tty/serial/pch_uart.c | 9 +++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c index 98bffc471b17..5dd0b921bfc6 100644 --- a/drivers/misc/pch_phub.c +++ b/drivers/misc/pch_phub.c @@ -27,6 +27,7 @@ #include #include #include +#include #define PHUB_STATUS 0x00 /* Status Register offset */ #define PHUB_CONTROL 0x04 /* Control Register offset */ @@ -46,6 +47,13 @@ #define PCH_MINOR_NOS 1 #define CLKCFG_CAN_50MHZ 0x12000000 #define CLKCFG_CANCLK_MASK 0xFF000000 +#define CLKCFG_UART_MASK 0xFFFFFF + +/* CM-iTC */ +#define CLKCFG_UART_48MHZ (1 << 16) +#define CLKCFG_BAUDDIV (2 << 20) +#define CLKCFG_PLL2VCO (8 << 9) +#define CLKCFG_UARTCLKSEL (1 << 18) /* Macros for ML7213 */ #define PCI_VENDOR_ID_ROHM 0x10db @@ -618,6 +626,14 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev, CLKCFG_CAN_50MHZ, CLKCFG_CANCLK_MASK); + /* quirk for CM-iTC board */ + if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC")) + pch_phub_read_modify_write_reg(chip, + (unsigned int)CLKCFG_REG_OFFSET, + CLKCFG_UART_48MHZ | CLKCFG_BAUDDIV | + CLKCFG_PLL2VCO | CLKCFG_UARTCLKSEL, + CLKCFG_UART_MASK); + /* set the prefech value */ iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14); /* set the interrupt delay value */ diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index a5ce9a5c018d..a9ad7f33526d 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -1404,14 +1405,18 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, if (!rxbuf) goto init_port_free_txbuf; + base_baud = 1843200; /* 1.8432MHz */ + + /* quirk for CM-iTC board */ + if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC")) + base_baud = 192000000; /* 192.0MHz */ + switch (port_type) { case PORT_UNKNOWN: fifosize = 256; /* EG20T/ML7213: UART0 */ - base_baud = 1843200; /* 1.8432MHz */ break; case PORT_8250: fifosize = 64; /* EG20T:UART1~3 ML7213: UART1~2*/ - base_baud = 1843200; /* 1.8432MHz */ break; default: dev_err(&pdev->dev, "Invalid Port Type(=%d)\n", port_type);