]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] aic7xxx: fix byte I/O order in ahd_inw
authorDenis Vlasenko <vda.linux@googlemail.com>
Mon, 25 Sep 2006 23:57:42 +0000 (16:57 -0700)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Sun, 1 Oct 2006 20:03:38 +0000 (15:03 -0500)
Comment says "Read high byte first as some registers increment..."
but code doesn't guarantee that, I think:
return ((ahd_inb(ahd, port+1) << 8) | ahd_inb(ahd, port));
Compiler can reorder it.

Make the order explicit.

Signed-off-by: Denis Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Fixed rejections and added aic7xxx code
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/aic7xxx/aic79xx_inline.h
drivers/scsi/aic7xxx/aic7xxx_inline.h

index 8ad3ce945b9e5f36b20953af23ff1717d64403a4..a3266e066c00ca707a856f6035aca10198779433 100644 (file)
@@ -527,7 +527,8 @@ ahd_inw(struct ahd_softc *ahd, u_int port)
         * or have other side effects when the low byte is
         * read.
         */
-       return ((ahd_inb(ahd, port+1) << 8) | ahd_inb(ahd, port));
+       uint16_t r = ahd_inb(ahd, port+1) << 8;
+       return r | ahd_inb(ahd, port);
 }
 
 static __inline void
index 2cc8a17ed8b4a565f7051fcef8238fe8329d8b38..8e1954cdd84f67cd114491ad0c0072d3aaec175f 100644 (file)
@@ -300,7 +300,8 @@ ahc_fetch_transinfo(struct ahc_softc *ahc, char channel, u_int our_id,
 static __inline uint16_t
 ahc_inw(struct ahc_softc *ahc, u_int port)
 {
-       return ((ahc_inb(ahc, port+1) << 8) | ahc_inb(ahc, port));
+       uint16_t r = ahc_inb(ahc, port+1) << 8;
+       return r | ahc_inb(ahc, port);
 }
 
 static __inline void