diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-sff.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index bb18415d3d63..bbbb1fab1755 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -727,17 +727,23 @@ unsigned int ata_sff_data_xfer(struct ata_device *dev, unsigned char *buf, | |||
727 | else | 727 | else |
728 | iowrite16_rep(data_addr, buf, words); | 728 | iowrite16_rep(data_addr, buf, words); |
729 | 729 | ||
730 | /* Transfer trailing 1 byte, if any. */ | 730 | /* Transfer trailing byte, if any. */ |
731 | if (unlikely(buflen & 0x01)) { | 731 | if (unlikely(buflen & 0x01)) { |
732 | __le16 align_buf[1] = { 0 }; | 732 | unsigned char pad[2]; |
733 | unsigned char *trailing_buf = buf + buflen - 1; | ||
734 | 733 | ||
734 | /* Point buf to the tail of buffer */ | ||
735 | buf += buflen - 1; | ||
736 | |||
737 | /* | ||
738 | * Use io*16_rep() accessors here as well to avoid pointlessly | ||
739 | * swapping bytes to and fro on the big endian machines... | ||
740 | */ | ||
735 | if (rw == READ) { | 741 | if (rw == READ) { |
736 | align_buf[0] = cpu_to_le16(ioread16(data_addr)); | 742 | ioread16_rep(data_addr, pad, 1); |
737 | memcpy(trailing_buf, align_buf, 1); | 743 | *buf = pad[0]; |
738 | } else { | 744 | } else { |
739 | memcpy(align_buf, trailing_buf, 1); | 745 | pad[0] = *buf; |
740 | iowrite16(le16_to_cpu(align_buf[0]), data_addr); | 746 | iowrite16_rep(data_addr, pad, 1); |
741 | } | 747 | } |
742 | words++; | 748 | words++; |
743 | } | 749 | } |