diff options
Diffstat (limited to 'drivers/char/amiserial.c')
-rw-r--r-- | drivers/char/amiserial.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index d0e92ed0a367..486f97c3f4e5 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -112,17 +112,6 @@ static struct serial_state rs_table[1]; | |||
112 | 112 | ||
113 | #define NR_PORTS ARRAY_SIZE(rs_table) | 113 | #define NR_PORTS ARRAY_SIZE(rs_table) |
114 | 114 | ||
115 | /* | ||
116 | * tmp_buf is used as a temporary buffer by serial_write. We need to | ||
117 | * lock it in case the copy_from_user blocks while swapping in a page, | ||
118 | * and some other program tries to do a serial write at the same time. | ||
119 | * Since the lock will only come under contention when the system is | ||
120 | * swapping and available memory is low, it makes sense to share one | ||
121 | * buffer across all the serial ports, since it significantly saves | ||
122 | * memory if large numbers of serial ports are open. | ||
123 | */ | ||
124 | static unsigned char *tmp_buf; | ||
125 | |||
126 | #include <asm/uaccess.h> | 115 | #include <asm/uaccess.h> |
127 | 116 | ||
128 | #define serial_isroot() (capable(CAP_SYS_ADMIN)) | 117 | #define serial_isroot() (capable(CAP_SYS_ADMIN)) |
@@ -912,7 +901,7 @@ static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count | |||
912 | if (serial_paranoia_check(info, tty->name, "rs_write")) | 901 | if (serial_paranoia_check(info, tty->name, "rs_write")) |
913 | return 0; | 902 | return 0; |
914 | 903 | ||
915 | if (!info->xmit.buf || !tmp_buf) | 904 | if (!info->xmit.buf) |
916 | return 0; | 905 | return 0; |
917 | 906 | ||
918 | local_save_flags(flags); | 907 | local_save_flags(flags); |
@@ -1778,7 +1767,6 @@ static int rs_open(struct tty_struct *tty, struct file * filp) | |||
1778 | { | 1767 | { |
1779 | struct async_struct *info; | 1768 | struct async_struct *info; |
1780 | int retval, line; | 1769 | int retval, line; |
1781 | unsigned long page; | ||
1782 | 1770 | ||
1783 | line = tty->index; | 1771 | line = tty->index; |
1784 | if ((line < 0) || (line >= NR_PORTS)) { | 1772 | if ((line < 0) || (line >= NR_PORTS)) { |
@@ -1798,17 +1786,6 @@ static int rs_open(struct tty_struct *tty, struct file * filp) | |||
1798 | #endif | 1786 | #endif |
1799 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 1787 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
1800 | 1788 | ||
1801 | if (!tmp_buf) { | ||
1802 | page = get_zeroed_page(GFP_KERNEL); | ||
1803 | if (!page) { | ||
1804 | return -ENOMEM; | ||
1805 | } | ||
1806 | if (tmp_buf) | ||
1807 | free_page(page); | ||
1808 | else | ||
1809 | tmp_buf = (unsigned char *) page; | ||
1810 | } | ||
1811 | |||
1812 | /* | 1789 | /* |
1813 | * If the port is the middle of closing, bail out now | 1790 | * If the port is the middle of closing, bail out now |
1814 | */ | 1791 | */ |
@@ -2090,11 +2067,6 @@ static __exit void rs_exit(void) | |||
2090 | kfree(info); | 2067 | kfree(info); |
2091 | } | 2068 | } |
2092 | 2069 | ||
2093 | if (tmp_buf) { | ||
2094 | free_page((unsigned long) tmp_buf); | ||
2095 | tmp_buf = NULL; | ||
2096 | } | ||
2097 | |||
2098 | release_mem_region(CUSTOM_PHYSADDR+0x30, 4); | 2070 | release_mem_region(CUSTOM_PHYSADDR+0x30, 4); |
2099 | } | 2071 | } |
2100 | 2072 | ||