From: Steven J. Hill Date: Thu, 20 Jun 2013 15:30:37 +0000 (-0500) Subject: ide: Fix IDE PIO size calculation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1581208b2f0643eebfa7a3fbe5bad831c0bb7f0e;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git ide: Fix IDE PIO size calculation IDE PIO calculates the size wrong when passing the parameter "ide-core.nodma=0.0" to the kernel. Signed-off-by: Leonid Yegoshin Acked-by: Steven J. Hill Signed-off-by: Steven J. Hill Signed-off-by: David S. Miller --- diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 729428edeba2..dabb88b1cbec 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);