aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2006-03-31 05:32:12 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-31 15:19:01 -0500
commita58e00e7da5f93c096527f5e20ceb2cf6d130cf0 (patch)
tree911e81f4cc25669b4adb37f30118efa81a09bfa6 /drivers
parenta244e1698ae3609cdfe24088e1293593cb7a5278 (diff)
[PATCH] Decrease number of pointer derefs in jsm_tty.c
Decrease the number of pointer derefs in drivers/serial/jsm/jsm_tty.c Benefits of the patch: - Fewer pointer dereferences should make the code slightly faster. - Size of generated code is smaller - Improved readability Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Acked-by: "V. ANANDA KRISHNAN" <mansarov@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/serial/jsm/jsm_tty.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
index 4d48b625cd3d..7d823705193c 100644
--- a/drivers/serial/jsm/jsm_tty.c
+++ b/drivers/serial/jsm/jsm_tty.c
@@ -142,12 +142,14 @@ static void jsm_tty_send_xchar(struct uart_port *port, char ch)
142{ 142{
143 unsigned long lock_flags; 143 unsigned long lock_flags;
144 struct jsm_channel *channel = (struct jsm_channel *)port; 144 struct jsm_channel *channel = (struct jsm_channel *)port;
145 struct termios *termios;
145 146
146 spin_lock_irqsave(&port->lock, lock_flags); 147 spin_lock_irqsave(&port->lock, lock_flags);
147 if (ch == port->info->tty->termios->c_cc[VSTART]) 148 termios = port->info->tty->termios;
149 if (ch == termios->c_cc[VSTART])
148 channel->ch_bd->bd_ops->send_start_character(channel); 150 channel->ch_bd->bd_ops->send_start_character(channel);
149 151
150 if (ch == port->info->tty->termios->c_cc[VSTOP]) 152 if (ch == termios->c_cc[VSTOP])
151 channel->ch_bd->bd_ops->send_stop_character(channel); 153 channel->ch_bd->bd_ops->send_stop_character(channel);
152 spin_unlock_irqrestore(&port->lock, lock_flags); 154 spin_unlock_irqrestore(&port->lock, lock_flags);
153} 155}
@@ -178,6 +180,7 @@ static int jsm_tty_open(struct uart_port *port)
178 struct jsm_board *brd; 180 struct jsm_board *brd;
179 int rc = 0; 181 int rc = 0;
180 struct jsm_channel *channel = (struct jsm_channel *)port; 182 struct jsm_channel *channel = (struct jsm_channel *)port;
183 struct termios *termios;
181 184
182 /* Get board pointer from our array of majors we have allocated */ 185 /* Get board pointer from our array of majors we have allocated */
183 brd = channel->ch_bd; 186 brd = channel->ch_bd;
@@ -239,12 +242,13 @@ static int jsm_tty_open(struct uart_port *port)
239 channel->ch_cached_lsr = 0; 242 channel->ch_cached_lsr = 0;
240 channel->ch_stops_sent = 0; 243 channel->ch_stops_sent = 0;
241 244
242 channel->ch_c_cflag = port->info->tty->termios->c_cflag; 245 termios = port->info->tty->termios;
243 channel->ch_c_iflag = port->info->tty->termios->c_iflag; 246 channel->ch_c_cflag = termios->c_cflag;
244 channel->ch_c_oflag = port->info->tty->termios->c_oflag; 247 channel->ch_c_iflag = termios->c_iflag;
245 channel->ch_c_lflag = port->info->tty->termios->c_lflag; 248 channel->ch_c_oflag = termios->c_oflag;
246 channel->ch_startc = port->info->tty->termios->c_cc[VSTART]; 249 channel->ch_c_lflag = termios->c_lflag;
247 channel->ch_stopc = port->info->tty->termios->c_cc[VSTOP]; 250 channel->ch_startc = termios->c_cc[VSTART];
251 channel->ch_stopc = termios->c_cc[VSTOP];
248 252
249 /* Tell UART to init itself */ 253 /* Tell UART to init itself */
250 brd->bd_ops->uart_init(channel); 254 brd->bd_ops->uart_init(channel);
@@ -784,6 +788,7 @@ static void jsm_carrier(struct jsm_channel *ch)
784 788
785void jsm_check_queue_flow_control(struct jsm_channel *ch) 789void jsm_check_queue_flow_control(struct jsm_channel *ch)
786{ 790{
791 struct board_ops *bd_ops = ch->ch_bd->bd_ops;
787 int qleft = 0; 792 int qleft = 0;
788 793
789 /* Store how much space we have left in the queue */ 794 /* Store how much space we have left in the queue */
@@ -809,7 +814,7 @@ void jsm_check_queue_flow_control(struct jsm_channel *ch)
809 /* HWFLOW */ 814 /* HWFLOW */
810 if (ch->ch_c_cflag & CRTSCTS) { 815 if (ch->ch_c_cflag & CRTSCTS) {
811 if(!(ch->ch_flags & CH_RECEIVER_OFF)) { 816 if(!(ch->ch_flags & CH_RECEIVER_OFF)) {
812 ch->ch_bd->bd_ops->disable_receiver(ch); 817 bd_ops->disable_receiver(ch);
813 ch->ch_flags |= (CH_RECEIVER_OFF); 818 ch->ch_flags |= (CH_RECEIVER_OFF);
814 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, 819 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev,
815 "Internal queue hit hilevel mark (%d)! Turning off interrupts.\n", 820 "Internal queue hit hilevel mark (%d)! Turning off interrupts.\n",
@@ -819,7 +824,7 @@ void jsm_check_queue_flow_control(struct jsm_channel *ch)
819 /* SWFLOW */ 824 /* SWFLOW */
820 else if (ch->ch_c_iflag & IXOFF) { 825 else if (ch->ch_c_iflag & IXOFF) {
821 if (ch->ch_stops_sent <= MAX_STOPS_SENT) { 826 if (ch->ch_stops_sent <= MAX_STOPS_SENT) {
822 ch->ch_bd->bd_ops->send_stop_character(ch); 827 bd_ops->send_stop_character(ch);
823 ch->ch_stops_sent++; 828 ch->ch_stops_sent++;
824 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, 829 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev,
825 "Sending stop char! Times sent: %x\n", ch->ch_stops_sent); 830 "Sending stop char! Times sent: %x\n", ch->ch_stops_sent);
@@ -846,7 +851,7 @@ void jsm_check_queue_flow_control(struct jsm_channel *ch)
846 /* HWFLOW */ 851 /* HWFLOW */
847 if (ch->ch_c_cflag & CRTSCTS) { 852 if (ch->ch_c_cflag & CRTSCTS) {
848 if (ch->ch_flags & CH_RECEIVER_OFF) { 853 if (ch->ch_flags & CH_RECEIVER_OFF) {
849 ch->ch_bd->bd_ops->enable_receiver(ch); 854 bd_ops->enable_receiver(ch);
850 ch->ch_flags &= ~(CH_RECEIVER_OFF); 855 ch->ch_flags &= ~(CH_RECEIVER_OFF);
851 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, 856 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev,
852 "Internal queue hit lowlevel mark (%d)! Turning on interrupts.\n", 857 "Internal queue hit lowlevel mark (%d)! Turning on interrupts.\n",
@@ -856,7 +861,7 @@ void jsm_check_queue_flow_control(struct jsm_channel *ch)
856 /* SWFLOW */ 861 /* SWFLOW */
857 else if (ch->ch_c_iflag & IXOFF && ch->ch_stops_sent) { 862 else if (ch->ch_c_iflag & IXOFF && ch->ch_stops_sent) {
858 ch->ch_stops_sent = 0; 863 ch->ch_stops_sent = 0;
859 ch->ch_bd->bd_ops->send_start_character(ch); 864 bd_ops->send_start_character(ch);
860 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "Sending start char!\n"); 865 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "Sending start char!\n");
861 } 866 }
862 } 867 }