]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/ide/ide-probe.c
[PATCH] Switch all my contributions stuff to a single common address
[karo-tx-linux.git] / drivers / ide / ide-probe.c
index bce427ee08aa3286301ae8342e7a32b09abf5337..1649ea54f76ce7c194f7ec8f5016f132aec79d0f 100644 (file)
@@ -208,6 +208,9 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
                drive->ready_stat = 0;
                if (ata_id_cdb_intr(id))
                        drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT;
+               drive->dev_flags |= IDE_DFLAG_DOORLOCKING;
+               /* we don't do head unloading on ATAPI devices */
+               drive->dev_flags |= IDE_DFLAG_NO_UNLOAD;
                return;
        }
 
@@ -223,6 +226,9 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
 
        drive->media = ide_disk;
 
+       if (!ata_id_has_unload(drive->id))
+               drive->dev_flags |= IDE_DFLAG_NO_UNLOAD;
+
        printk(KERN_CONT "%s DISK drive\n", is_cfa ? "CFA" : "ATA");
 
        return;
@@ -652,8 +658,8 @@ static int ide_register_port(ide_hwif_t *hwif)
                goto out;
        }
 
-       hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev,
-                                             MKDEV(0, 0), hwif, hwif->name);
+       hwif->portdev = device_create(ide_port_class, &hwif->gendev,
+                                     MKDEV(0, 0), hwif, hwif->name);
        if (IS_ERR(hwif->portdev)) {
                ret = PTR_ERR(hwif->portdev);
                device_unregister(&hwif->gendev);
@@ -958,9 +964,9 @@ static void ide_add_drive_to_hwgroup(ide_drive_t *drive)
  * - allocate the block device queue
  * - link drive into the hwgroup
  */
-static void ide_port_setup_devices(ide_hwif_t *hwif)
+static int ide_port_setup_devices(ide_hwif_t *hwif)
 {
-       int i;
+       int i, j = 0;
 
        mutex_lock(&ide_cfg_mtx);
        for (i = 0; i < MAX_DRIVES; i++) {
@@ -972,12 +978,19 @@ static void ide_port_setup_devices(ide_hwif_t *hwif)
                if (ide_init_queue(drive)) {
                        printk(KERN_ERR "ide: failed to init %s\n",
                                        drive->name);
+                       kfree(drive->id);
+                       drive->id = NULL;
+                       drive->dev_flags &= ~IDE_DFLAG_PRESENT;
                        continue;
                }
 
+               j++;
+
                ide_add_drive_to_hwgroup(drive);
        }
        mutex_unlock(&ide_cfg_mtx);
+
+       return j;
 }
 
 static ide_hwif_t *ide_ports[MAX_HWIFS];
@@ -1663,10 +1676,13 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
                        continue;
                }
 
-               j++;
-
                if (hwif->present)
-                       ide_port_setup_devices(hwif);
+                       if (ide_port_setup_devices(hwif) == 0) {
+                               hwif->present = 0;
+                               continue;
+                       }
+
+               j++;
 
                ide_acpi_init(hwif);