Simply shift the size left by 1 when computing the transfer sizes.
This will always end with the values ..., 1, 0 as it should.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
if (retry--)
continue;
- /* if we are reading ONE sector and go here, just make it _faile_ */
- chunk = chunk == 1 ? 0 : ((chunk+1) >> 1);
+ /* For any starting value, this will always end with ..., 1, 0 */
+ chunk >>= 1;
if (chunk) {
MaxTransfer = chunk;
retry = RETRY_COUNT;
break;
if (retry--)
continue;
- chunk = chunk == 1 ? 0 : ((chunk+1) >> 1);
+
+ /* For any starting value, this will always end with ..., 1, 0 */
+ chunk >>= 1;
if (chunk) {
MaxTransfer = chunk;
retry = RETRY_COUNT;
pkt.blocks = chunk;
continue;
}
+
/*** XXX: Consider falling back to CHS here?! ***/
printf("reading sectors error(EDD)\n");
return done; /* Failure */