<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: viro@parcelfarce.linux.theplanet.co.uk

* killed include of scsi_module.h and switched from scsi_register() to
  scsi_alloc_host().  We still keep the old detect logics at that point, it
  will be gone later.



---

 25-akpm/drivers/scsi/ppa.c |  104 ++++++++++++++++++++++++++++-----------------
 25-akpm/drivers/scsi/ppa.h |   21 ---------
 2 files changed, 66 insertions(+), 59 deletions(-)

diff -puN drivers/scsi/ppa.c~PPA3-ppa_scsi_module-RC1 drivers/scsi/ppa.c
--- 25/drivers/scsi/ppa.c~PPA3-ppa_scsi_module-RC1	Wed Jan 14 13:35:48 2004
+++ 25-akpm/drivers/scsi/ppa.c	Wed Jan 14 13:35:48 2004
@@ -11,17 +11,15 @@
  */
 
 #include &lt;linux/config.h&gt;
-
-/* The following #define is to avoid a clash with hosts.c */
-#define PPA_CODE 1
-
+#include &lt;linux/init.h&gt;
+#include &lt;linux/kernel.h&gt;
+#include &lt;linux/module.h&gt;
 #include &lt;linux/blkdev.h&gt;
 #include &lt;asm/io.h&gt;
 #include &lt;linux/parport.h&gt;
 #include &lt;linux/workqueue.h&gt;
 #include "scsi.h"
 #include "hosts.h"
-static int ppa_release(struct Scsi_Host *);
 static void ppa_reset_pulse(unsigned int base);
 
 typedef struct {
@@ -74,17 +72,6 @@ static void ppa_wakeup(void *ref)
 	return;
 }
 
