aboutsummaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/amiserial.c30
-rw-r--r--drivers/char/cyclades.c28
-rw-r--r--drivers/char/epca.c17
-rw-r--r--drivers/char/epca.h1
-rw-r--r--drivers/char/generic_serial.c19
-rw-r--r--drivers/char/hvc_iseries.c8
-rw-r--r--drivers/char/hvc_vio.c4
-rw-r--r--drivers/char/riscom8.c10
-rw-r--r--drivers/char/serial167.c22
9 files changed, 18 insertions, 121 deletions
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
index d0e92ed0a36..486f97c3f4e 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/char/amiserial.c
@@ -112,17 +112,6 @@ static struct serial_state rs_table[1];
#define NR_PORTS ARRAY_SIZE(rs_table)
-/*
- * tmp_buf is used as a temporary buffer by serial_write. We need to
- * lock it in case the copy_from_user blocks while swapping in a page,
- * and some other program tries to do a serial write at the same time.
- * Since the lock will only come under contention when the system is
- * swapping and available memory is low, it makes sense to share one
- * buffer across all the serial ports, since it significantly saves
- * memory if large numbers of serial ports are open.
- */
-static unsigned char *tmp_buf;
-
#include <asm/uaccess.h>
#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
if (serial_paranoia_check(info, tty->name, "rs_write"))
return 0;
- if (!info->xmit.buf || !tmp_buf)
+ if (!info->xmit.buf)
return 0;
local_save_flags(flags);
@@ -1778,7 +1767,6 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
{
struct async_struct *info;
int retval, line;
- unsigned long page;
line = tty->index;
if ((line < 0) || (line >= NR_PORTS)) {
@@ -1798,17 +1786,6 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
#endif
info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
- if (!tmp_buf) {
- page = get_zeroed_page(GFP_KERNEL);
- if (!page) {
- return -ENOMEM;
- }
- if (tmp_buf)
- free_page(page);
- else
- tmp_buf = (unsigned char *) page;
- }
-
/*
* If the port is the middle of closing, bail out now
*/
@@ -2090,11 +2067,6 @@ static __exit void rs_exit(void)
kfree(info);
}
- if (tmp_buf) {
- free_page((unsigned long) tmp_buf);
- tmp_buf = NULL;
- }
-
release_mem_region(CUSTOM_PHYSADDR+0x30, 4);
}
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index f85b4eb1661..87b2fb51087 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -748,18 +748,6 @@ static struct cyclades_port cy_port[NR_PORTS];
static int cy_next_channel; /* next minor available */
/*
- * tmp_buf is used as a temporary buffer by serial_write. We need to
- * lock it in case the copy_from_user blocks while swapping in a page,
- * and some other program tries to do a serial write at the same time.
- * Since the lock will only come under contention when the system is
- * swapping and available memory is low, it makes sense to share one
- * buffer across all the serial ports, since it significantly saves
- * memory if large numbers of serial ports are open. This buffer is
- * allocated when the first cy_open occurs.
- */
-static unsigned char *tmp_buf;
-
-/*
* This is used to look up the divisor speeds and the timeouts
* We're normally limited to 15 distinct baud rates. The extra
* are accessed via settings in info->flags.
@@ -2466,7 +2454,6 @@ cy_open(struct tty_struct *tty, struct file * filp)
{
struct cyclades_port *info;
int retval, line;
- unsigned long page;
line = tty->index;
if ((line < 0) || (NR_PORTS <= line)){
@@ -2545,15 +2532,6 @@ cy_open(struct tty_struct *tty, struct file * filp)
printk("cyc:cy_open (%d): incrementing count to %d\n",
current->pid, info->count);
#endif
- if (!tmp_buf) {
- page = get_zeroed_page(GFP_KERNEL);
- if (!page)
- return -ENOMEM;
- if (tmp_buf)
- free_page(page);
- else
- tmp_buf = (unsigned char *) page;
- }
/*
* If the port is the middle of closing, bail out now
@@ -2832,7 +2810,7 @@ cy_write(struct tty_struct * tty, const unsigned char *buf, int count)
return 0;
}
- if (!info->xmit_buf || !tmp_buf)
+ if (!info->xmit_buf)
return 0;
CY_LOCK(info, flags);
@@ -5490,10 +5468,6 @@ cy_cleanup_module(void)
#endif
}
}
- if (tmp_buf) {
- free_page((unsigned long) tmp_buf);
- tmp_buf = NULL;
- }
} /* cy_cleanup_module */
module_init(cy_init);
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index 3baa2ab8cbd..c3f95583a12 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -1113,11 +1113,8 @@ static void __exit epca_module_exit(void)
ch = card_ptr[crd];
for (count = 0; count < bd->numports; count++, ch++)
{ /* Begin for each port */
- if (ch) {
- if (ch->tty)
- tty_hangup(ch->tty);
- kfree(ch->tmp_buf);
- }
+ if (ch && ch->tty)
+ tty_hangup(ch->tty);
} /* End for each port */
} /* End for each card */
pci_unregister_driver (&epca_driver);
@@ -1635,16 +1632,6 @@ static void post_fep_init(unsigned int crd)
init_waitqueue_head(&ch->close_wait);
spin_unlock_irqrestore(&epca_lock, flags);
-
- ch->tmp_buf = kmalloc(ch->txbufsize,GFP_KERNEL);
- if (!ch->tmp_buf) {
- printk(KERN_ERR "POST FEP INIT : kmalloc failed for port 0x%x\n",i);
- release_region((int)bd->port, 4);
- while(i-- > 0)
- kfree((ch--)->tmp_buf);
- return;
- } else
- memset((void *)ch->tmp_buf,0,ch->txbufsize);
} /* End for each port */
printk(KERN_INFO
diff --git a/drivers/char/epca.h b/drivers/char/epca.h
index 456d6c8f94a..a297238cd3b 100644
--- a/drivers/char/epca.h
+++ b/drivers/char/epca.h
@@ -130,7 +130,6 @@ struct channel
unsigned long c_oflag;
unsigned char __iomem *txptr;
unsigned char __iomem *rxptr;
- unsigned char *tmp_buf;
struct board_info *board;
struct board_chan __iomem *brdchan;
struct digi_struct digiext;
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 4711d9b3a59..87127e49c0d 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -33,8 +33,6 @@
#define DEBUG
-static char * tmp_buf;
-
static int gs_debug;
#ifdef DEBUG
@@ -205,7 +203,7 @@ int gs_write(struct tty_struct * tty,
if (!tty) return -EIO;
port = tty->driver_data;
- if (!port || !port->xmit_buf || !tmp_buf)
+ if (!port || !port->xmit_buf)
return -EIO;
local_save_flags(flags);
@@ -837,24 +835,9 @@ void gs_set_termios (struct tty_struct * tty,
int gs_init_port(struct gs_port *port)
{
unsigned long flags;
- unsigned long page;
func_enter ();
- if (!tmp_buf) {
- page = get_zeroed_page(GFP_KERNEL);
- spin_lock_irqsave (&port->driver_lock, flags); /* Don't expect this to make a difference. */
- if (tmp_buf)
- free_page(page);
- else
- tmp_buf = (unsigned char *) page;
- spin_unlock_irqrestore (&port->driver_lock, flags);
- if (!tmp_buf) {
- func_exit ();
- return -ENOMEM;
- }
- }
-
if (port->flags & ASYNC_INITIALIZED) {
func_exit ();
return 0;
diff --git a/drivers/char/hvc_iseries.c b/drivers/char/hvc_iseries.c
index 8b6f197e5f8..f144a947bd1 100644
--- a/drivers/char/hvc_iseries.c
+++ b/drivers/char/hvc_iseries.c
@@ -29,6 +29,7 @@
#include <asm/hvconsole.h>
#include <asm/vio.h>
#include <asm/prom.h>
+#include <asm/firmware.h>
#include <asm/iseries/vio.h>
#include <asm/iseries/hv_call.h>
#include <asm/iseries/hv_lp_config.h>
@@ -488,6 +489,9 @@ static int hvc_vio_init(void)
atomic_t wait_flag;
int rc;
+ if (!firmware_has_feature(FW_FEATURE_ISERIES))
+ return -EIO;
+
/* +2 for fudge */
rc = viopath_open(HvLpConfig_getPrimaryLpIndex(),
viomajorsubtype_chario, VIOCHAR_WINDOW + 2);
@@ -562,7 +566,7 @@ static int hvc_find_vtys(void)
for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL;
vty = of_find_node_by_name(vty, "vty")) {
- uint32_t *vtermno;
+ const uint32_t *vtermno;
/* We have statically defined space for only a certain number
* of console adapters.
@@ -571,7 +575,7 @@ static int hvc_find_vtys(void)
(num_found >= VTTY_PORTS))
break;
- vtermno = (uint32_t *)get_property(vty, "reg", NULL);
+ vtermno = get_property(vty, "reg", NULL);
if (!vtermno)
continue;
diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c
index cc95941148f..f9c00844d2b 100644
--- a/drivers/char/hvc_vio.c
+++ b/drivers/char/hvc_vio.c
@@ -35,6 +35,7 @@
#include <asm/hvconsole.h>
#include <asm/vio.h>
#include <asm/prom.h>
+#include <asm/firmware.h>
#include "hvc_console.h"
@@ -120,6 +121,9 @@ static int hvc_vio_init(void)
{
int rc;
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ return -EIO;
+
/* Register as a vio device to receive callbacks */
rc = vio_register_driver(&hvc_vio_driver);
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index 214d850112f..b0ab3f28cc6 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -81,7 +81,6 @@
static struct riscom_board * IRQ_to_board[16];
static struct tty_driver *riscom_driver;
-static unsigned char * tmp_buf;
static unsigned long baud_table[] = {
0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
@@ -1124,7 +1123,7 @@ static int rc_write(struct tty_struct * tty,
bp = port_Board(port);
- if (!tty || !port->xmit_buf || !tmp_buf)
+ if (!tty || !port->xmit_buf)
return 0;
save_flags(flags);
@@ -1612,11 +1611,6 @@ static inline int rc_init_drivers(void)
if (!riscom_driver)
return -ENOMEM;
- if (!(tmp_buf = (unsigned char *) get_zeroed_page(GFP_KERNEL))) {
- printk(KERN_ERR "rc: Couldn't get free page.\n");
- put_tty_driver(riscom_driver);
- return 1;
- }
memset(IRQ_to_board, 0, sizeof(IRQ_to_board));
riscom_driver->owner = THIS_MODULE;
riscom_driver->name = "ttyL";
@@ -1629,7 +1623,6 @@ static inline int rc_init_drivers(void)
riscom_driver->flags = TTY_DRIVER_REAL_RAW;
tty_set_operations(riscom_driver, &riscom_ops);
if ((error = tty_register_driver(riscom_driver))) {
- free_page((unsigned long)tmp_buf);
put_tty_driver(riscom_driver);
printk(KERN_ERR "rc: Couldn't register RISCom/8 driver, "
"error = %d\n",
@@ -1657,7 +1650,6 @@ static void rc_release_drivers(void)
save_flags(flags);
cli();
- free_page((unsigned long)tmp_buf);
tty_unregister_driver(riscom_driver);
put_tty_driver(riscom_driver);
restore_flags(flags);
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c
index b4ea1266b66..f4809c8183c 100644
--- a/drivers/char/serial167.c
+++ b/drivers/char/serial167.c
@@ -119,17 +119,6 @@ struct cyclades_port cy_port[] = {
#define NR_PORTS ARRAY_SIZE(cy_port)
/*
- * tmp_buf is used as a temporary buffer by serial_write. We need to
- * lock it in case the copy_from_user blocks while swapping in a page,
- * and some other program tries to do a serial write at the same time.
- * Since the lock will only come under contention when the system is
- * swapping and available memory is low, it makes sense to share one
- * buffer across all the serial ports, since it significantly saves
- * memory if large numbers of serial ports are open.
- */
-static unsigned char *tmp_buf = 0;
-
-/*
* This is used to look up the divisor speeds and the timeouts
* We're normally limited to 15 distinct baud rates. The extra
* are accessed via settings in info->flags.
@@ -1132,7 +1121,7 @@ cy_put_char(struct tty_struct *tty, unsigned char ch)
if (serial_paranoia_check(info, tty->name, "cy_put_char"))
return;
- if (!tty || !info->xmit_buf)
+ if (!info->xmit_buf)
return;
local_irq_save(flags);
@@ -1198,7 +1187,7 @@ cy_write(struct tty_struct * tty,
return 0;
}
- if (!tty || !info->xmit_buf || !tmp_buf){
+ if (!info->xmit_buf){
return 0;
}
@@ -1983,13 +1972,6 @@ cy_open(struct tty_struct *tty, struct file * filp)
tty->driver_data = info;
info->tty = tty;
- if (!tmp_buf) {
- tmp_buf = (unsigned char *) get_zeroed_page(GFP_KERNEL);
- if (!tmp_buf){
- return -ENOMEM;
- }
- }
-
/*
* Start up serial port
*/