From c97c6aca75fd5f718056fde7cff798b8cbdb07c0 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 23 Jul 2008 19:55:50 +0200 Subject: ide: pass hw_regs_t-s to ide_device_add[_all]() (take 3) * Add 'hw_regs_t **hws' argument to ide_device_add[_all]() and convert host drivers + ide_legacy_init_one() + ide_setup_pci_device[s]() to use it instead of calling ide_init_port_hw() directly. [ However if host has > 1 port we must still set hwif->chipset to hint consecutive ide_find_port() call that the previous slot is occupied. ] * Unexport ide_init_port_hw(). v2: * Use defines instead of hard-coded values in buddha.c, gayle.c and q40ide.c. (Suggested by Geert Uytterhoeven) * Better patch description. v3: * Fix build problem in ide-cs.c. (Noticed by Stephen Rothwell) There should be no functional changes caused by this patch. Cc: Geert Uytterhoeven Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/cmd640.c | 10 ++++++---- drivers/ide/pci/cs5520.c | 5 +++-- drivers/ide/pci/delkin_cb.c | 6 ++---- drivers/ide/pci/scc_pata.c | 5 ++--- drivers/ide/pci/sgiioc4.c | 6 ++---- 5 files changed, 15 insertions(+), 17 deletions(-) (limited to 'drivers/ide/pci') diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 1ad1e23e3105..ccde1e444e13 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c @@ -717,8 +717,8 @@ static int __init cmd640x_init(void) int second_port_cmd640 = 0, rc; const char *bus_type, *port2; u8 b, cfr; + hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; - hw_regs_t hw[2]; if (cmd640_vlb && probe_for_cmd640_vlb()) { bus_type = "VLB"; @@ -787,7 +787,9 @@ static int __init cmd640x_init(void) * Initialize data for primary port */ if (cmd_hwif0) { - ide_init_port_hw(cmd_hwif0, &hw[0]); + cmd_hwif0->chipset = ide_cmd640; + + hws[0] = &hw[0]; idx[0] = cmd_hwif0->index; } @@ -832,7 +834,7 @@ static int __init cmd640x_init(void) if (second_port_cmd640) { cmd_hwif1 = ide_find_port(); if (cmd_hwif1) { - ide_init_port_hw(cmd_hwif1, &hw[1]); + hws[1] = &hw[1]; idx[1] = cmd_hwif1->index; } } @@ -843,7 +845,7 @@ static int __init cmd640x_init(void) cmd640_dump_regs(); #endif - ide_device_add(idx, &cmd640_port_info); + ide_device_add(idx, &cmd640_port_info, hws); return 1; } diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 992b1cf8db69..a13f2bc0665c 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -146,6 +146,7 @@ static const struct ide_port_info cyrix_chipsets[] __devinitdata = { static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) { const struct ide_port_info *d = &cyrix_chipsets[id->driver_data]; + hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; ide_setup_pci_noise(dev, d); @@ -168,9 +169,9 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic * do all the device setup for us */ - ide_pci_setup_ports(dev, d, 14, &idx[0]); + ide_pci_setup_ports(dev, d, 14, &idx[0], &hw[0], &hws[0]); - ide_device_add(idx, d); + ide_device_add(idx, d, hws); return 0; } diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index 0106e2a2df77..33fe15db408a 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c @@ -57,9 +57,9 @@ static int __devinit delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) { unsigned long base; - hw_regs_t hw; ide_hwif_t *hwif = NULL; int i, rc; + hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; rc = pci_enable_device(dev); @@ -93,11 +93,9 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) i = hwif->index; - ide_init_port_hw(hwif, &hw); - idx[0] = i; - ide_device_add(idx, &delkin_cb_port_info); + ide_device_add(idx, &delkin_cb_port_info, hws); pci_set_drvdata(dev, hwif); diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 789c66dfbde5..328e2df66550 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c @@ -554,7 +554,7 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev, { struct scc_ports *ports = pci_get_drvdata(dev); ide_hwif_t *hwif = NULL; - hw_regs_t hw; + hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; int i; @@ -568,11 +568,10 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev, hw.irq = dev->irq; hw.dev = &dev->dev; hw.chipset = ide_pci; - ide_init_port_hw(hwif, &hw); idx[0] = hwif->index; - ide_device_add(idx, d); + ide_device_add(idx, d, hws); return 0; } diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index c79ff5b41088..76afa1f9c599 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c @@ -584,8 +584,8 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) unsigned long bar0, cmd_phys_base, ctl; void __iomem *virt_base; ide_hwif_t *hwif; + hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; - hw_regs_t hw; struct ide_port_info d = sgiioc4_port_info; /* Get the CmdBlk and CtrlBlk Base Registers */ @@ -622,8 +622,6 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) if (hwif == NULL) goto err; - ide_init_port_hw(hwif, &hw); - /* The IOC4 uses MMIO rather than Port IO. */ default_hwif_mmiops(hwif); @@ -634,7 +632,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) idx[0] = hwif->index; - if (ide_device_add(idx, &d)) + if (ide_device_add(idx, &d, hws)) return -EIO; return 0; -- cgit v1.2.2