Skip to content

Commit

Permalink
[SCSI] aic7xxx: fix byte I/O order in ahd_inw
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Denis Vlasenko authored and James Bottomley committed Oct 1, 2006
1 parent 02a0fa6 commit 7b75b99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion drivers/scsi/aic7xxx/aic79xx_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion drivers/scsi/aic7xxx/aic7xxx_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7b75b99

Please sign in to comment.