Skip to contentSkip to conversation

de620.c: nitpicking

PATCH In review Arnaldo Carvalho de Melo 5 participants 16 messages Jan 8, 2001 – Jan 10, 2001

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 de620.c: nitpicking

Bjorn/Alan,

Yes, I'm a nitpicker ;)

drivers/net/de620.c +0 -1
@@ -563,7 +563,6 @@
 		printk(KERN_WARNING "%s: No tx-buffer available!\n", dev->name);
 		restore_flags(flags);
 		return 1;
-		break;
 	}
 	de620_write_block(dev, buffer, len);
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw

Hi,

Please consider applying, no need to restore_flags here, as it is
restored in the beginning of this if block.

- Arnaldo

drivers/scsi/53c7,8xx.c +0 -1
@@ -1899,7 +1899,6 @@
 		hostdata->script, start);
 	    printk ("scsi%d : DSPS = 0x%x\n", host->host_no,
 		NCR53c7x0_read32(DSPS_REG));
-	    restore_flags(flags);
 	    return -1;
 	}
     	hostdata->test_running = 0;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw

PATCH 1/1 tidy 53c7,8xx.c was Re: [PATCH] de620.c: nitpicking

In reply to Arnaldo Carvalho de Melo

ouch, sorry for the misleading subject, cut and paste sometimes doesn't work ;(

Em Mon, Jan 08, 2001 at 08:25:33PM -0200, Arnaldo Carvalho de Melo escreveu:

Quoted 11 lines

Hi,

Please consider applying, no need to restore_flags here, as it is
restored in the beginning of this if block.

- Arnaldo

drivers/scsi/53c7,8xx.c line 1904

Quoted 7 lines
drivers/scsi/53c7,8xx.c +0 -1
@@ -1899,7 +1899,6 @@
 		hostdata->script, start);
 	    printk ("scsi%d : DSPS = 0x%x\n", host->host_no,
 		NCR53c7x0_read32(DSPS_REG));
-	    restore_flags(flags);
 	    return -1;
 	}
     	hostdata->test_running = 0;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw

PATCH 1/1 advansys.c: include missing restore_flags, etc

In reply to Arnaldo Carvalho de Melo

Hi,

Please consider applying, comments in the patch.

- Arnaldo

drivers/scsi/advansys.c +28 -17
@@ -717,6 +717,13 @@
      Ken Mort <[email protected]> reported a DEBUG compile bug fixed
      in 3.2K.
 
+     Arnaldo Carvalho de Melo <[email protected]> fix issues
+     related to save_flags/restore_flags, some restore_flags and
+     DvcLeaveCritical were missing, use unsigned long flags instead
+     of int flags, a not needed cli commented out, like the sti
+     that matches it (in advansys_abort) - 08/01/2001
+     
+
   L. AdvanSys Contact Information
  
      Mail:                   Advanced System Products, Inc.
@@ -2098,8 +2105,8 @@
 STATIC uchar     AscGetChipIRQ(PortAddr, ushort);
 STATIC uchar     AscSetChipIRQ(PortAddr, uchar, ushort);
 STATIC ushort    AscGetChipBiosAddress(PortAddr, ushort);
-STATIC int       DvcEnterCritical(void);
-STATIC void      DvcLeaveCritical(int);
+STATIC unsigned long DvcEnterCritical(void);
+STATIC void      DvcLeaveCritical(unsigned long);
 STATIC void      DvcInPortWords(PortAddr, ushort *, int);
 STATIC void      DvcOutPortWords(PortAddr, ushort *, int);
 STATIC void      DvcOutPortDWords(PortAddr, ASC_DCNT *, int);
@@ -3103,8 +3110,8 @@
 /*
  * Device drivers must define the following functions.
  */
-STATIC int   DvcEnterCritical(void);
-STATIC void  DvcLeaveCritical(int);
+STATIC unsigned long  DvcEnterCritical(void);
+STATIC void  DvcLeaveCritical(unsigned long);
 STATIC void  DvcSleepMilliSecond(ADV_DCNT);
 STATIC uchar DvcAdvReadPCIConfigByte(ADV_DVC_VAR *, ushort);
 STATIC void  DvcAdvWritePCIConfigByte(ADV_DVC_VAR *, ushort, uchar);
