mirror of https://gitee.com/openkylin/linux.git
staging: dgnc: replace dgnc_offset_table with bit shift.
the dgnc_offset_table has a same value with (1 << port). So I tried to replace dgnc_offset_table array with 1 << port. And also there are redundant assignments(tmp and current_port) inside while loop for checking uart port, and remove them. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e078cb2a64
commit
d8bf4bee49
|
@ -77,9 +77,6 @@ struct board_ops dgnc_neo_ops = {
|
||||||
.send_immediate_char = neo_send_immediate_char
|
.send_immediate_char = neo_send_immediate_char
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08,
|
|
||||||
0x10, 0x20, 0x40, 0x80 };
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function allows calls to ensure that all outstanding
|
* This function allows calls to ensure that all outstanding
|
||||||
* PCI writes have been completed, by doing a PCI read against
|
* PCI writes have been completed, by doing a PCI read against
|
||||||
|
@ -923,9 +920,7 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
|
||||||
struct dgnc_board *brd = voidbrd;
|
struct dgnc_board *brd = voidbrd;
|
||||||
struct channel_t *ch;
|
struct channel_t *ch;
|
||||||
int port = 0;
|
int port = 0;
|
||||||
int type = 0;
|
int type;
|
||||||
int current_port;
|
|
||||||
u32 tmp;
|
|
||||||
u32 uart_poll;
|
u32 uart_poll;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned long flags2;
|
unsigned long flags2;
|
||||||
|
@ -960,29 +955,12 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
|
||||||
|
|
||||||
/* At this point, we have at least SOMETHING to service, dig further... */
|
/* At this point, we have at least SOMETHING to service, dig further... */
|
||||||
|
|
||||||
current_port = 0;
|
|
||||||
|
|
||||||
/* Loop on each port */
|
/* Loop on each port */
|
||||||
while ((uart_poll & 0xff) != 0) {
|
while ((uart_poll & 0xff) != 0) {
|
||||||
tmp = uart_poll;
|
type = uart_poll >> (8 + (port * 3));
|
||||||
|
type &= 0x7;
|
||||||
|
|
||||||
/* Check current port to see if it has interrupt pending */
|
uart_poll &= ~(0x01 << port);
|
||||||
if ((tmp & dgnc_offset_table[current_port]) != 0) {
|
|
||||||
port = current_port;
|
|
||||||
type = tmp >> (8 + (port * 3));
|
|
||||||
type &= 0x7;
|
|
||||||
} else {
|
|
||||||
current_port++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove this port + type from uart_poll */
|
|
||||||
uart_poll &= ~(dgnc_offset_table[port]);
|
|
||||||
|
|
||||||
if (!type) {
|
|
||||||
/* If no type, just ignore it, and move onto next port */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Switch on type of interrupt we have */
|
/* Switch on type of interrupt we have */
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -994,7 +972,7 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
|
||||||
|
|
||||||
/* Verify the port is in range. */
|
/* Verify the port is in range. */
|
||||||
if (port >= brd->nasync)
|
if (port >= brd->nasync)
|
||||||
continue;
|
break;
|
||||||
|
|
||||||
ch = brd->channels[port];
|
ch = brd->channels[port];
|
||||||
neo_copy_data_from_uart_to_queue(ch);
|
neo_copy_data_from_uart_to_queue(ch);
|
||||||
|
@ -1004,14 +982,14 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
|
||||||
dgnc_check_queue_flow_control(ch);
|
dgnc_check_queue_flow_control(ch);
|
||||||
spin_unlock_irqrestore(&ch->ch_lock, flags2);
|
spin_unlock_irqrestore(&ch->ch_lock, flags2);
|
||||||
|
|
||||||
continue;
|
break;
|
||||||
|
|
||||||
case UART_17158_RX_LINE_STATUS:
|
case UART_17158_RX_LINE_STATUS:
|
||||||
/*
|
/*
|
||||||
* RXRDY and RX LINE Status (logic OR of LSR[4:1])
|
* RXRDY and RX LINE Status (logic OR of LSR[4:1])
|
||||||
*/
|
*/
|
||||||
neo_parse_lsr(brd, port);
|
neo_parse_lsr(brd, port);
|
||||||
continue;
|
break;
|
||||||
|
|
||||||
case UART_17158_TXRDY:
|
case UART_17158_TXRDY:
|
||||||
/*
|
/*
|
||||||
|
@ -1027,14 +1005,14 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
|
||||||
* it should be, I was getting things like RXDY too. Weird.
|
* it should be, I was getting things like RXDY too. Weird.
|
||||||
*/
|
*/
|
||||||
neo_parse_isr(brd, port);
|
neo_parse_isr(brd, port);
|
||||||
continue;
|
break;
|
||||||
|
|
||||||
case UART_17158_MSR:
|
case UART_17158_MSR:
|
||||||
/*
|
/*
|
||||||
* MSR or flow control was seen.
|
* MSR or flow control was seen.
|
||||||
*/
|
*/
|
||||||
neo_parse_isr(brd, port);
|
neo_parse_isr(brd, port);
|
||||||
continue;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
|
@ -1043,8 +1021,10 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
|
||||||
* these once and awhile.
|
* these once and awhile.
|
||||||
* Its harmless, just ignore it and move on.
|
* Its harmless, just ignore it and move on.
|
||||||
*/
|
*/
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
port++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue