diff options
Diffstat (limited to 'drivers/char/rocket.c')
-rw-r--r-- | drivers/char/rocket.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 76357c855ce3..a3fd7e7ba5a9 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -65,10 +65,6 @@ | |||
65 | 65 | ||
66 | /****** Kernel includes ******/ | 66 | /****** Kernel includes ******/ |
67 | 67 | ||
68 | #ifdef MODVERSIONS | ||
69 | #include <config/modversions.h> | ||
70 | #endif | ||
71 | |||
72 | #include <linux/module.h> | 68 | #include <linux/module.h> |
73 | #include <linux/errno.h> | 69 | #include <linux/errno.h> |
74 | #include <linux/major.h> | 70 | #include <linux/major.h> |
@@ -85,6 +81,7 @@ | |||
85 | #include <linux/string.h> | 81 | #include <linux/string.h> |
86 | #include <linux/fcntl.h> | 82 | #include <linux/fcntl.h> |
87 | #include <linux/ptrace.h> | 83 | #include <linux/ptrace.h> |
84 | #include <linux/mutex.h> | ||
88 | #include <linux/ioport.h> | 85 | #include <linux/ioport.h> |
89 | #include <linux/delay.h> | 86 | #include <linux/delay.h> |
90 | #include <linux/wait.h> | 87 | #include <linux/wait.h> |
@@ -93,7 +90,6 @@ | |||
93 | #include <asm/atomic.h> | 90 | #include <asm/atomic.h> |
94 | #include <linux/bitops.h> | 91 | #include <linux/bitops.h> |
95 | #include <linux/spinlock.h> | 92 | #include <linux/spinlock.h> |
96 | #include <asm/semaphore.h> | ||
97 | #include <linux/init.h> | 93 | #include <linux/init.h> |
98 | 94 | ||
99 | /****** RocketPort includes ******/ | 95 | /****** RocketPort includes ******/ |
@@ -702,7 +698,7 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev) | |||
702 | } | 698 | } |
703 | } | 699 | } |
704 | spin_lock_init(&info->slock); | 700 | spin_lock_init(&info->slock); |
705 | sema_init(&info->write_sem, 1); | 701 | mutex_init(&info->write_mtx); |
706 | rp_table[line] = info; | 702 | rp_table[line] = info; |
707 | if (pci_dev) | 703 | if (pci_dev) |
708 | tty_register_device(rocket_driver, line, &pci_dev->dev); | 704 | tty_register_device(rocket_driver, line, &pci_dev->dev); |
@@ -947,7 +943,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
947 | #endif | 943 | #endif |
948 | schedule(); /* Don't hold spinlock here, will hang PC */ | 944 | schedule(); /* Don't hold spinlock here, will hang PC */ |
949 | } | 945 | } |
950 | current->state = TASK_RUNNING; | 946 | __set_current_state(TASK_RUNNING); |
951 | remove_wait_queue(&info->open_wait, &wait); | 947 | remove_wait_queue(&info->open_wait, &wait); |
952 | 948 | ||
953 | spin_lock_irqsave(&info->slock, flags); | 949 | spin_lock_irqsave(&info->slock, flags); |
@@ -1018,9 +1014,6 @@ static int rp_open(struct tty_struct *tty, struct file *filp) | |||
1018 | /* | 1014 | /* |
1019 | * Info->count is now 1; so it's safe to sleep now. | 1015 | * Info->count is now 1; so it's safe to sleep now. |
1020 | */ | 1016 | */ |
1021 | info->session = process_session(current); | ||
1022 | info->pgrp = process_group(current); | ||
1023 | |||
1024 | if ((info->flags & ROCKET_INITIALIZED) == 0) { | 1017 | if ((info->flags & ROCKET_INITIALIZED) == 0) { |
1025 | cp = &info->channel; | 1018 | cp = &info->channel; |
1026 | sSetRxTrigger(cp, TRIG_1); | 1019 | sSetRxTrigger(cp, TRIG_1); |
@@ -1602,7 +1595,7 @@ static void rp_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1602 | if (signal_pending(current)) | 1595 | if (signal_pending(current)) |
1603 | break; | 1596 | break; |
1604 | } | 1597 | } |
1605 | current->state = TASK_RUNNING; | 1598 | __set_current_state(TASK_RUNNING); |
1606 | #ifdef ROCKET_DEBUG_WAIT_UNTIL_SENT | 1599 | #ifdef ROCKET_DEBUG_WAIT_UNTIL_SENT |
1607 | printk(KERN_INFO "txcnt = %d (jiff=%lu)...done\n", txcnt, jiffies); | 1600 | printk(KERN_INFO "txcnt = %d (jiff=%lu)...done\n", txcnt, jiffies); |
1608 | #endif | 1601 | #endif |
@@ -1661,8 +1654,11 @@ static void rp_put_char(struct tty_struct *tty, unsigned char ch) | |||
1661 | if (rocket_paranoia_check(info, "rp_put_char")) | 1654 | if (rocket_paranoia_check(info, "rp_put_char")) |
1662 | return; | 1655 | return; |
1663 | 1656 | ||
1664 | /* Grab the port write semaphore, locking out other processes that try to write to this port */ | 1657 | /* |
1665 | down(&info->write_sem); | 1658 | * Grab the port write mutex, locking out other processes that try to |
1659 | * write to this port | ||
1660 | */ | ||
1661 | mutex_lock(&info->write_mtx); | ||
1666 | 1662 | ||
1667 | #ifdef ROCKET_DEBUG_WRITE | 1663 | #ifdef ROCKET_DEBUG_WRITE |
1668 | printk(KERN_INFO "rp_put_char %c...", ch); | 1664 | printk(KERN_INFO "rp_put_char %c...", ch); |
@@ -1684,12 +1680,12 @@ static void rp_put_char(struct tty_struct *tty, unsigned char ch) | |||
1684 | info->xmit_fifo_room--; | 1680 | info->xmit_fifo_room--; |
1685 | } | 1681 | } |
1686 | spin_unlock_irqrestore(&info->slock, flags); | 1682 | spin_unlock_irqrestore(&info->slock, flags); |
1687 | up(&info->write_sem); | 1683 | mutex_unlock(&info->write_mtx); |
1688 | } | 1684 | } |
1689 | 1685 | ||
1690 | /* | 1686 | /* |
1691 | * Exception handler - write routine, called when user app writes to the device. | 1687 | * Exception handler - write routine, called when user app writes to the device. |
1692 | * A per port write semaphore is used to protect from another process writing to | 1688 | * A per port write mutex is used to protect from another process writing to |
1693 | * this port at the same time. This other process could be running on the other CPU | 1689 | * this port at the same time. This other process could be running on the other CPU |
1694 | * or get control of the CPU if the copy_from_user() blocks due to a page fault (swapped out). | 1690 | * or get control of the CPU if the copy_from_user() blocks due to a page fault (swapped out). |
1695 | * Spinlocks protect the info xmit members. | 1691 | * Spinlocks protect the info xmit members. |
@@ -1706,7 +1702,7 @@ static int rp_write(struct tty_struct *tty, | |||
1706 | if (count <= 0 || rocket_paranoia_check(info, "rp_write")) | 1702 | if (count <= 0 || rocket_paranoia_check(info, "rp_write")) |
1707 | return 0; | 1703 | return 0; |
1708 | 1704 | ||
1709 | down_interruptible(&info->write_sem); | 1705 | mutex_lock_interruptible(&info->write_mtx); |
1710 | 1706 | ||
1711 | #ifdef ROCKET_DEBUG_WRITE | 1707 | #ifdef ROCKET_DEBUG_WRITE |
1712 | printk(KERN_INFO "rp_write %d chars...", count); | 1708 | printk(KERN_INFO "rp_write %d chars...", count); |
@@ -1777,7 +1773,7 @@ end: | |||
1777 | wake_up_interruptible(&tty->poll_wait); | 1773 | wake_up_interruptible(&tty->poll_wait); |
1778 | #endif | 1774 | #endif |
1779 | } | 1775 | } |
1780 | up(&info->write_sem); | 1776 | mutex_unlock(&info->write_mtx); |
1781 | return retval; | 1777 | return retval; |
1782 | } | 1778 | } |
1783 | 1779 | ||
@@ -1852,6 +1848,12 @@ static void rp_flush_buffer(struct tty_struct *tty) | |||
1852 | 1848 | ||
1853 | #ifdef CONFIG_PCI | 1849 | #ifdef CONFIG_PCI |
1854 | 1850 | ||
1851 | static struct pci_device_id __devinitdata rocket_pci_ids[] = { | ||
1852 | { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_ANY_ID) }, | ||
1853 | { } | ||
1854 | }; | ||
1855 | MODULE_DEVICE_TABLE(pci, rocket_pci_ids); | ||
1856 | |||
1855 | /* | 1857 | /* |
1856 | * Called when a PCI card is found. Retrieves and stores model information, | 1858 | * Called when a PCI card is found. Retrieves and stores model information, |
1857 | * init's aiopic and serial port hardware. | 1859 | * init's aiopic and serial port hardware. |