@@ -5938,7 +5945,7 @@
 {
     struct Scsi_Host    *shp;
     asc_board_t         *boardp;
-    int                 flags;
+    unsigned long       flags;
     Scsi_Cmnd           *done_scp;
 
     shp = scp->host;
@@ -6033,7 +6040,7 @@
     asc_board_t         *boardp;
     ASC_DVC_VAR         *asc_dvc_varp;
     ADV_DVC_VAR         *adv_dvc_varp;
-    int                 flags;
+    unsigned long       flags;
     int                 do_scsi_done;
     int                 scp_found;
     Scsi_Cmnd           *done_scp = NULL;
@@ -6138,7 +6145,7 @@
                     ret = SCSI_ABORT_ERROR;
                     break;
                 }
-                cli();
+                /* cli(); XXX */
             } else {
                 /*
                  * Wide Board
@@ -6278,7 +6285,7 @@
     asc_board_t          *boardp;
     ASC_DVC_VAR          *asc_dvc_varp;
     ADV_DVC_VAR          *adv_dvc_varp;
-    int                  flags;
+    unsigned long        flags;
     Scsi_Cmnd            *done_scp = NULL, *last_scp = NULL;
     Scsi_Cmnd            *tscp, *new_last_scp;
     int                  do_scsi_done;
@@ -9954,10 +9961,10 @@
 #endif /* version < v2.1.0 */ 
 }
 
-STATIC int
+STATIC unsigned long
 DvcEnterCritical(void)
 {
-    int    flags;
+    unsigned long flags;
 
     save_flags(flags);
     cli();
@@ -9965,7 +9972,7 @@
 }
 
 STATIC void
-DvcLeaveCritical(int flags)
+DvcLeaveCritical(unsigned long flags)
 {
     restore_flags(flags);
 }
@@ -12173,7 +12180,7 @@
 )
 {
     PortAddr            iop_base;
-    int                 last_int_level;
+    unsigned long       last_int_level;
     int                 sta;
     int                 n_q_required;
     int                 disable_syn_offset_one_fix;
@@ -12235,6 +12242,7 @@
 #if !CC_VERY_LONG_SG_LIST
         if (sg_entry_cnt > ASC_MAX_SG_LIST)
         {
+            DvcLeaveCritical(last_int_level);
             return(ERR);
         }
 #endif /* !CC_VERY_LONG_SG_LIST */
@@ -13112,7 +13120,7 @@
     ASC_QDONE_INFO      scsiq_buf;
     ASC_QDONE_INFO *scsiq;
     ASC_ISR_CALLBACK    asc_isr_callback;
-    int                 last_int_level;
+    unsigned long       last_int_level;
 
     iop_base = asc_dvc->iop_base;
     asc_isr_callback = asc_dvc->isr_callback;
@@ -13137,6 +13145,7 @@
                             (ushort) (q_addr + (ushort) ASC_SCSIQ_B_STATUS),
                                  scsiq->q_status);
                 (*asc_isr_callback) (asc_dvc, scsiq);
+    		DvcLeaveCritical(last_int_level);
                 return (1);
             }
         }
@@ -13158,7 +13167,7 @@
     ASC_QDONE_INFO      scsiq_buf;
     ASC_QDONE_INFO *scsiq;
     ASC_ISR_CALLBACK    asc_isr_callback;
-    int                 last_int_level;
+    unsigned long       last_int_level;
 
     iop_base = asc_dvc->iop_base;
     asc_isr_callback = asc_dvc->isr_callback;
