Commit e941027f authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

[PATCH] Char: cyclades, save indent levels

Save 3 indent levels in interrupt routine by moving the code to a separate
function.  This needs to be done to allow Lindent do its work, since only 4
columns are used for indenting now and hence Lindent makes a big mess in the
code, when moves it 4*5 columns to the right.
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ff8efe97
...@@ -1053,60 +1053,16 @@ detect_isa_irq(void __iomem *address) ...@@ -1053,60 +1053,16 @@ detect_isa_irq(void __iomem *address)
} }
#endif /* CONFIG_ISA */ #endif /* CONFIG_ISA */
/* The real interrupt service routine is called static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
whenever the card wants its hand held--chars void __iomem *base_addr, int status, int index)
received, out buffer empty, modem change, etc.
*/
static irqreturn_t
cyy_interrupt(int irq, void *dev_id)
{ {
struct tty_struct *tty;
int status;
struct cyclades_card *cinfo;
struct cyclades_port *info; struct cyclades_port *info;
void __iomem *base_addr, *card_base_addr; struct tty_struct *tty;
int chip; volatile int char_count;
int i, j, len, mdm_change, mdm_status, outch;
int save_xir, channel, save_car; int save_xir, channel, save_car;
char data; char data;
volatile int char_count;
int outch;
int i,j,index;
int too_many;
int had_work;
int mdm_change;
int mdm_status;
int len;
if((cinfo = (struct cyclades_card *)dev_id) == 0){
#ifdef CY_DEBUG_INTERRUPTS
printk("cyy_interrupt: spurious interrupt %d\n\r", irq);
#endif
return IRQ_NONE; /* spurious interrupt */
}
card_base_addr = cinfo->base_addr;
index = cinfo->bus_index;
/* This loop checks all chips in the card. Make a note whenever
_any_ chip had some work to do, as this is considered an
indication that there will be more to do. Only when no chip
has any work does this outermost loop exit.
*/
do{
had_work = 0;
for ( chip = 0 ; chip < cinfo->num_chips ; chip ++) {
base_addr = cinfo->base_addr + (cy_chip_offset[chip]<<index);
too_many = 0;
while ( (status = cy_readb(base_addr+(CySVRR<<index))) != 0x00) {
had_work++;
/* The purpose of the following test is to ensure that
no chip can monopolize the driver. This forces the
chips to be checked in a round-robin fashion (after
draining each of a bunch (1000) of characters).
*/
if(1000<too_many++){
break;
}
if (status & CySRReceive) { /* reception interrupt */ if (status & CySRReceive) { /* reception interrupt */
#ifdef CY_DEBUG_INTERRUPTS #ifdef CY_DEBUG_INTERRUPTS
printk("cyy_interrupt: rcvd intr, chip %d\n\r", chip); printk("cyy_interrupt: rcvd intr, chip %d\n\r", chip);
...@@ -1150,7 +1106,7 @@ cyy_interrupt(int irq, void *dev_id) ...@@ -1150,7 +1106,7 @@ cyy_interrupt(int irq, void *dev_id)
if(data & info->ignore_status_mask){ if(data & info->ignore_status_mask){
info->icount.rx++; info->icount.rx++;
continue; return;
} }
if (tty_buffer_request_room(tty, 1)) { if (tty_buffer_request_room(tty, 1)) {
if (data & info->read_status_mask){ if (data & info->read_status_mask){
...@@ -1345,11 +1301,11 @@ cyy_interrupt(int irq, void *dev_id) ...@@ -1345,11 +1301,11 @@ cyy_interrupt(int irq, void *dev_id)
} }
} }
txdone: txdone:
if (info->xmit_cnt < WAKEUP_CHARS) { if (info->xmit_cnt < WAKEUP_CHARS) {
cy_sched_event(info, Cy_EVENT_WRITE_WAKEUP); cy_sched_event(info, Cy_EVENT_WRITE_WAKEUP);
} }
txend: txend:
/* end of service */ /* end of service */
cy_writeb(base_addr+(CyTIR<<index), cy_writeb(base_addr+(CyTIR<<index),
(save_xir & 0x3f)); (save_xir & 0x3f));
...@@ -1430,8 +1386,57 @@ cyy_interrupt(int irq, void *dev_id) ...@@ -1430,8 +1386,57 @@ cyy_interrupt(int irq, void *dev_id)
cy_writeb(base_addr+(CyCAR<<index), save_car); cy_writeb(base_addr+(CyCAR<<index), save_car);
spin_unlock(&cinfo->card_lock); spin_unlock(&cinfo->card_lock);
} }
} /* end while status != 0 */ }
} /* end loop for chips... */
/* The real interrupt service routine is called
whenever the card wants its hand held--chars
received, out buffer empty, modem change, etc.
*/
static irqreturn_t
cyy_interrupt(int irq, void *dev_id)
{
int status;
struct cyclades_card *cinfo;
void __iomem *base_addr, *card_base_addr;
int chip;
int index;
int too_many;
int had_work;
if((cinfo = (struct cyclades_card *)dev_id) == 0){
#ifdef CY_DEBUG_INTERRUPTS
printk("cyy_interrupt: spurious interrupt %d\n\r", irq);
#endif
return IRQ_NONE; /* spurious interrupt */
}
card_base_addr = cinfo->base_addr;
index = cinfo->bus_index;
/* This loop checks all chips in the card. Make a note whenever
_any_ chip had some work to do, as this is considered an
indication that there will be more to do. Only when no chip
has any work does this outermost loop exit.
*/
do{
had_work = 0;
for ( chip = 0 ; chip < cinfo->num_chips ; chip ++) {
base_addr = cinfo->base_addr + (cy_chip_offset[chip]<<index);
too_many = 0;
while ( (status = cy_readb(base_addr+(CySVRR<<index))) != 0x00) {
had_work++;
/* The purpose of the following test is to ensure that
no chip can monopolize the driver. This forces the
chips to be checked in a round-robin fashion (after
draining each of a bunch (1000) of characters).
*/
if(1000<too_many++){
break;
}
cyy_intr_chip(cinfo, chip, base_addr, status, index);
}
}
} while(had_work); } while(had_work);
/* clear interrupts */ /* clear interrupts */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment