mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
To: <linux-ide@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <davem@davemloft.net>
Subject: [PATCH] IDE: bugfix of IDE PIO size calculation
Date: Fri, 10 May 2013 11:47:11 -0700	[thread overview]
Message-ID: <20130510184711.32151.70337.stgit@linux-yegoshin> (raw)

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 <yegoshin@mips.com>
Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
(imported from commit 43cee988ce0aa8d2ca1eec014d25f014e95eefe6)
(imported from commit d74805b8b12cada05df811e112eb7e3ec197d565)
---
 drivers/ide/ide-taskfile.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 729428e..dabb88b 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -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);



             reply	other threads:[~2013-05-10 18:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10 18:47 Leonid Yegoshin [this message]
2013-05-10 18:56 ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130510184711.32151.70337.stgit@linux-yegoshin \
    --to=leonid.yegoshin@imgtec.com \
    --cc=davem@davemloft.net \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®