@@ -17570,7 +17579,7 @@
 AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc,
                 ADV_SCSI_REQ_Q *scsiq)
 {
-    int                    last_int_level;
+    unsigned long          last_int_level;
     AdvPortAddr            iop_base;
     ADV_DCNT               req_size;
     ADV_PADDR              req_paddr;
@@ -17598,6 +17607,7 @@
      */
     if ((new_carrp = asc_dvc->carr_freelist) == NULL)
     {
+       DvcLeaveCritical(last_int_level);
        return ADV_BUSY;
     }
     asc_dvc->carr_freelist =
@@ -17835,7 +17845,7 @@
     ushort                      target_bit;
     ADV_CARR_T                  *free_carrp;
     ADV_VADDR                   irq_next_vpa;
-    int                         flags;
+    unsigned long               flags;
     ADV_SCSI_REQ_Q              *scsiq;
 
     flags = DvcEnterCritical();
@@ -17848,6 +17858,7 @@
     if ((int_stat & (ADV_INTR_STATUS_INTRA | ADV_INTR_STATUS_INTRB |
          ADV_INTR_STATUS_INTRC)) == 0)
     {
+        DvcLeaveCritical(flags);
         return ADV_FALSE;
     }
 
@@ -17982,7 +17993,7 @@
                ushort idle_cmd,
                ADV_DCNT idle_cmd_parameter)
 {
-    int         last_int_level;
+    unsigned long last_int_level;
     int         result;
     ADV_DCNT    i, j;
     AdvPortAddr iop_base;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#4 lore raw

Re: [PATCH] advansys.c: include missing restore_flags, etc

Quoted 1 line · Arnaldo Carvalho de Melo

Please consider applying, comments in the patch.

Can't the following be fixed properly?

drivers/scsi/advansys.c line 9970

Quoted 9 lines
drivers/scsi/advansys.c +2 -2
-STATIC int
+STATIC unsigned long
 DvcEnterCritical(void)
 {
-    int    flags;
+    unsigned long flags;
 
     save_flags(flags);
     cli();

Guess what happens here?

    return flags;

drivers/scsi/advansys.c line 9978

Quoted 9 lines
drivers/scsi/advansys.c +1 -1
@@ -9965,7 +9972,7 @@
 }
 
 STATIC void
-DvcLeaveCritical(int flags)
+DvcLeaveCritical(unsigned long flags)
 {
     restore_flags(flags);
 }

The above doesn't work on some architectures. Its better to use a macro if you want to separate this out. ie, something like (davem will have to okay it tho):

#define DvcEnterCritical() \
({ unsigned long __flags; save_flags(__flags); cli(); __flags; })

#define DvcLeaveCritical(flags) \
do { restore_flags(flags); } while (0)

This should then ensure that you don't end up with problems associated with register windows on the sparc or whatever. Even better would be to use a spinlock instead of Dvc?????Critical.
_____

  |_____| ------------------------------------------------- ---+---+-
  |   |         Russell King        [email protected]      --- ---
  | | | | http://www.arm.linux.org.uk/personal/aboutme.html   /  /  |
  | +-+-+                                                     --- -+-
  /   |               THE developer of ARM Linux              |+| /|\
 /  | | |                                                     ---  |
    +-+-+ -------------------------------------------------  /\\\  |

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#5 lore raw

Re: [PATCH] advansys.c: include missing restore_flags, etc

In reply to Arnaldo Carvalho de Melo
Quoted 20 lines · Arnaldo Carvalho de Melo

Hi,

Please consider applying, comments in the patch.

- Arnaldo

drivers/scsi/advansys.c +2 -2
 
-STATIC int
+STATIC unsigned long
 DvcEnterCritical(void)
 {
-    int    flags;
+    unsigned long flags;
 
     save_flags(flags);
     cli();

drivers/scsi/advansys.c line 9972

Quoted 1 line
drivers/scsi/advansys.c +0 -0
@@ -9965,7 +9972,7 @@
 }

Err, according tho wise ppl on this list, this does not work on MIPSes. The flags thing must stay in the same stackframe.

(I know, not your fault, but since you are patching the driver...)

drivers/scsi/advansys.c line 9977

Quoted 6 lines
drivers/scsi/advansys.c +1 -1
 STATIC void
-DvcLeaveCritical(int flags)
+DvcLeaveCritical(unsigned long flags)
 {
     restore_flags(flags);
 }

Item.

Met vriendelijke groet,
Pauline Middelink

Signature · 6 lines
GPG Key fingerprint = 2D5B 87A7 DDA6 0378 5DEA  BD3B 9A50 B416 E2D0 C3C2
For more details look at my website http://www.polyware.nl/~middelink
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#6 lore raw

Re: [PATCH] advansys.c: include missing restore_flags, etc

Quoted 7 lines

Review line 9972

Quoted 4 lines
     save_flags(flags);
     cli();
(quoted diff) +0 -0
@@ -9965,7 +9972,7 @@
 }

