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

[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
Loading
Loading
Loading
Loading
+340 −335
Original line number Diff line number Diff line
@@ -1053,60 +1053,16 @@ detect_isa_irq(void __iomem *address)
}
#endif /* CONFIG_ISA */

/* 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)
static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
		void __iomem *base_addr, int status, int index)
{
  struct tty_struct *tty;
  int status;
  struct cyclades_card *cinfo;
	struct cyclades_port *info;
  void __iomem *base_addr, *card_base_addr;
  int chip;
	struct tty_struct *tty;
	volatile int char_count;
	int i, j, len, mdm_change, mdm_status, outch;
	int save_xir, channel, save_car;
	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 */
#ifdef CY_DEBUG_INTERRUPTS
	    printk("cyy_interrupt: rcvd intr, chip %d\n\r", chip);
@@ -1150,7 +1106,7 @@ cyy_interrupt(int irq, void *dev_id)

		    if(data & info->ignore_status_mask){
			info->icount.rx++;
                                continue;
			return;
		    }
		    if (tty_buffer_request_room(tty, 1)) {
			if (data & info->read_status_mask){
@@ -1430,8 +1386,57 @@ cyy_interrupt(int irq, void *dev_id)
	    cy_writeb(base_addr+(CyCAR<<index), save_car);
	    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);

   /* clear interrupts */