-static int ppa_release(struct Scsi_Host *host)
-{
-	ppa_struct *dev = ppa_dev(host);
-	int host_no = host-&gt;unique_id;
-
-	printk("Releasing ppa%i\n", host_no);
-	scsi_unregister(host);
-	parport_unregister_device(dev-&gt;dev);
-	return 0;
-}
-
 static int ppa_pb_claim(ppa_struct *dev)
 {
 	if (parport_claim(dev-&gt;dev)) {
@@ -105,25 +92,6 @@ static inline void ppa_pb_release(ppa_st
  *                   Parallel port probing routines                        *
  ***************************************************************************/
 
-static Scsi_Host_Template driver_template = {
-	.proc_name = "ppa",
-	.proc_info = ppa_proc_info,
-	.name = "Iomega VPI0 (ppa) interface",
-	.detect = ppa_detect,
-	.release = ppa_release,
-	.queuecommand = ppa_queuecommand,
-	.eh_abort_handler = ppa_abort,
-	.eh_bus_reset_handler = ppa_reset,
-	.eh_host_reset_handler = ppa_reset,
-	.bios_param = ppa_biosparam,
-	.this_id = -1,
-	.sg_tablesize = SG_ALL,
-	.cmd_per_lun = 1,
-	.use_clustering = ENABLE_CLUSTERING,
-};
-
-#include  "scsi_module.c"
-
 /*
  * Start of Chipset kludges
  */
@@ -227,11 +195,10 @@ static int ppa_detect(Scsi_Host_Template
 
 		INIT_WORK(&amp;dev-&gt;ppa_tq, ppa_interrupt, dev);
 
-		host-&gt;can_queue = PPA_CAN_QUEUE;
-		host-&gt;sg_tablesize = ppa_sg;
-		hreg = scsi_register(host, 0);
+		hreg = scsi_host_alloc(host, 0);
 		if (hreg == NULL)
 			continue;
+		list_add_tail(&amp;hreg-&gt;sht_legacy_list, &amp;host-&gt;legacy_hosts);
 		hreg-&gt;io_port = pb-&gt;base;
 		hreg-&gt;n_io_port = ports;
 		hreg-&gt;dma_channel = -1;
@@ -1137,4 +1104,65 @@ static int device_check(ppa_struct *dev)
 	return 1;
 }
 
+static Scsi_Host_Template ppa_template = {
+	.module			= THIS_MODULE,
+	.proc_name		= "ppa",
+	.proc_info		= ppa_proc_info,
+	.name			= "Iomega VPI0 (ppa) interface",
+	.queuecommand		= ppa_queuecommand,
+	.eh_abort_handler	= ppa_abort,
+	.eh_bus_reset_handler	= ppa_reset,
+	.eh_host_reset_handler	= ppa_reset,
+	.bios_param		= ppa_biosparam,
+	.this_id		= -1,
+	.sg_tablesize		= SG_ALL,
+	.cmd_per_lun		= 1,
+	.use_clustering		= ENABLE_CLUSTERING,
+	.can_queue		= 1,
+};
+
+static int __init ppa_driver_init(void)
+{
+	struct scsi_host_template *sht = &amp;ppa_template;
+	struct Scsi_Host *shost;
+	struct list_head *l;
+	int error;
+
+	INIT_LIST_HEAD(&amp;sht-&gt;legacy_hosts);
+
+	ppa_detect(sht);
+	if (list_empty(&amp;sht-&gt;legacy_hosts))
+		return -ENODEV;
+
+	list_for_each_entry(shost, &amp;sht-&gt;legacy_hosts, sht_legacy_list) {
+		error = scsi_add_host(shost, NULL);
+		if (error)
+			goto fail;
+		scsi_scan_host(shost);
+	}
+	return 0;
+ fail:
+	l = &amp;shost-&gt;sht_legacy_list;
+	while ((l = l-&gt;prev) != &amp;sht-&gt;legacy_hosts)
+		scsi_remove_host(list_entry(l, struct Scsi_Host, sht_legacy_list));
+	return error;
+}
+
+static void __exit ppa_driver_exit(void)
+{
+	struct scsi_host_template *sht = &amp;ppa_template;
+	struct Scsi_Host *host, *s;
+
+	list_for_each_entry(host, &amp;sht-&gt;legacy_hosts, sht_legacy_list)
+		scsi_remove_host(host);
+	list_for_each_entry_safe(host, s, &amp;sht-&gt;legacy_hosts, sht_legacy_list) {
+		ppa_struct *dev = ppa_dev(host);
+		list_del(&amp;host-&gt;sht_legacy_list);
+		scsi_host_put(host);
+		parport_unregister_device(dev-&gt;dev);
+	}
+}
+
+module_init(ppa_driver_init);
+module_exit(ppa_driver_exit);
 MODULE_LICENSE("GPL");
diff -puN drivers/scsi/ppa.h~PPA3-ppa_scsi_module-RC1 drivers/scsi/ppa.h
--- 25/drivers/scsi/ppa.h~PPA3-ppa_scsi_module-RC1	Wed Jan 14 13:35:48 2004
+++ 25-akpm/drivers/scsi/ppa.h	Wed Jan 14 13:35:48 2004
@@ -73,7 +73,6 @@
  */
 /* ------ END OF USER CONFIGURABLE PARAMETERS ----- */
 
-#ifdef PPA_CODE
 #include  &lt;linux/config.h&gt;
 #include  &lt;linux/stddef.h&gt;
 #include  &lt;linux/module.h&gt;
@@ -115,11 +114,7 @@ static char *PPA_MODE_STRING[] =
 #endif
     "Unknown"};
 
-/* This is a global option */
-int ppa_sg = SG_ALL;		/* enable/disable scatter-gather. */
-
 /* other options */
-#define PPA_CAN_QUEUE   1	/* use "queueing" interface */
 #define PPA_BURST_SIZE	512	/* data burst size */
 #define PPA_SELECT_TMO  5000	/* how long to wait for target ? */
 #define PPA_SPIN_TMO    50000	/* ppa_wait loop limiter */
@@ -152,23 +147,7 @@ int ppa_sg = SG_ALL;		/* enable/disable 
 #endif
 
 static int ppa_engine(ppa_struct *, Scsi_Cmnd *);
-static int ppa_in(ppa_struct *, char *, int);
 static int ppa_init(ppa_struct *);
 static void ppa_interrupt(void *);
-static int ppa_out(ppa_struct *, char *, int);
-
-#else
-#define ppa_release 0
-#endif
-
-static int ppa_detect(Scsi_Host_Template *);
-const char *ppa_info(struct Scsi_Host *);
-int ppa_command(Scsi_Cmnd *);
-static int ppa_queuecommand(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
-static int ppa_abort(Scsi_Cmnd *);
-static int ppa_reset(Scsi_Cmnd *);
-static int ppa_proc_info(struct Scsi_Host *host, char *, char **, off_t, int, int);
-static int ppa_biosparam(struct scsi_device *, struct block_device *,
-		sector_t, int *);
 
 #endif				/* _PPA_H */

_
</pre></body></html>