aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/ehv_bytechan.c1
-rw-r--r--drivers/tty/mxser.c11
-rw-r--r--drivers/tty/n_tty.c8
-rw-r--r--drivers/tty/rocket.c288
-rw-r--r--drivers/tty/serial/8250/8250_dw.c7
-rw-r--r--drivers/tty/serial/amba-pl011.c2
-rw-r--r--drivers/tty/serial/mcf.c4
-rw-r--r--drivers/tty/serial/mpc52xx_uart.c11
-rw-r--r--drivers/tty/serial/nwpserial.c2
-rw-r--r--drivers/tty/serial/omap-serial.c23
-rw-r--r--drivers/tty/serial/samsung.c1
-rw-r--r--drivers/tty/vt/vt.c14
-rw-r--r--drivers/tty/vt/vt_ioctl.c67
13 files changed, 233 insertions, 206 deletions
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
index 6d0c27cd03da..9bffcec5ad82 100644
--- a/drivers/tty/ehv_bytechan.c
+++ b/drivers/tty/ehv_bytechan.c
@@ -859,6 +859,7 @@ error:
859 */ 859 */
860static void __exit ehv_bc_exit(void) 860static void __exit ehv_bc_exit(void)
861{ 861{
862 platform_driver_unregister(&ehv_bc_tty_driver);
862 tty_unregister_driver(ehv_bc_driver); 863 tty_unregister_driver(ehv_bc_driver);
863 put_tty_driver(ehv_bc_driver); 864 put_tty_driver(ehv_bc_driver);
864 kfree(bcs); 865 kfree(bcs);
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 71d6eb2c93b1..4c4a23674569 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -1618,8 +1618,12 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
1618 if (ip->type == PORT_16550A) 1618 if (ip->type == PORT_16550A)
1619 me->fifo[p] = 1; 1619 me->fifo[p] = 1;
1620 1620
1621 opmode = inb(ip->opmode_ioaddr)>>((p % 4) * 2); 1621 if (ip->board->chip_flag == MOXA_MUST_MU860_HWID) {
1622 opmode &= OP_MODE_MASK; 1622 opmode = inb(ip->opmode_ioaddr)>>((p % 4) * 2);
1623 opmode &= OP_MODE_MASK;
1624 } else {
1625 opmode = RS232_MODE;
1626 }
1623 me->iftype[p] = opmode; 1627 me->iftype[p] = opmode;
1624 mutex_unlock(&port->mutex); 1628 mutex_unlock(&port->mutex);
1625 } 1629 }
@@ -1676,6 +1680,9 @@ static int mxser_ioctl(struct tty_struct *tty,
1676 int shiftbit; 1680 int shiftbit;
1677 unsigned char val, mask; 1681 unsigned char val, mask;
1678 1682
1683 if (info->board->chip_flag != MOXA_MUST_MU860_HWID)
1684 return -EFAULT;
1685
1679 p = tty->index % 4; 1686 p = tty->index % 4;
1680 if (cmd == MOXA_SET_OP_MODE) { 1687 if (cmd == MOXA_SET_OP_MODE) {
1681 if (get_user(opmode, (int __user *) argp)) 1688 if (get_user(opmode, (int __user *) argp))
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index d655416087b7..6c7fe90ad72d 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1573,6 +1573,14 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
1573 ldata->real_raw = 0; 1573 ldata->real_raw = 0;
1574 } 1574 }
1575 n_tty_set_room(tty); 1575 n_tty_set_room(tty);
1576 /*
1577 * Fix tty hang when I_IXON(tty) is cleared, but the tty
1578 * been stopped by STOP_CHAR(tty) before it.
1579 */
1580 if (!I_IXON(tty) && old && (old->c_iflag & IXON) && !tty->flow_stopped) {
1581 start_tty(tty);
1582 }
1583
1576 /* The termios change make the tty ready for I/O */ 1584 /* The termios change make the tty ready for I/O */
1577 wake_up_interruptible(&tty->write_wait); 1585 wake_up_interruptible(&tty->write_wait);
1578 wake_up_interruptible(&tty->read_wait); 1586 wake_up_interruptible(&tty->read_wait);
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 82d35c5a58fd..354564ea47c5 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -150,12 +150,14 @@ static Word_t aiop_intr_bits[AIOP_CTL_SIZE] = {
150 AIOP_INTR_BIT_3 150 AIOP_INTR_BIT_3
151}; 151};
152 152
153#ifdef CONFIG_PCI
153static Word_t upci_aiop_intr_bits[AIOP_CTL_SIZE] = { 154static Word_t upci_aiop_intr_bits[AIOP_CTL_SIZE] = {
154 UPCI_AIOP_INTR_BIT_0, 155 UPCI_AIOP_INTR_BIT_0,
155 UPCI_AIOP_INTR_BIT_1, 156 UPCI_AIOP_INTR_BIT_1,
156 UPCI_AIOP_INTR_BIT_2, 157 UPCI_AIOP_INTR_BIT_2,
157 UPCI_AIOP_INTR_BIT_3 158 UPCI_AIOP_INTR_BIT_3
158}; 159};
160#endif
159 161
160static Byte_t RData[RDATASIZE] = { 162static Byte_t RData[RDATASIZE] = {
161 0x00, 0x09, 0xf6, 0x82, 163 0x00, 0x09, 0xf6, 0x82,
@@ -227,7 +229,6 @@ static unsigned long nextLineNumber;
227static int __init init_ISA(int i); 229static int __init init_ISA(int i);
228static void rp_wait_until_sent(struct tty_struct *tty, int timeout); 230static void rp_wait_until_sent(struct tty_struct *tty, int timeout);
229static void rp_flush_buffer(struct tty_struct *tty); 231static void rp_flush_buffer(struct tty_struct *tty);
230static void rmSpeakerReset(CONTROLLER_T * CtlP, unsigned long model);
231static unsigned char GetLineNumber(int ctrl, int aiop, int ch); 232static unsigned char GetLineNumber(int ctrl, int aiop, int ch);
232static unsigned char SetLineNumber(int ctrl, int aiop, int ch); 233static unsigned char SetLineNumber(int ctrl, int aiop, int ch);
233static void rp_start(struct tty_struct *tty); 234static void rp_start(struct tty_struct *tty);
@@ -241,11 +242,6 @@ static void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags);
241static void sModemReset(CONTROLLER_T * CtlP, int chan, int on); 242static void sModemReset(CONTROLLER_T * CtlP, int chan, int on);
242static void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on); 243static void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on);
243static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data); 244static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data);
244static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum,
245 ByteIO_t * AiopIOList, int AiopIOListSize,
246 WordIO_t ConfigIO, int IRQNum, Byte_t Frequency,
247 int PeriodicOnly, int altChanRingIndicator,
248 int UPCIRingInd);
249static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO, 245static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO,
250 ByteIO_t * AiopIOList, int AiopIOListSize, 246 ByteIO_t * AiopIOList, int AiopIOListSize,
251 int IRQNum, Byte_t Frequency, int PeriodicOnly); 247 int IRQNum, Byte_t Frequency, int PeriodicOnly);
@@ -1775,6 +1771,145 @@ static DEFINE_PCI_DEVICE_TABLE(rocket_pci_ids) = {
1775}; 1771};
1776MODULE_DEVICE_TABLE(pci, rocket_pci_ids); 1772MODULE_DEVICE_TABLE(pci, rocket_pci_ids);
1777 1773
1774/* Resets the speaker controller on RocketModem II and III devices */
1775static void rmSpeakerReset(CONTROLLER_T * CtlP, unsigned long model)
1776{
1777 ByteIO_t addr;
1778
1779 /* RocketModem II speaker control is at the 8th port location of offset 0x40 */
1780 if ((model == MODEL_RP4M) || (model == MODEL_RP6M)) {
1781 addr = CtlP->AiopIO[0] + 0x4F;
1782 sOutB(addr, 0);
1783 }
1784
1785 /* RocketModem III speaker control is at the 1st port location of offset 0x80 */
1786 if ((model == MODEL_UPCI_RM3_8PORT)
1787 || (model == MODEL_UPCI_RM3_4PORT)) {
1788 addr = CtlP->AiopIO[0] + 0x88;
1789 sOutB(addr, 0);
1790 }
1791}
1792
1793/***************************************************************************
1794Function: sPCIInitController
1795Purpose: Initialization of controller global registers and controller
1796 structure.
1797Call: sPCIInitController(CtlP,CtlNum,AiopIOList,AiopIOListSize,
1798 IRQNum,Frequency,PeriodicOnly)
1799 CONTROLLER_T *CtlP; Ptr to controller structure
1800 int CtlNum; Controller number
1801 ByteIO_t *AiopIOList; List of I/O addresses for each AIOP.
1802 This list must be in the order the AIOPs will be found on the
1803 controller. Once an AIOP in the list is not found, it is
1804 assumed that there are no more AIOPs on the controller.
1805 int AiopIOListSize; Number of addresses in AiopIOList
1806 int IRQNum; Interrupt Request number. Can be any of the following:
1807 0: Disable global interrupts
1808 3: IRQ 3
1809 4: IRQ 4
1810 5: IRQ 5
1811 9: IRQ 9
1812 10: IRQ 10
1813 11: IRQ 11
1814 12: IRQ 12
1815 15: IRQ 15
1816 Byte_t Frequency: A flag identifying the frequency
1817 of the periodic interrupt, can be any one of the following:
1818 FREQ_DIS - periodic interrupt disabled
1819 FREQ_137HZ - 137 Hertz
1820 FREQ_69HZ - 69 Hertz
1821 FREQ_34HZ - 34 Hertz
1822 FREQ_17HZ - 17 Hertz
1823 FREQ_9HZ - 9 Hertz
1824 FREQ_4HZ - 4 Hertz
1825 If IRQNum is set to 0 the Frequency parameter is
1826 overidden, it is forced to a value of FREQ_DIS.
1827 int PeriodicOnly: 1 if all interrupts except the periodic
1828 interrupt are to be blocked.
1829 0 is both the periodic interrupt and
1830 other channel interrupts are allowed.
1831 If IRQNum is set to 0 the PeriodicOnly parameter is
1832 overidden, it is forced to a value of 0.
1833Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller
1834 initialization failed.
1835
1836Comments:
1837 If periodic interrupts are to be disabled but AIOP interrupts
1838 are allowed, set Frequency to FREQ_DIS and PeriodicOnly to 0.
1839
1840 If interrupts are to be completely disabled set IRQNum to 0.
1841
1842 Setting Frequency to FREQ_DIS and PeriodicOnly to 1 is an
1843 invalid combination.
1844
1845 This function performs initialization of global interrupt modes,
1846 but it does not actually enable global interrupts. To enable
1847 and disable global interrupts use functions sEnGlobalInt() and
1848 sDisGlobalInt(). Enabling of global interrupts is normally not
1849 done until all other initializations are complete.
1850
1851 Even if interrupts are globally enabled, they must also be
1852 individually enabled for each channel that is to generate
1853 interrupts.
1854
1855Warnings: No range checking on any of the parameters is done.
1856
1857 No context switches are allowed while executing this function.
1858
1859 After this function all AIOPs on the controller are disabled,
1860 they can be enabled with sEnAiop().
1861*/
1862static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum,
1863 ByteIO_t * AiopIOList, int AiopIOListSize,
1864 WordIO_t ConfigIO, int IRQNum, Byte_t Frequency,
1865 int PeriodicOnly, int altChanRingIndicator,
1866 int UPCIRingInd)
1867{
1868 int i;
1869 ByteIO_t io;
1870
1871 CtlP->AltChanRingIndicator = altChanRingIndicator;
1872 CtlP->UPCIRingInd = UPCIRingInd;
1873 CtlP->CtlNum = CtlNum;
1874 CtlP->CtlID = CTLID_0001; /* controller release 1 */
1875 CtlP->BusType = isPCI; /* controller release 1 */
1876
1877 if (ConfigIO) {
1878 CtlP->isUPCI = 1;
1879 CtlP->PCIIO = ConfigIO + _PCI_9030_INT_CTRL;
1880 CtlP->PCIIO2 = ConfigIO + _PCI_9030_GPIO_CTRL;
1881 CtlP->AiopIntrBits = upci_aiop_intr_bits;
1882 } else {
1883 CtlP->isUPCI = 0;
1884 CtlP->PCIIO =
1885 (WordIO_t) ((ByteIO_t) AiopIOList[0] + _PCI_INT_FUNC);
1886 CtlP->AiopIntrBits = aiop_intr_bits;
1887 }
1888
1889 sPCIControllerEOI(CtlP); /* clear EOI if warm init */
1890 /* Init AIOPs */
1891 CtlP->NumAiop = 0;
1892 for (i = 0; i < AiopIOListSize; i++) {
1893 io = AiopIOList[i];
1894 CtlP->AiopIO[i] = (WordIO_t) io;
1895 CtlP->AiopIntChanIO[i] = io + _INT_CHAN;
1896
1897 CtlP->AiopID[i] = sReadAiopID(io); /* read AIOP ID */
1898 if (CtlP->AiopID[i] == AIOPID_NULL) /* if AIOP does not exist */
1899 break; /* done looking for AIOPs */
1900
1901 CtlP->AiopNumChan[i] = sReadAiopNumChan((WordIO_t) io); /* num channels in AIOP */
1902 sOutW((WordIO_t) io + _INDX_ADDR, _CLK_PRE); /* clock prescaler */
1903 sOutB(io + _INDX_DATA, sClockPrescale);
1904 CtlP->NumAiop++; /* bump count of AIOPs */
1905 }
1906
1907 if (CtlP->NumAiop == 0)
1908 return (-1);
1909 else
1910 return (CtlP->NumAiop);
1911}
1912
1778/* 1913/*
1779 * Called when a PCI card is found. Retrieves and stores model information, 1914 * Called when a PCI card is found. Retrieves and stores model information,
1780 * init's aiopic and serial port hardware. 1915 * init's aiopic and serial port hardware.
@@ -2519,147 +2654,6 @@ static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO,
2519 return (CtlP->NumAiop); 2654 return (CtlP->NumAiop);
2520} 2655}
2521 2656
2522#ifdef CONFIG_PCI
2523/***************************************************************************
2524Function: sPCIInitController
2525Purpose: Initialization of controller global registers and controller
2526 structure.
2527Call: sPCIInitController(CtlP,CtlNum,AiopIOList,AiopIOListSize,
2528 IRQNum,Frequency,PeriodicOnly)
2529 CONTROLLER_T *CtlP; Ptr to controller structure
2530 int CtlNum; Controller number
2531 ByteIO_t *AiopIOList; List of I/O addresses for each AIOP.
2532 This list must be in the order the AIOPs will be found on the
2533 controller. Once an AIOP in the list is not found, it is
2534 assumed that there are no more AIOPs on the controller.
2535 int AiopIOListSize; Number of addresses in AiopIOList
2536 int IRQNum; Interrupt Request number. Can be any of the following:
2537 0: Disable global interrupts
2538 3: IRQ 3
2539 4: IRQ 4
2540 5: IRQ 5
2541 9: IRQ 9
2542 10: IRQ 10
2543 11: IRQ 11
2544 12: IRQ 12
2545 15: IRQ 15
2546 Byte_t Frequency: A flag identifying the frequency
2547 of the periodic interrupt, can be any one of the following:
2548 FREQ_DIS - periodic interrupt disabled
2549 FREQ_137HZ - 137 Hertz
2550 FREQ_69HZ - 69 Hertz
2551 FREQ_34HZ - 34 Hertz
2552 FREQ_17HZ - 17 Hertz
2553 FREQ_9HZ - 9 Hertz
2554 FREQ_4HZ - 4 Hertz
2555 If IRQNum is set to 0 the Frequency parameter is
2556 overidden, it is forced to a value of FREQ_DIS.
2557 int PeriodicOnly: 1 if all interrupts except the periodic
2558 interrupt are to be blocked.
2559 0 is both the periodic interrupt and
2560 other channel interrupts are allowed.
2561 If IRQNum is set to 0 the PeriodicOnly parameter is
2562 overidden, it is forced to a value of 0.
2563Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller
2564 initialization failed.
2565
2566Comments:
2567 If periodic interrupts are to be disabled but AIOP interrupts
2568 are allowed, set Frequency to FREQ_DIS and PeriodicOnly to 0.
2569
2570 If interrupts are to be completely disabled set IRQNum to 0.
2571
2572 Setting Frequency to FREQ_DIS and PeriodicOnly to 1 is an
2573 invalid combination.
2574
2575 This function performs initialization of global interrupt modes,
2576 but it does not actually enable global interrupts. To enable
2577 and disable global interrupts use functions sEnGlobalInt() and
2578 sDisGlobalInt(). Enabling of global interrupts is normally not
2579 done until all other initializations are complete.
2580
2581 Even if interrupts are globally enabled, they must also be
2582 individually enabled for each channel that is to generate
2583 interrupts.
2584
2585Warnings: No range checking on any of the parameters is done.
2586
2587 No context switches are allowed while executing this function.
2588
2589 After this function all AIOPs on the controller are disabled,
2590 they can be enabled with sEnAiop().
2591*/
2592static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum,
2593 ByteIO_t * AiopIOList, int AiopIOListSize,
2594 WordIO_t ConfigIO, int IRQNum, Byte_t Frequency,
2595 int PeriodicOnly, int altChanRingIndicator,
2596 int UPCIRingInd)
2597{
2598 int i;
2599 ByteIO_t io;
2600
2601 CtlP->AltChanRingIndicator = altChanRingIndicator;
2602 CtlP->UPCIRingInd = UPCIRingInd;
2603 CtlP->CtlNum = CtlNum;
2604 CtlP->CtlID = CTLID_0001; /* controller release 1 */
2605 CtlP->BusType = isPCI; /* controller release 1 */
2606
2607 if (ConfigIO) {
2608 CtlP->isUPCI = 1;
2609 CtlP->PCIIO = ConfigIO + _PCI_9030_INT_CTRL;
2610 CtlP->PCIIO2 = ConfigIO + _PCI_9030_GPIO_CTRL;
2611 CtlP->AiopIntrBits = upci_aiop_intr_bits;
2612 } else {
2613 CtlP->isUPCI = 0;
2614 CtlP->PCIIO =
2615 (WordIO_t) ((ByteIO_t) AiopIOList[0] + _PCI_INT_FUNC);
2616 CtlP->AiopIntrBits = aiop_intr_bits;
2617 }
2618
2619 sPCIControllerEOI(CtlP); /* clear EOI if warm init */
2620 /* Init AIOPs */
2621 CtlP->NumAiop = 0;
2622 for (i = 0; i < AiopIOListSize; i++) {
2623 io = AiopIOList[i];
2624 CtlP->AiopIO[i] = (WordIO_t) io;
2625 CtlP->AiopIntChanIO[i] = io + _INT_CHAN;
2626
2627 CtlP->AiopID[i] = sReadAiopID(io); /* read AIOP ID */
2628 if (CtlP->AiopID[i] == AIOPID_NULL) /* if AIOP does not exist */
2629 break; /* done looking for AIOPs */
2630
2631 CtlP->AiopNumChan[i] = sReadAiopNumChan((WordIO_t) io); /* num channels in AIOP */
2632 sOutW((WordIO_t) io + _INDX_ADDR, _CLK_PRE); /* clock prescaler */
2633 sOutB(io + _INDX_DATA, sClockPrescale);
2634 CtlP->NumAiop++; /* bump count of AIOPs */
2635 }
2636
2637 if (CtlP->NumAiop == 0)
2638 return (-1);
2639 else
2640 return (CtlP->NumAiop);
2641}
2642
2643/* Resets the speaker controller on RocketModem II and III devices */
2644static void rmSpeakerReset(CONTROLLER_T * CtlP, unsigned long model)
2645{
2646 ByteIO_t addr;
2647
2648 /* RocketModem II speaker control is at the 8th port location of offset 0x40 */
2649 if ((model == MODEL_RP4M) || (model == MODEL_RP6M)) {
2650 addr = CtlP->AiopIO[0] + 0x4F;
2651 sOutB(addr, 0);
2652 }
2653
2654 /* RocketModem III speaker control is at the 1st port location of offset 0x80 */
2655 if ((model == MODEL_UPCI_RM3_8PORT)
2656 || (model == MODEL_UPCI_RM3_4PORT)) {
2657 addr = CtlP->AiopIO[0] + 0x88;
2658 sOutB(addr, 0);
2659 }
2660}
2661#endif
2662
2663/*************************************************************************** 2657/***************************************************************************
2664Function: sReadAiopID 2658Function: sReadAiopID
2665Purpose: Read the AIOP idenfication number directly from an AIOP. 2659Purpose: Read the AIOP idenfication number directly from an AIOP.
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index beaa283f5cc6..d07b6af3a937 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -338,7 +338,8 @@ static int dw8250_runtime_suspend(struct device *dev)
338{ 338{
339 struct dw8250_data *data = dev_get_drvdata(dev); 339 struct dw8250_data *data = dev_get_drvdata(dev);
340 340
341 clk_disable_unprepare(data->clk); 341 if (!IS_ERR(data->clk))
342 clk_disable_unprepare(data->clk);
342 343
343 return 0; 344 return 0;
344} 345}
@@ -347,7 +348,8 @@ static int dw8250_runtime_resume(struct device *dev)
347{ 348{
348 struct dw8250_data *data = dev_get_drvdata(dev); 349 struct dw8250_data *data = dev_get_drvdata(dev);
349 350
350 clk_prepare_enable(data->clk); 351 if (!IS_ERR(data->clk))
352 clk_prepare_enable(data->clk);
351 353
352 return 0; 354 return 0;
353} 355}
@@ -367,6 +369,7 @@ MODULE_DEVICE_TABLE(of, dw8250_of_match);
367static const struct acpi_device_id dw8250_acpi_match[] = { 369static const struct acpi_device_id dw8250_acpi_match[] = {
368 { "INT33C4", 0 }, 370 { "INT33C4", 0 },
369 { "INT33C5", 0 }, 371 { "INT33C5", 0 },
372 { "80860F0A", 0 },
370 { }, 373 { },
371}; 374};
372MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); 375MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match);
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 8ab70a620919..e2774f9ecd59 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -332,7 +332,7 @@ static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port *
332 dmaengine_slave_config(chan, &rx_conf); 332 dmaengine_slave_config(chan, &rx_conf);
333 uap->dmarx.chan = chan; 333 uap->dmarx.chan = chan;
334 334
335 if (plat->dma_rx_poll_enable) { 335 if (plat && plat->dma_rx_poll_enable) {
336 /* Set poll rate if specified. */ 336 /* Set poll rate if specified. */
337 if (plat->dma_rx_poll_rate) { 337 if (plat->dma_rx_poll_rate) {
338 uap->dmarx.auto_poll_rate = false; 338 uap->dmarx.auto_poll_rate = false;
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c
index e956377a38fe..65be0c00c4bf 100644
--- a/drivers/tty/serial/mcf.c
+++ b/drivers/tty/serial/mcf.c
@@ -707,8 +707,10 @@ static int __init mcf_init(void)
707 if (rc) 707 if (rc)
708 return rc; 708 return rc;
709 rc = platform_driver_register(&mcf_platform_driver); 709 rc = platform_driver_register(&mcf_platform_driver);
710 if (rc) 710 if (rc) {
711 uart_unregister_driver(&mcf_driver);
711 return rc; 712 return rc;
713 }
712 return 0; 714 return 0;
713} 715}
714 716
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index 018bad922554..f51b280f3bf2 100644
--- a/drivers/tty/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
@@ -1497,18 +1497,23 @@ mpc52xx_uart_init(void)
1497 if (psc_ops && psc_ops->fifoc_init) { 1497 if (psc_ops && psc_ops->fifoc_init) {
1498 ret = psc_ops->fifoc_init(); 1498 ret = psc_ops->fifoc_init();
1499 if (ret) 1499 if (ret)
1500 return ret; 1500 goto err_init;
1501 } 1501 }
1502 1502
1503 ret = platform_driver_register(&mpc52xx_uart_of_driver); 1503 ret = platform_driver_register(&mpc52xx_uart_of_driver);
1504 if (ret) { 1504 if (ret) {
1505 printk(KERN_ERR "%s: platform_driver_register failed (%i)\n", 1505 printk(KERN_ERR "%s: platform_driver_register failed (%i)\n",
1506 __FILE__, ret); 1506 __FILE__, ret);
1507 uart_unregister_driver(&mpc52xx_uart_driver); 1507 goto err_reg;
1508 return ret;
1509 } 1508 }
1510 1509
1511 return 0; 1510 return 0;
1511err_reg:
1512 if (psc_ops && psc_ops->fifoc_uninit)
1513 psc_ops->fifoc_uninit();
1514err_init:
1515 uart_unregister_driver(&mpc52xx_uart_driver);
1516 return ret;
1512} 1517}
1513 1518
1514static void __exit 1519static void __exit
diff --git a/drivers/tty/serial/nwpserial.c b/drivers/tty/serial/nwpserial.c
index 77287c54f331..549c70a2a63e 100644
--- a/drivers/tty/serial/nwpserial.c
+++ b/drivers/tty/serial/nwpserial.c
@@ -199,7 +199,7 @@ static void nwpserial_shutdown(struct uart_port *port)
199 dcr_write(up->dcr_host, UART_IER, up->ier); 199 dcr_write(up->dcr_host, UART_IER, up->ier);
200 200
201 /* free irq */ 201 /* free irq */
202 free_irq(up->port.irq, port); 202 free_irq(up->port.irq, up);
203} 203}
204 204
205static int nwpserial_verify_port(struct uart_port *port, 205static int nwpserial_verify_port(struct uart_port *port,
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 30d4f7a783cd..f0b9f6b52b32 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -202,26 +202,6 @@ static int serial_omap_get_context_loss_count(struct uart_omap_port *up)
202 return pdata->get_context_loss_count(up->dev); 202 return pdata->get_context_loss_count(up->dev);
203} 203}
204 204
205static void serial_omap_set_forceidle(struct uart_omap_port *up)
206{
207 struct omap_uart_port_info *pdata = up->dev->platform_data;
208
209 if (!pdata || !pdata->set_forceidle)
210 return;
211
212 pdata->set_forceidle(up->dev);
213}
214
215static void serial_omap_set_noidle(struct uart_omap_port *up)
216{
217 struct omap_uart_port_info *pdata = up->dev->platform_data;
218
219 if (!pdata || !pdata->set_noidle)
220 return;
221
222 pdata->set_noidle(up->dev);
223}
224
225static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable) 205static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable)
226{ 206{
227 struct omap_uart_port_info *pdata = up->dev->platform_data; 207 struct omap_uart_port_info *pdata = up->dev->platform_data;
@@ -298,8 +278,6 @@ static void serial_omap_stop_tx(struct uart_port *port)
298 serial_out(up, UART_IER, up->ier); 278 serial_out(up, UART_IER, up->ier);
299 } 279 }
300 280
301 serial_omap_set_forceidle(up);
302
303 pm_runtime_mark_last_busy(up->dev); 281 pm_runtime_mark_last_busy(up->dev);
304 pm_runtime_put_autosuspend(up->dev); 282 pm_runtime_put_autosuspend(up->dev);
305} 283}
@@ -364,7 +342,6 @@ static void serial_omap_start_tx(struct uart_port *port)
364 342
365 pm_runtime_get_sync(up->dev); 343 pm_runtime_get_sync(up->dev);
366 serial_omap_enable_ier_thri(up); 344 serial_omap_enable_ier_thri(up);
367 serial_omap_set_noidle(up);
368 pm_runtime_mark_last_busy(up->dev); 345 pm_runtime_mark_last_busy(up->dev);
369 pm_runtime_put_autosuspend(up->dev); 346 pm_runtime_put_autosuspend(up->dev);
370} 347}
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 074b9194144f..89429410a245 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1803,6 +1803,7 @@ static int __init s3c24xx_serial_modinit(void)
1803 1803
1804static void __exit s3c24xx_serial_modexit(void) 1804static void __exit s3c24xx_serial_modexit(void)
1805{ 1805{
1806 platform_driver_unregister(&samsung_serial_driver);
1806 uart_unregister_driver(&s3c24xx_uart_drv); 1807 uart_unregister_driver(&s3c24xx_uart_drv);
1807} 1808}
1808 1809
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index fbd447b390f7..740202d8a5c4 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -779,7 +779,6 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
779 con_set_default_unimap(vc); 779 con_set_default_unimap(vc);
780 vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL); 780 vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL);
781 if (!vc->vc_screenbuf) { 781 if (!vc->vc_screenbuf) {
782 tty_port_destroy(&vc->port);
783 kfree(vc); 782 kfree(vc);
784 vc_cons[currcons].d = NULL; 783 vc_cons[currcons].d = NULL;
785 return -ENOMEM; 784 return -ENOMEM;
@@ -986,26 +985,25 @@ static int vt_resize(struct tty_struct *tty, struct winsize *ws)
986 return ret; 985 return ret;
987} 986}
988 987
989void vc_deallocate(unsigned int currcons) 988struct vc_data *vc_deallocate(unsigned int currcons)
990{ 989{
990 struct vc_data *vc = NULL;
991
991 WARN_CONSOLE_UNLOCKED(); 992 WARN_CONSOLE_UNLOCKED();
992 993
993 if (vc_cons_allocated(currcons)) { 994 if (vc_cons_allocated(currcons)) {
994 struct vc_data *vc = vc_cons[currcons].d; 995 struct vt_notifier_param param;
995 struct vt_notifier_param param = { .vc = vc };
996 996
997 param.vc = vc = vc_cons[currcons].d;
997 atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, &param); 998 atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, &param);
998 vcs_remove_sysfs(currcons); 999 vcs_remove_sysfs(currcons);
999 vc->vc_sw->con_deinit(vc); 1000 vc->vc_sw->con_deinit(vc);
1000 put_pid(vc->vt_pid); 1001 put_pid(vc->vt_pid);
1001 module_put(vc->vc_sw->owner); 1002 module_put(vc->vc_sw->owner);
1002 kfree(vc->vc_screenbuf); 1003 kfree(vc->vc_screenbuf);
1003 if (currcons >= MIN_NR_CONSOLES) {
1004 tty_port_destroy(&vc->port);
1005 kfree(vc);
1006 }
1007 vc_cons[currcons].d = NULL; 1004 vc_cons[currcons].d = NULL;
1008 } 1005 }
1006 return vc;
1009} 1007}
1010 1008
1011/* 1009/*
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
index 98ff1735eafc..fc2c06c66e89 100644
--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -283,6 +283,51 @@ do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, struct vc_
283 return 0; 283 return 0;
284} 284}
285 285
286/* deallocate a single console, if possible (leave 0) */
287static int vt_disallocate(unsigned int vc_num)
288{
289 struct vc_data *vc = NULL;
290 int ret = 0;
291
292 if (!vc_num)
293 return 0;
294
295 console_lock();
296 if (VT_BUSY(vc_num))
297 ret = -EBUSY;
298 else
299 vc = vc_deallocate(vc_num);
300 console_unlock();
301
302 if (vc && vc_num >= MIN_NR_CONSOLES) {
303 tty_port_destroy(&vc->port);
304 kfree(vc);
305 }
306
307 return ret;
308}
309
310/* deallocate all unused consoles, but leave 0 */
311static void vt_disallocate_all(void)
312{
313 struct vc_data *vc[MAX_NR_CONSOLES];
314 int i;
315
316 console_lock();
317 for (i = 1; i < MAX_NR_CONSOLES; i++)
318 if (!VT_BUSY(i))
319 vc[i] = vc_deallocate(i);
320 else
321 vc[i] = NULL;
322 console_unlock();
323
324 for (i = 1; i < MAX_NR_CONSOLES; i++) {
325 if (vc[i] && i >= MIN_NR_CONSOLES) {
326 tty_port_destroy(&vc[i]->port);
327 kfree(vc[i]);
328 }
329 }
330}
286 331
287 332
288/* 333/*
@@ -769,24 +814,10 @@ int vt_ioctl(struct tty_struct *tty,
769 ret = -ENXIO; 814 ret = -ENXIO;
770 break; 815 break;
771 } 816 }
772 if (arg == 0) { 817 if (arg == 0)
773 /* deallocate all unused consoles, but leave 0 */ 818 vt_disallocate_all();
774 console_lock(); 819 else
775 for (i=1; i<MAX_NR_CONSOLES; i++) 820 ret = vt_disallocate(--arg);
776 if (! VT_BUSY(i))
777 vc_deallocate(i);
778 console_unlock();
779 } else {
780 /* deallocate a single console, if possible */
781 arg--;
782 if (VT_BUSY(arg))
783 ret = -EBUSY;
784 else if (arg) { /* leave 0 */
785 console_lock();
786 vc_deallocate(arg);
787 console_unlock();
788 }
789 }
790 break; 821 break;
791 822
792 case VT_RESIZE: 823 case VT_RESIZE: