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 <geert@linux-m68k.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index 1ad1e23..ccde1e4 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -717,8 +717,8 @@
 	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 @@
 	 * 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 @@
 	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 @@
 	cmd640_dump_regs();
 #endif
 
-	ide_device_add(idx, &cmd640_port_info);
+	ide_device_add(idx, &cmd640_port_info, hws);
 
 	return 1;
 }