Skip to contentSkip to conversation

IDE: bugfix of IDE PIO size calculation

PATCH In review Leonid Yegoshin 2 participants 2 messages May 10, 2013 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IDE: bugfix of IDE PIO size calculation

IDE PIO calculates size wrong.
Proven by test on MIPS Malta platform with multiple CPU types with bootparam flag "ide-core.nodma=0.0".

It is still needed to test non-DMA IO.

Change-Id: Id82c2bc5965d85960846db53d84846d9a05d75a3
Author: Leonid Yegoshin <[email protected]>

(imported from commit 43cee988ce0aa8d2ca1eec014d25f014e95eefe6) (imported from commit d74805b8b12cada05df811e112eb7e3ec197d565)

---
 drivers/ide/ide-taskfile.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/ide/ide-taskfile.c +2 -3
index 729428e..dabb88b 100644
@@ -239,9 +239,6 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
 		unsigned nr_bytes = min(len, cursg->length - cmd->cursg_ofs);
 		int page_is_high;
 
-		if (nr_bytes > PAGE_SIZE)
-			nr_bytes = PAGE_SIZE;
-
 		page = sg_page(cursg);
 		offset = cursg->offset + cmd->cursg_ofs;
 
@@ -249,6 +246,8 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
 		page = nth_page(page, (offset >> PAGE_SHIFT));
 		offset %= PAGE_SIZE;
 
+		nr_bytes = min_t(unsigned, nr_bytes, (PAGE_SIZE - offset));
+
 		page_is_high = PageHighMem(page);
 		if (page_is_high)
 			local_irq_save(flags);
#1 lore raw

Hello.

Quoted 7 lines · Leonid Yegoshin

IDE PIO calculates size wrong.
Proven by test on MIPS Malta platform with multiple CPU types with bootparam flag "ide-core.nodma=0.0".

It is still needed to test non-DMA IO.

Change-Id: Id82c2bc5965d85960846db53d84846d9a05d75a3

Please get rid of this line.

Quoted 1 line

Author: Leonid Yegoshin <[email protected]>

From: line at the start of message is used for that.

Quoted 3 lines

(imported from commit 43cee988ce0aa8d2ca1eec014d25f014e95eefe6) (imported from commit d74805b8b12cada05df811e112eb7e3ec197d565)

What are those two lines? Why are they here, in upstream patch?

WBR, Sergei