Err, according tho wise ppl on this list, this does not work on MIPSes. The flags thing must stay in the same stackframe.

Certainly doesnt work on sparc32, but then it didnt before. Inline it might -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw

Re: [PATCH] advansys.c: include missing restore_flags, etc

In reply to Pauline Middelink
Quoted 9 lines · Alan Cox
Quoted 7 lines

Review line 9972

Quoted 4 lines
     save_flags(flags);
     cli();
(quoted diff) +0 -0
@@ -9965,7 +9972,7 @@
 }

Err, according tho wise ppl on this list, this does not work on MIPSes. The flags thing must stay in the same stackframe.

Certainly doesnt work on sparc32, but then it didnt before. Inline it might

Oops my bad. Sparc it is.

Met vriendelijke groet,
Pauline Middelink

Signature · 6 lines
GPG Key fingerprint = 2D5B 87A7 DDA6 0378 5DEA  BD3B 9A50 B416 E2D0 C3C2
For more details look at my website http://www.polyware.nl/~middelink
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#8 lore raw

Re: [PATCH] advansys.c: include missing restore_flags, etc

In reply to Arnaldo Carvalho de Melo

Em Tue, Jan 09, 2001 at 08:30:07AM +0100, Pauline Middelink escreveu:

Quoted 14 lines

Review line 9972

Quoted 10 lines
(quoted diff) +2 -1
+STATIC unsigned long
 DvcEnterCritical(void)
 {
-    int    flags;
+    unsigned long flags;
 
     save_flags(flags);
     cli();
@@ -9965,7 +9972,7 @@
 }

Err, according tho wise ppl on this list, this does not work on MIPSes. The flags thing must stay in the same stackframe.

Quoted 1 line

(I know, not your fault, but since you are patching the driver...)

yap, know that, just thought that this beast was only for i386, will submit another patch, and I think that some other drivers does this as well...

- Arnaldo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#9 lore raw

PATCH 1/1 ad1848.c: include missing restore_flags

In reply to Arnaldo Carvalho de Melo

Alan,

Please apply.

- Arnaldo

drivers/sound/ad1848.c +2 -0
@@ -28,6 +28,7 @@
  *		          of irqs. Use dev_id.
  * Christoph Hellwig	: adapted to module_init/module_exit
  * Aki Laukkanen	: added power management support
+ * Arnaldo C. de Melo	: added missing restore_flags in ad1848_resume
  *
  * Status:
  *		Tested. Believed fully functional.
@@ -2751,6 +2752,7 @@
 		bits = interrupt_bits[devc->irq];
 		if (bits == -1) {
 			printk(KERN_ERR "MSS: Bad IRQ %d\n", devc->irq);
+			restore_flags(flags);
 			return -1;
 		}
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#10 lore raw

PATCH 1/1 sscape.c: include missing restore_flags

In reply to Arnaldo Carvalho de Melo

Alan,

Please apply.

- Arnaldo

drivers/sound/sscape.c +5 -1
@@ -16,6 +16,7 @@
  * Christoph Hellwig	: adapted to module_init/module_exit
  * Bartlomiej Zolnierkiewicz : added __init to attach_sscape()
  * Chris Rankin		: Specify that this module owns the coprocessor
+ * Arnaldo C. de Melo	: added missing restore_flags in sscape_pnp_upload_file
  */
 
 #include <linux/init.h>
@@ -969,7 +970,10 @@
 		memcpy(devc->raw_buf, dt, l); dt += l;
 		sscape_start_dma(devc->dma, devc->raw_buf_phys, l, 0x48);
 		sscape_pnp_start_dma ( devc, 0 );
-		if (sscape_pnp_wait_dma ( devc, 0 ) == 0) return 0;
+		if (sscape_pnp_wait_dma ( devc, 0 ) == 0) {
+			restore_flags(flags);	    
+			return 0;
+		}
 	}
 	
 	restore_flags(flags);	    

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#11 lore raw

PATCH 1/1 via-macii.c: restore_flags on failure

