aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/generic_serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/generic_serial.c')
-rw-r--r--drivers/char/generic_serial.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 5e59c0b42731..e769811e7417 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -33,8 +33,6 @@
33 33
34#define DEBUG 34#define DEBUG
35 35
36static char * tmp_buf;
37
38static int gs_debug; 36static int gs_debug;
39 37
40#ifdef DEBUG 38#ifdef DEBUG
@@ -205,7 +203,7 @@ int gs_write(struct tty_struct * tty,
205 if (!tty) return -EIO; 203 if (!tty) return -EIO;
206 204
207 port = tty->driver_data; 205 port = tty->driver_data;
208 if (!port || !port->xmit_buf || !tmp_buf) 206 if (!port || !port->xmit_buf)
209 return -EIO; 207 return -EIO;
210 208
211 local_save_flags(flags); 209 local_save_flags(flags);
@@ -720,11 +718,11 @@ static unsigned int gs_baudrates[] = {
720 718
721 719
722void gs_set_termios (struct tty_struct * tty, 720void gs_set_termios (struct tty_struct * tty,
723 struct termios * old_termios) 721 struct ktermios * old_termios)
724{ 722{
725 struct gs_port *port; 723 struct gs_port *port;
726 int baudrate, tmp, rv; 724 int baudrate, tmp, rv;
727 struct termios *tiosp; 725 struct ktermios *tiosp;
728 726
729 func_enter(); 727 func_enter();
730 728
@@ -746,11 +744,9 @@ void gs_set_termios (struct tty_struct * tty,
746 gs_dprintk (GS_DEBUG_TERMIOS, "termios structure (%p):\n", tiosp); 744 gs_dprintk (GS_DEBUG_TERMIOS, "termios structure (%p):\n", tiosp);
747 } 745 }
748 746
749#if 0
750 /* This is an optimization that is only allowed for dumb cards */ 747 /* This is an optimization that is only allowed for dumb cards */
751 /* Smart cards require knowledge of iflags and oflags too: that 748 /* Smart cards require knowledge of iflags and oflags too: that
752 might change hardware cooking mode.... */ 749 might change hardware cooking mode.... */
753#endif
754 if (old_termios) { 750 if (old_termios) {
755 if( (tiosp->c_iflag == old_termios->c_iflag) 751 if( (tiosp->c_iflag == old_termios->c_iflag)
756 && (tiosp->c_oflag == old_termios->c_oflag) 752 && (tiosp->c_oflag == old_termios->c_oflag)
@@ -774,14 +770,7 @@ void gs_set_termios (struct tty_struct * tty,
774 if(!memcmp(tiosp->c_cc, old_termios->c_cc, NCC)) printk("c_cc changed\n"); 770 if(!memcmp(tiosp->c_cc, old_termios->c_cc, NCC)) printk("c_cc changed\n");
775 } 771 }
776 772
777 baudrate = tiosp->c_cflag & CBAUD; 773 baudrate = tty_get_baud_rate(tty);
778 if (baudrate & CBAUDEX) {
779 baudrate &= ~CBAUDEX;
780 if ((baudrate < 1) || (baudrate > 4))
781 tiosp->c_cflag &= ~CBAUDEX;
782 else
783 baudrate += 15;
784 }
785 774
786 baudrate = gs_baudrates[baudrate]; 775 baudrate = gs_baudrates[baudrate];
787 if ((tiosp->c_cflag & CBAUD) == B38400) { 776 if ((tiosp->c_cflag & CBAUD) == B38400) {
@@ -846,24 +835,9 @@ void gs_set_termios (struct tty_struct * tty,
846int gs_init_port(struct gs_port *port) 835int gs_init_port(struct gs_port *port)
847{ 836{
848 unsigned long flags; 837 unsigned long flags;
849 unsigned long page;
850 838
851 func_enter (); 839 func_enter ();
852 840
853 if (!tmp_buf) {
854 page = get_zeroed_page(GFP_KERNEL);
855 spin_lock_irqsave (&port->driver_lock, flags); /* Don't expect this to make a difference. */
856 if (tmp_buf)
857 free_page(page);
858 else
859 tmp_buf = (unsigned char *) page;
860 spin_unlock_irqrestore (&port->driver_lock, flags);
861 if (!tmp_buf) {
862 func_exit ();
863 return -ENOMEM;
864 }
865 }
866
867 if (port->flags & ASYNC_INITIALIZED) { 841 if (port->flags & ASYNC_INITIALIZED) {
868 func_exit (); 842 func_exit ();
869 return 0; 843 return 0;