]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-probe.c
V4L/DVB (8957): zr36067: Restore the default pixel format
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-probe.c
index 482f41f3f15ebd0680752526809294460359b5fb..994e41099b42e5e95ed08cce0154bb89b6e727b0 100644 (file)
@@ -39,8 +39,6 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
-static ide_hwif_t ide_hwifs[MAX_HWIFS]; /* master data repository */
-
 /**
  *     generic_id              -       add a generic drive id
  *     @drive: drive to make an ID block for
@@ -136,18 +134,6 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
 #endif
        ide_fix_driveid(id);
 
-#if defined (CONFIG_SCSI_EATA_PIO) || defined (CONFIG_SCSI_EATA)
-       /*
-        * EATA SCSI controllers do a hardware ATA emulation:
-        * Ignore them if there is a driver for them available.
-        */
-       if ((id->model[0] == 'P' && id->model[1] == 'M') ||
-           (id->model[0] == 'S' && id->model[1] == 'K')) {
-               printk("%s: EATA SCSI HBA %.10s\n", drive->name, id->model);
-               goto err_misc;
-       }
-#endif /* CONFIG_SCSI_EATA || CONFIG_SCSI_EATA_PIO */
-
        /*
         *  WIN_IDENTIFY returns little-endian info,
         *  WIN_PIDENTIFY *usually* returns little-endian info.
@@ -169,7 +155,8 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
        if (strstr(id->model, "E X A B Y T E N E S T"))
                goto err_misc;
 
-       printk("%s: %s, ", drive->name, id->model);
+       printk(KERN_INFO "%s: %s, ", drive->name, id->model);
+
        drive->present = 1;
        drive->dead = 0;
 
@@ -178,16 +165,17 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
         */
        if (cmd == WIN_PIDENTIFY) {
                u8 type = (id->config >> 8) & 0x1f;
-               printk("ATAPI ");
+
+               printk(KERN_CONT "ATAPI ");
                switch (type) {
                        case ide_floppy:
                                if (!strstr(id->model, "CD-ROM")) {
                                        if (!strstr(id->model, "oppy") &&
                                            !strstr(id->model, "poyp") &&
                                            !strstr(id->model, "ZIP"))
-                                               printk("cdrom or floppy?, assuming ");
+                                               printk(KERN_CONT "cdrom or floppy?, assuming ");
                                        if (drive->media != ide_cdrom) {
-                                               printk ("FLOPPY");
+                                               printk(KERN_CONT "FLOPPY");
                                                drive->removable = 1;
                                                break;
                                        }
@@ -200,25 +188,25 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
                                /* kludge for Apple PowerBook internal zip */
                                if (!strstr(id->model, "CD-ROM") &&
                                    strstr(id->model, "ZIP")) {
-                                       printk ("FLOPPY");
+                                       printk(KERN_CONT "FLOPPY");
                                        type = ide_floppy;
                                        break;
                                }
 #endif
-                               printk ("CD/DVD-ROM");
+                               printk(KERN_CONT "CD/DVD-ROM");
                                break;
                        case ide_tape:
-                               printk ("TAPE");
+                               printk(KERN_CONT "TAPE");
                                break;
                        case ide_optical:
-                               printk ("OPTICAL");
+                               printk(KERN_CONT "OPTICAL");
                                drive->removable = 1;
                                break;
                        default:
-                               printk("UNKNOWN (type %d)", type);
+                               printk(KERN_CONT "UNKNOWN (type %d)", type);
                                break;
                }
-               printk (" drive\n");
+               printk(KERN_CONT " drive\n");
                drive->media = type;
                /* an ATAPI device ignores DRDY */
                drive->ready_stat = 0;
@@ -238,7 +226,9 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
                drive->removable = 1;
 
        drive->media = ide_disk;
-       printk("%s DISK drive\n", (id->config == 0x848a) ? "CFA" : "ATA" );
+
+       printk(KERN_CONT "%s DISK drive\n",
+               (id->config == 0x848a) ? "CFA" : "ATA");
 
        return;
 
@@ -389,7 +379,7 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd)
                                /* Mmmm.. multiple IRQs..
                                 * don't know which was ours
                                 */
-                               printk("%s: IRQ probe failed (0x%lx)\n",
+                               printk(KERN_ERR "%s: IRQ probe failed (0x%lx)\n",
                                        drive->name, cookie);
                        }
                }
@@ -458,7 +448,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
                        return 4;
        }
 #ifdef DEBUG
-       printk("probing for %s: present=%d, media=%d, probetype=%s\n",
+       printk(KERN_INFO "probing for %s: present=%d, media=%d, probetype=%s\n",
                drive->name, drive->present, drive->media,
                (cmd == WIN_IDENTIFY) ? "ATA" : "ATAPI");
 #endif
@@ -536,7 +526,8 @@ static void enable_nest (ide_drive_t *drive)
        const struct ide_tp_ops *tp_ops = hwif->tp_ops;
        u8 stat;
 
-       printk("%s: enabling %s -- ", hwif->name, drive->id->model);
+       printk(KERN_INFO "%s: enabling %s -- ", hwif->name, drive->id->model);
+
        SELECT_DRIVE(drive);
        msleep(50);
        tp_ops->exec_command(hwif, EXABYTE_ENABLE_NEST);
@@ -640,7 +631,7 @@ static inline u8 probe_for_drive (ide_drive_t *drive)
        return drive->present;
 }
 
