Commit 7b75b990 authored by Denis Vlasenko's avatar Denis Vlasenko Committed by James Bottomley

[SCSI] aic7xxx: fix byte I/O order in ahd_inw

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: default avatarDenis Vlasenko <vda.linux@googlemail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>

Fixed rejections and added aic7xxx code
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 02a0fa67
...@@ -527,7 +527,8 @@ ahd_inw(struct ahd_softc *ahd, u_int port) ...@@ -527,7 +527,8 @@ ahd_inw(struct ahd_softc *ahd, u_int port)
* or have other side effects when the low byte is * or have other side effects when the low byte is
* read. * 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 static __inline void
......
...@@ -300,7 +300,8 @@ ahc_fetch_transinfo(struct ahc_softc *ahc, char channel, u_int our_id, ...@@ -300,7 +300,8 @@ ahc_fetch_transinfo(struct ahc_softc *ahc, char channel, u_int our_id,
static __inline uint16_t static __inline uint16_t
ahc_inw(struct ahc_softc *ahc, u_int port) 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 static __inline void
......
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