--- /usr/src/linux-2.4.21-0.pre3.1mdk/drivers/scsi/ide-scsi.c	2003-01-16 19:17:53.000000000 +0300
+++ linux-2.4.21-0.pre3.1mdk/drivers/scsi/ide-scsi.c	2003-01-22 22:13:07.000000000 +0300
@@ -733,16 +733,7 @@
 int idescsi_attach (ide_drive_t *drive)
 {
 	idescsi_scsi_t *scsi;
-	u8 media[] = {	TYPE_DISK,		/* 0x00 */
-			TYPE_TAPE,		/* 0x01 */
-			TYPE_PRINTER,		/* 0x02 */
-			TYPE_PROCESSOR,		/* 0x03 */
-			TYPE_WORM,		/* 0x04 */
-			TYPE_ROM,		/* 0x05 */
-			TYPE_SCANNER,		/* 0x06 */
-			TYPE_MOD,		/* 0x07 */
-			255};
-	int i = 0, ret = 0, id = 0;
+	int ret = 0, id = 0;
 //	int id = 2 * HWIF(drive)->index + drive->select.b.unit;
 //	int id = drive_count + 1;
 
@@ -763,13 +754,6 @@
 
 	MOD_INC_USE_COUNT;
 
-	for (i = 0; media[i] != 255; i++) {
-		if (drive->media != media[i])
-			continue;
-		else
-			break;
-	}
-
 	if ((scsi = (idescsi_scsi_t *) kmalloc(sizeof(idescsi_scsi_t), GFP_KERNEL)) == NULL) {
 		printk(KERN_ERR "ide-scsi: %s: Can't allocate a scsi "
 			"structure\n", drive->name);
@@ -793,26 +777,21 @@
 	return ret;
 }
 
-#ifdef MODULE
 /* options */
 char *ignore = NULL;
-
 MODULE_PARM(ignore, "s");
-#endif
 
 int idescsi_init (void)
 {
 #ifdef CLASSIC_BUILTINS_METHOD
 	ide_drive_t *drive;
 	idescsi_scsi_t *scsi;
-	u8 media[] = {  TYPE_DISK,		/* 0x00 */
-			TYPE_TAPE,		/* 0x01 */
-			TYPE_PRINTER,		/* 0x02 */
-			TYPE_PROCESSOR,		/* 0x03 */
-			TYPE_WORM,		/* 0x04 */
-			TYPE_ROM,		/* 0x05 */
-			TYPE_SCANNER,		/* 0x06 */
-			TYPE_MOD,		/* 0x07 */
+	u8 media[] = {	/* ide_disk, we do not support IDE disks for now */
+			ide_optical,
+			ide_cdrom,
+			ide_tape,
+			ide_floppy,
+			/* ide_scsi - should we scan for it as well? */
 			255};
 
 	int i, failed, id;
@@ -827,14 +806,24 @@
 		failed = 0;
 		while ((drive = ide_scan_devices(media[i],
 				idescsi_driver.name, NULL, failed++)) != NULL) {
-#ifdef MODULE
+                        /*
+                         * Do not claim unowned drives. If everything
+                         * is compiled as module it results in ide-scsi
+                         * taking over everything when it is loaded.
+                         * Check that ide-scsi is explicitly requested.
+			 * Respect ignore parameter - assume user knows
+			 * what (s)he's doing
+                         */
+                        if (!ignore &&
+			    (!drive->driver_req || !*drive->driver_req))
+                                continue;
+
 			/* skip drives we were told to ignore */
-			if (ignore != NULL && strstr(ignore, drive->name)) {
+			if (ignore && strstr(ignore, drive->name)) {
 				printk("ide-scsi: ignoring drive %s\n",
 					drive->name);
 				continue;
 			}
-#endif
 
 		if ((scsi = (idescsi_scsi_t *) kmalloc(sizeof(idescsi_scsi_t), GFP_KERNEL)) == NULL) {
 				printk(KERN_ERR "ide-scsi: %s: Can't allocate "
@@ -1133,7 +1122,13 @@
 static void __exit exit_idescsi_module(void)
 {
 	ide_drive_t *drive;
-	u8 media[] = {TYPE_DISK, TYPE_TAPE, TYPE_PROCESSOR, TYPE_WORM, TYPE_ROM, TYPE_SCANNER, TYPE_MOD, 255};
+	u8 media[] = {	/* ide_disk, we do not support IDE disks for now */
+			ide_optical,
+			ide_cdrom,
+			ide_tape,
+			ide_floppy,
+			/* ide_scsi - should we scan for it as well? */
+			255};
 	int i, failed;
 
 	scsi_unregister_module(MODULE_SCSI_HA, &idescsi_template);