-static void hwif_release_dev (struct device *dev)
+static void hwif_release_dev(struct device *dev)
 {
        ide_hwif_t *hwif = container_of(dev, ide_hwif_t, gendev);
 
@@ -885,7 +876,7 @@ static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
        if (m && m->hwgroup && m->hwgroup != new->hwgroup) {
                if (!new->hwgroup)
                        return;
-               printk("%s: potential irq problem with %s and %s\n",
+               printk(KERN_WARNING "%s: potential IRQ problem with %s and %s\n",
                        hwif->name, new->name, m->name);
        }
        if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */
@@ -1144,17 +1135,17 @@ static int init_irq (ide_hwif_t *hwif)
        }
 
 #if !defined(__mc68000__)
-       printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name,
+       printk(KERN_INFO "%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name,
                io_ports->data_addr, io_ports->status_addr,
                io_ports->ctl_addr, hwif->irq);
 #else
-       printk("%s at 0x%08lx on irq %d", hwif->name,
+       printk(KERN_INFO "%s at 0x%08lx on irq %d", hwif->name,
                io_ports->data_addr, hwif->irq);
 #endif /* __mc68000__ */
        if (match)
-               printk(" (%sed with %s)",
+               printk(KERN_CONT " (%sed with %s)",
                        hwif->sharing_irq ? "shar" : "serializ", match->name);
-       printk("\n");
+       printk(KERN_CONT "\n");
 
        mutex_unlock(&ide_cfg_mtx);
        return 0;
@@ -1289,7 +1280,7 @@ static int hwif_init(ide_hwif_t *hwif)
        if (!hwif->irq) {
                hwif->irq = __ide_default_irq(hwif->io_ports.data_addr);
                if (!hwif->irq) {
-                       printk("%s: DISABLED, NO IRQ\n", hwif->name);
+                       printk(KERN_ERR "%s: disabled, no IRQ\n", hwif->name);
                        return 0;
                }
        }
@@ -1319,16 +1310,16 @@ static int hwif_init(ide_hwif_t *hwif)
         */
        hwif->irq = __ide_default_irq(hwif->io_ports.data_addr);
        if (!hwif->irq) {
-               printk("%s: Disabled unable to get IRQ %d.\n",
+               printk(KERN_ERR "%s: disabled, unable to get IRQ %d\n",
                        hwif->name, old_irq);
                goto out;
        }
        if (init_irq(hwif)) {
-               printk("%s: probed IRQ %d and default IRQ %d failed.\n",
+               printk(KERN_ERR "%s: probed IRQ %d and default IRQ %d failed\n",
                        hwif->name, old_irq, hwif->irq);
                goto out;
        }
-       printk("%s: probed IRQ %d failed, using default.\n",
+       printk(KERN_WARNING "%s: probed IRQ %d failed, using default\n",
                hwif->name, hwif->irq);
 
 done:
@@ -1583,17 +1574,22 @@ struct ide_host *ide_host_alloc_all(const struct ide_port_info *d,
                if (hws[i] == NULL)
                        continue;
 
+               hwif = kzalloc(sizeof(*hwif), GFP_KERNEL);
+               if (hwif == NULL)
+                       continue;
+
                idx = ide_find_port_slot(d);
                if (idx < 0) {
                        printk(KERN_ERR "%s: no free slot for interface\n",
                                        d ? d->name : "ide");
+                       kfree(hwif);
                        continue;
                }
 
-               hwif = &ide_hwifs[idx];
-
                ide_init_port_data(hwif, idx);
 
+               hwif->host = host;
+
                host->ports[i] = hwif;
                host->n_ports++;
        }
@@ -1603,6 +1599,12 @@ struct ide_host *ide_host_alloc_all(const struct ide_port_info *d,
                return NULL;
        }
 
+       if (hws[0])
+               host->dev[0] = hws[0]->dev;
+
+       if (d)
+               host->host_flags = d->host_flags;
+
        return host;
 }
 EXPORT_SYMBOL_GPL(ide_host_alloc_all);
@@ -1728,12 +1730,17 @@ int ide_host_add(const struct ide_port_info *d, hw_regs_t **hws,
                 struct ide_host **hostp)
 {
        struct ide_host *host;
+       int rc;
 
        host = ide_host_alloc(d, hws);
        if (host == NULL)
                return -ENOMEM;
 
-       ide_host_register(host, d, hws);
+       rc = ide_host_register(host, d, hws);
+       if (rc) {
+               ide_host_free(host);
+               return rc;
+       }
 
        if (hostp)
                *hostp = host;
@@ -1742,7 +1749,7 @@ int ide_host_add(const struct ide_port_info *d, hw_regs_t **hws,
 }
 EXPORT_SYMBOL_GPL(ide_host_add);
 
-void ide_host_remove(struct ide_host *host)
+void ide_host_free(struct ide_host *host)
 {
        ide_hwif_t *hwif;
        int i;
@@ -1753,12 +1760,25 @@ void ide_host_remove(struct ide_host *host)
                if (hwif == NULL)
                        continue;
 
-               ide_unregister(hwif);
                ide_free_port_slot(hwif->index);
+               kfree(hwif);
        }
 
        kfree(host);
 }
+EXPORT_SYMBOL_GPL(ide_host_free);
+
+void ide_host_remove(struct ide_host *host)
+{
+       int i;
+
+       for (i = 0; i < MAX_HWIFS; i++) {
+               if (host->ports[i])
+                       ide_unregister(host->ports[i]);
+       }
+
+       ide_host_free(host);
+}
 EXPORT_SYMBOL_GPL(ide_host_remove);
 
 void ide_port_scan(ide_hwif_t *hwif)