In reply to Arnaldo Carvalho de Melo

Hi,

Please consider applying.

- Arnaldo

drivers/macintosh/via-macii.c +8 -4
@@ -9,6 +9,9 @@
  *
  * Rewrite for Unified ADB by Joshua M. Thompson ([email protected])
  *
+ * Arnaldo Carvalho de Melo <[email protected]>
+ * - restore_flags on failure in macii_init - 09/01/2001
+ *
  * 1999-08-02 (jmt) - Initial rewrite for Unified ADB.
  */
  
@@ -147,15 +150,16 @@
 	cli();
 	
 	err = macii_init_via();
-	if (err) return err;
+	if (err) goto out;
 
 	err = request_irq(IRQ_MAC_ADB, macii_interrupt, IRQ_FLG_LOCK, "ADB",
 		    macii_interrupt);
-	if (err) return err;
+	if (err) goto out;
 
 	macii_state = idle;
-	restore_flags(flags);	
-	return 0;
+	err = 0;
+out:	restore_flags(flags);	
+	return err;
 }
 
 /* initialize the hardware */	

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#12 lore raw

PATCH 1/1 dn_keyb.c: restore_flags on failure

In reply to Arnaldo Carvalho de Melo

Alan,

Please consider applying. I don't who is the maintainer, no
references in the driver, CREDITS or MAINTAINERS

- Arnaldo

drivers/char/dn_keyb.c +2 -3
@@ -435,15 +435,14 @@
 	for(;length;length--) {
 		keyb_cmds[keyb_cmd_write++]=*(cmd++);
 		if(keyb_cmd_write==keyb_cmd_read)
-			return;
+			goto out;
 		if(keyb_cmd_write==APOLLO_KEYB_CMD_ENTRIES)
 			keyb_cmd_write=0;
 	}
 	if(!keyb_cmd_transmit)  {
  	   sio01.BRGtest_cra=5;
 	}
-	restore_flags(flags);
-
+out:	restore_flags(flags);
 }
 
 static struct busmouse apollo_mouse = {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#13 lore raw

Re: [PATCH] dn_keyb.c: restore_flags on failure

Quoted 4 lines
drivers/char/dn_keyb.c +0 -1
 		keyb_cmds[keyb_cmd_write++]=*(cmd++);
 		if(keyb_cmd_write==keyb_cmd_read)
-			return;

# + goto out;

Hans Grobler beat you to this one
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#14 lore raw

Re: [PATCH] dn_keyb.c: restore_flags on failure

In reply to Arnaldo Carvalho de Melo

Em Tue, Jan 09, 2001 at 04:17:30PM +0000, Alan Cox escreveu:

Quoted 6 lines
Quoted 4 lines
drivers/char/dn_keyb.c +0 -1
 		keyb_cmds[keyb_cmd_write++]=*(cmd++);
 		if(keyb_cmd_write==keyb_cmd_read)
-			return;

# + goto out;

Hans Grobler beat you to this one

Ok, I'll talk with him in private to have a proper janitor union, avoiding duplicate work, I'll talk with Panin too 8)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#15 lore raw

Re: [PATCH] advansys.c: include missing restore_flags, etc

In reply to Arnaldo Carvalho de Melo
Quoted 7 lines · Pauline Middelink
Quoted 7 lines
(quoted diff) +2 -2
-STATIC int
+STATIC unsigned long
 DvcEnterCritical(void)
 {
-    int    flags;
+    unsigned long flags;
Quoted 7 lines

Review line 9972

Quoted 4 lines
     save_flags(flags);
     cli();
(quoted diff) +0 -0
@@ -9965,7 +9972,7 @@
 }

Err, according tho wise ppl on this list, this does not work on MIPSes. The flags thing must stay in the same stackframe.

Nope, that's on Sparc.

Quoted 8 lines

Review line 9977

Quoted 6 lines
(quoted diff) +1 -1
 STATIC void
-DvcLeaveCritical(int flags)
+DvcLeaveCritical(unsigned long flags)
 {
     restore_flags(flags);
 }

Item.

My Latin teach says it's ``idem''.

Ralf

--
"Embrace, Enhance, Eliminate" - it worked for the pope, it'll work for Bill. -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/