Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147095
b: refs/heads/master
c: 2102d74
h: refs/heads/master
i:
  147093: 07722c7
  147091: d109a9c
  147087: ba1c1a0
v: v3
  • Loading branch information
Sergei Shtylyov authored and Jeff Garzik committed Jun 10, 2009
1 parent 310e55f commit 68aae63
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4da646b7b52552f3b43eae27ffa5aa2c200f6db6
refs/heads/master: 2102d7497393e982bf38ffe8f5fd3d487104880d
20 changes: 13 additions & 7 deletions trunk/drivers/ata/libata-sff.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,17 +727,23 @@ unsigned int ata_sff_data_xfer(struct ata_device *dev, unsigned char *buf,
else
iowrite16_rep(data_addr, buf, words);

/* Transfer trailing 1 byte, if any. */
/* Transfer trailing byte, if any. */
if (unlikely(buflen & 0x01)) {
__le16 align_buf[1] = { 0 };
unsigned char *trailing_buf = buf + buflen - 1;
unsigned char pad[2];

/* Point buf to the tail of buffer */
buf += buflen - 1;

/*
* Use io*16_rep() accessors here as well to avoid pointlessly
* swapping bytes to and fro on the big endian machines...
*/
if (rw == READ) {
align_buf[0] = cpu_to_le16(ioread16(data_addr));
memcpy(trailing_buf, align_buf, 1);
ioread16_rep(data_addr, pad, 1);
*buf = pad[0];
} else {
memcpy(align_buf, trailing_buf, 1);
iowrite16(le16_to_cpu(align_buf[0]), data_addr);
pad[0] = *buf;
iowrite16_rep(data_addr, pad, 1);
}
words++;
}
Expand Down

0 comments on commit 68aae63

Please sign in to comment.