Skip to content

Commit 1581208

Browse files
Steven J. Hilldavem330
authored andcommitted
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 <Leonid.Yegoshin@imgtec.com> Acked-by: Steven J. Hill <Steven.Hill@imgtec.com> Signed-off-by: Steven J. Hill <sjhill@mips.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 99bfdd8 commit 1581208

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎drivers/ide/ide-taskfile.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,15 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
239239
unsigned nr_bytes = min(len, cursg->length - cmd->cursg_ofs);
240240
int page_is_high;
241241

242-
if (nr_bytes > PAGE_SIZE)
243-
nr_bytes = PAGE_SIZE;
244-
245242
page = sg_page(cursg);
246243
offset = cursg->offset + cmd->cursg_ofs;
247244

248245
/* get the current page and offset */
249246
page = nth_page(page, (offset >> PAGE_SHIFT));
250247
offset %= PAGE_SIZE;
251248

249+
nr_bytes = min_t(unsigned, nr_bytes, (PAGE_SIZE - offset));
250+
252251
page_is_high = PageHighMem(page);
253252
if (page_is_high)
254253
local_irq_save(flags);

0 commit comments

Comments
 (0)