aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/cyclades.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/cyclades.c')
-rw-r--r--drivers/char/cyclades.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index f85b4eb16618..87b2fb510871 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -748,18 +748,6 @@ static struct cyclades_port cy_port[NR_PORTS];
748static int cy_next_channel; /* next minor available */ 748static int cy_next_channel; /* next minor available */
749 749
750/* 750/*
751 * tmp_buf is used as a temporary buffer by serial_write. We need to
752 * lock it in case the copy_from_user blocks while swapping in a page,
753 * and some other program tries to do a serial write at the same time.
754 * Since the lock will only come under contention when the system is
755 * swapping and available memory is low, it makes sense to share one
756 * buffer across all the serial ports, since it significantly saves
757 * memory if large numbers of serial ports are open. This buffer is
758 * allocated when the first cy_open occurs.
759 */
760static unsigned char *tmp_buf;
761
762/*
763 * This is used to look up the divisor speeds and the timeouts 751 * This is used to look up the divisor speeds and the timeouts
764 * We're normally limited to 15 distinct baud rates. The extra 752 * We're normally limited to 15 distinct baud rates. The extra
765 * are accessed via settings in info->flags. 753 * are accessed via settings in info->flags.
@@ -2466,7 +2454,6 @@ cy_open(struct tty_struct *tty, struct file * filp)
2466{ 2454{
2467 struct cyclades_port *info; 2455 struct cyclades_port *info;
2468 int retval, line; 2456 int retval, line;
2469 unsigned long page;
2470 2457
2471 line = tty->index; 2458 line = tty->index;
2472 if ((line < 0) || (NR_PORTS <= line)){ 2459 if ((line < 0) || (NR_PORTS <= line)){
@@ -2545,15 +2532,6 @@ cy_open(struct tty_struct *tty, struct file * filp)
2545 printk("cyc:cy_open (%d): incrementing count to %d\n", 2532 printk("cyc:cy_open (%d): incrementing count to %d\n",
2546 current->pid, info->count); 2533 current->pid, info->count);
2547#endif 2534#endif
2548 if (!tmp_buf) {
2549 page = get_zeroed_page(GFP_KERNEL);
2550 if (!page)
2551 return -ENOMEM;
2552 if (tmp_buf)
2553 free_page(page);
2554 else
2555 tmp_buf = (unsigned char *) page;
2556 }
2557 2535
2558 /* 2536 /*
2559 * If the port is the middle of closing, bail out now 2537 * 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)
2832 return 0; 2810 return 0;
2833 } 2811 }
2834 2812
2835 if (!info->xmit_buf || !tmp_buf) 2813 if (!info->xmit_buf)
2836 return 0; 2814 return 0;
2837 2815
2838 CY_LOCK(info, flags); 2816 CY_LOCK(info, flags);
@@ -5490,10 +5468,6 @@ cy_cleanup_module(void)
5490#endif 5468#endif
5491 } 5469 }
5492 } 5470 }
5493 if (tmp_buf) {
5494 free_page((unsigned long) tmp_buf);
5495 tmp_buf = NULL;
5496 }
5497} /* cy_cleanup_module */ 5471} /* cy_cleanup_module */
5498 5472
5499module_init(cy_init); 5473module_init(cy_init);