From 37525bebcfc15a1fe5a9cb50bf49b21bf43559c1 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Thu, 24 Jul 2008 22:53:18 +0200 Subject: via82cxxx: cleanup ->init_chipset method * Move the boot message and via_clock setup from init_chipset_via82cxxx() to via_init_one(). * Set vdev->via_config in via_init_one() and cleanup init_chipset_via82cxxx() accordingly. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/via82cxxx.c | 81 ++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 46 deletions(-) (limited to 'drivers/ide/pci') diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index a8c050b462b..bc1675da37d 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -270,21 +270,10 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const { struct ide_host *host = pci_get_drvdata(dev); struct via82cxxx_dev *vdev = host->host_priv; - struct pci_dev *isa = NULL; - struct via_isa_bridge *via_config; + struct via_isa_bridge *via_config = vdev->via_config; u8 t, v; u32 u; - /* - * Find the ISA bridge to see how good the IDE is. - */ - vdev->via_config = via_config = via_config_find(&isa); - - /* We checked this earlier so if it fails here deeep badness - is involved */ - - BUG_ON(!via_config->id); - /* * Detect cable and configure Clk66 */ @@ -330,39 +319,6 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const pci_write_config_byte(dev, VIA_FIFO_CONFIG, t); - /* - * Determine system bus clock. - */ - - via_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000; - - switch (via_clock) { - case 33000: via_clock = 33333; break; - case 37000: via_clock = 37500; break; - case 41000: via_clock = 41666; break; - } - - if (via_clock < 20000 || via_clock > 50000) { - printk(KERN_WARNING "VP_IDE: User given PCI clock speed " - "impossible (%d), using 33 MHz instead.\n", via_clock); - printk(KERN_WARNING "VP_IDE: Use ide0=ata66 if you want " - "to assume 80-wire cable.\n"); - via_clock = 33333; - } - - /* - * Print the boot message. - */ - - printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) IDE %sDMA%s " - "controller on pci%s\n", - via_config->name, isa->revision, - via_config->udma_mask ? "U" : "MW", - via_dma[via_config->udma_mask ? - (fls(via_config->udma_mask) - 1) : 0], - pci_name(dev)); - - pci_dev_put(isa); return 0; } @@ -444,12 +400,43 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i * Find the ISA bridge and check we know what it is. */ via_config = via_config_find(&isa); - pci_dev_put(isa); if (!via_config->id) { printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); return -ENODEV; } + /* + * Print the boot message. + */ + printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) IDE %sDMA%s " + "controller on pci%s\n", + via_config->name, isa->revision, + via_config->udma_mask ? "U" : "MW", + via_dma[via_config->udma_mask ? + (fls(via_config->udma_mask) - 1) : 0], + pci_name(dev)); + + pci_dev_put(isa); + + /* + * Determine system bus clock. + */ + via_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000; + + switch (via_clock) { + case 33000: via_clock = 33333; break; + case 37000: via_clock = 37500; break; + case 41000: via_clock = 41666; break; + } + + if (via_clock < 20000 || via_clock > 50000) { + printk(KERN_WARNING "VP_IDE: User given PCI clock speed " + "impossible (%d), using 33 MHz instead.\n", via_clock); + printk(KERN_WARNING "VP_IDE: Use ide0=ata66 if you want " + "to assume 80-wire cable.\n"); + via_clock = 33333; + } + if (idx == 0) d.host_flags |= IDE_HFLAG_NO_AUTODMA; else @@ -471,6 +458,8 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i return -ENOMEM; } + vdev->via_config = via_config; + rc = ide_pci_init_one(dev, &d, vdev); if (rc) kfree(vdev); -- cgit v1.2.3