aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/cmd640.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:57 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:57 -0400
commit48c3c1072651922ed153bcf0a33ea82cf20df390 (patch)
tree92ad23e3869e70731eca99394c08a3bf06b8753e /drivers/ide/pci/cmd640.c
parent374e042c3e767ac2e5a40b78529220e0b3de793c (diff)
ide: add struct ide_host (take 3)
* Add struct ide_host which keeps pointers to host's ports. * Add ide_host_alloc[_all]() and ide_host_remove() helpers. * Pass 'struct ide_host *host' instead of 'u8 *idx' to ide_device_add[_all]() and rename it to ide_host_register[_all](). * Convert host drivers and core code to use struct ide_host. * Remove no longer needed ide_find_port(). * Make ide_find_port_slot() static. * Unexport ide_unregister(). v2: * Add missing 'struct ide_host *host' to macide.c. v3: * Fix build problem in pmac.c (s/ide_alloc_host/ide_host_alloc/) (Noticed by Stephen Rothwell). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/cmd640.c')
-rw-r--r--drivers/ide/pci/cmd640.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index ccde1e444e13..013697b8cef4 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -181,11 +181,6 @@ static u8 recovery_counts[4] = {16, 16, 16, 16}; /* Recovery count (encoded) */
181static DEFINE_SPINLOCK(cmd640_lock); 181static DEFINE_SPINLOCK(cmd640_lock);
182 182
183/* 183/*
184 * These are initialized to point at the devices we control
185 */
186static ide_hwif_t *cmd_hwif0, *cmd_hwif1;
187
188/*
189 * Interface to access cmd640x registers 184 * Interface to access cmd640x registers
190 */ 185 */
191static unsigned int cmd640_key; 186static unsigned int cmd640_key;
@@ -714,11 +709,11 @@ static int cmd640x_init_one(unsigned long base, unsigned long ctl)
714 */ 709 */
715static int __init cmd640x_init(void) 710static int __init cmd640x_init(void)
716{ 711{
712 struct ide_host *host;
717 int second_port_cmd640 = 0, rc; 713 int second_port_cmd640 = 0, rc;
718 const char *bus_type, *port2; 714 const char *bus_type, *port2;
719 u8 b, cfr; 715 u8 b, cfr;
720 hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL }; 716 hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL };
721 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
722 717
723 if (cmd640_vlb && probe_for_cmd640_vlb()) { 718 if (cmd640_vlb && probe_for_cmd640_vlb()) {
724 bus_type = "VLB"; 719 bus_type = "VLB";
@@ -781,17 +776,10 @@ static int __init cmd640x_init(void)
781 printk(KERN_INFO "cmd640: buggy cmd640%c interface on %s, config=0x%02x" 776 printk(KERN_INFO "cmd640: buggy cmd640%c interface on %s, config=0x%02x"
782 "\n", 'a' + cmd640_chip_version - 1, bus_type, cfr); 777 "\n", 'a' + cmd640_chip_version - 1, bus_type, cfr);
783 778
784 cmd_hwif0 = ide_find_port();
785
786 /* 779 /*
787 * Initialize data for primary port 780 * Initialize data for primary port
788 */ 781 */
789 if (cmd_hwif0) { 782 hws[0] = &hw[0];
790 cmd_hwif0->chipset = ide_cmd640;
791
792 hws[0] = &hw[0];
793 idx[0] = cmd_hwif0->index;
794 }
795 783
796 /* 784 /*
797 * Ensure compatibility by always using the slowest timings 785 * Ensure compatibility by always using the slowest timings
@@ -831,13 +819,9 @@ static int __init cmd640x_init(void)
831 /* 819 /*
832 * Initialize data for secondary cmd640 port, if enabled 820 * Initialize data for secondary cmd640 port, if enabled
833 */ 821 */
834 if (second_port_cmd640) { 822 if (second_port_cmd640)
835 cmd_hwif1 = ide_find_port(); 823 hws[1] = &hw[1];
836 if (cmd_hwif1) { 824
837 hws[1] = &hw[1];
838 idx[1] = cmd_hwif1->index;
839 }
840 }
841 printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n", 825 printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n",
842 second_port_cmd640 ? "" : "not ", port2); 826 second_port_cmd640 ? "" : "not ", port2);
843 827
@@ -845,7 +829,9 @@ static int __init cmd640x_init(void)
845 cmd640_dump_regs(); 829 cmd640_dump_regs();
846#endif 830#endif
847 831
848 ide_device_add(idx, &cmd640_port_info, hws); 832 host = ide_host_alloc(&cmd640_port_info, hws);
833 if (host)
834 ide_host_register(host, &cmd640_port_info, hws);
849 835
850 return 1; 836 return 1;
851} 837}