ata_tf_read_block() question

From: Atsushi Nemoto
Date: Sat Aug 15 2009 - 09:48:53 EST


I have a question on CHS calculation in ata_tf_read_block().

The calculation in ata_tf_read_block() is:
block = (cyl * dev->heads + head) * dev->sectors + sect;

but ata_build_rw_tf() does:
track = (u32)block / dev->sectors;
cyl = track / dev->heads;
head = track % dev->heads;
sect = (u32)block % dev->sectors + 1;

It seems inconsistent. The correct calculation is:
block = (cyl * dev->heads + head) * dev->sectors + sect - 1;
isn't it?

I don't have any real problem. Just noticed by code reading.
---
Atsushi Nemoto
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/