[2.4 IDE PATCH] only use set_max when it is present

From: Meelis Roos
Date: Thu Apr 01 2004 - 13:34:20 EST


Credits to Kaupo Arulo: he debugged why he got ide errors about aborted
commands during disk detection (SanDisk flash) and found that
idedisk_read_native_max_address() is done regardless of whether the
drive supports it. This patch (by him) changes ide-disk.c to only try
set_max when the disk supports host protected area. Tested in 2.4.22 and
compile tested on 2.4.26-rc1.

===== drivers/ide/ide-disk.c 1.15 vs edited =====
--- 1.15/drivers/ide/ide-disk.c Thu Aug 14 00:14:34 2003
+++ edited/drivers/ide/ide-disk.c Thu Apr 1 21:14:22 2004
@@ -1161,14 +1161,14 @@
{
struct hd_driveid *id = drive->id;
unsigned long capacity = drive->cyl * drive->head * drive->sect;
- unsigned long set_max = idedisk_read_native_max_address(drive);
+ int have_setmax = idedisk_supports_host_protected_area(drive);
+ unsigned long set_max =
+ (have_setmax ? idedisk_read_native_max_address(drive) : 0);
unsigned long long capacity_2 = capacity;
unsigned long long set_max_ext;

drive->capacity48 = 0;
drive->select.b.lba = 0;
-
- (void) idedisk_supports_host_protected_area(drive);

if (id->cfs_enable_2 & 0x0400) {
capacity_2 = id->lba_capacity_2;

--
Meelis Roos (mroos@xxxxxxxx)

-
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/