]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-probe.c
ide: remove unnecessary MAX_HWIFS checks from ide-probe.c
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-probe.c
index 9926e12783bb8d997bdacc36745f3941329c3711..237b9871f80a6708f6169076976f981966e8456a 100644 (file)
@@ -116,7 +116,7 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
        ide_hwif_t *hwif = HWIF(drive);
        u16 *id = drive->id;
        char *m = (char *)&id[ATA_ID_PROD];
-       int bswap = 1;
+       int bswap = 1, is_cfa;
 
        /* read 512 bytes of id info */
        hwif->tp_ops->input_data(drive, NULL, id, SECTOR_SIZE);
@@ -212,17 +212,15 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
         * Not an ATAPI device: looks like a "regular" hard disk
         */
 
-       /*
-        * 0x848a = CompactFlash device
-        * These are *not* removable in Linux definition of the term
-        */
-       if (id[ATA_ID_CONFIG] != 0x848a && (id[ATA_ID_CONFIG] & (1 << 7)))
+       is_cfa = ata_id_is_cfa(id);
+
+       /* CF devices are *not* removable in Linux definition of the term */
+       if (is_cfa == 0 && (id[ATA_ID_CONFIG] & (1 << 7)))
                drive->removable = 1;
 
        drive->media = ide_disk;
 
-       printk(KERN_CONT "%s DISK drive\n",
-               (id[ATA_ID_CONFIG] == 0x848a) ? "CFA" : "ATA");
+       printk(KERN_CONT "%s DISK drive\n", is_cfa ? "CFA" : "ATA");
 
        return;
 
@@ -561,7 +559,7 @@ static inline u8 probe_for_drive (ide_drive_t *drive)
         *      Also note that 0 everywhere means "can't do X"
         */
  
-       drive->id = kzalloc(SECTOR_WORDS *4, GFP_KERNEL);
+       drive->id = kzalloc(SECTOR_SIZE, GFP_KERNEL);
        drive->id_read = 0;
        if(drive->id == NULL)
        {
@@ -849,7 +847,6 @@ static void ide_port_tune_devices(ide_hwif_t *hwif)
        }
 }
 
-#if MAX_HWIFS > 1
 /*
  * save_match() is used to simplify logic in init_irq() below.
  *
@@ -874,7 +871,6 @@ static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
        if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */
                *match = new;
 }
-#endif /* MAX_HWIFS > 1 */
 
 /*
  * init request queue
@@ -1031,7 +1027,7 @@ static int init_irq (ide_hwif_t *hwif)
 
        mutex_lock(&ide_cfg_mtx);
        hwif->hwgroup = NULL;
-#if MAX_HWIFS > 1
+
        /*
         * Group up with any other hwifs that share our irq(s).
         */
@@ -1056,7 +1052,7 @@ static int init_irq (ide_hwif_t *hwif)
                        }
                }
        }
-#endif /* MAX_HWIFS > 1 */
+
        /*
         * If we are still without a hwgroup, then form a new one
         */
@@ -1332,8 +1328,6 @@ static void hwif_register_devices(ide_hwif_t *hwif)
                if (!drive->present)
                        continue;
 
-               ide_add_generic_settings(drive);
-
                snprintf(dev->bus_id, BUS_ID_SIZE, "%u.%u", hwif->index, i);
                dev->parent = &hwif->gendev;
                dev->bus = &ide_bus_type;
@@ -1517,19 +1511,14 @@ static int ide_find_port_slot(const struct ide_port_info *d)
         * ports 0x1f0/0x170 (the ide0/ide1 defaults).
         */
        mutex_lock(&ide_cfg_mtx);
-       if (MAX_HWIFS == 1) {
-               if (ide_indexes == 0 && i == 0)
-                       idx = 1;
+       if (bootable) {
+               if ((ide_indexes | i) != (1 << MAX_HWIFS) - 1)
+                       idx = ffz(ide_indexes | i);
        } else {
-               if (bootable) {
-                       if ((ide_indexes | i) != (1 << MAX_HWIFS) - 1)
-                               idx = ffz(ide_indexes | i);
-               } else {
-                       if ((ide_indexes | 3) != (1 << MAX_HWIFS) - 1)
-                               idx = ffz(ide_indexes | 3);
-                       else if ((ide_indexes & 3) != 3)
-                               idx = ffz(ide_indexes);
-               }
+               if ((ide_indexes | 3) != (1 << MAX_HWIFS) - 1)
+                       idx = ffz(ide_indexes | 3);
+               else if ((ide_indexes & 3) != 3)
+                       idx = ffz(ide_indexes);
        }
        if (idx >= 0)
                ide_indexes |= (1 << idx);
@@ -1590,8 +1579,10 @@ struct ide_host *ide_host_alloc_all(const struct ide_port_info *d,
        if (hws[0])
                host->dev[0] = hws[0]->dev;
 
-       if (d)
+       if (d) {
+               host->init_chipset = d->init_chipset;
                host->host_flags = d->host_flags;
+       }
 
        return host;
 }