#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) 
ahd_linux_register_host(struct ahd_softc *ahd, Scsi_Host_Template *template){	char	buf[80];	struct	Scsi_Host *host;	char	*new_name;	u_long	s;	u_long	target;	template->name = ahd->description;	host = scsi_host_alloc(template, sizeof(struct ahd_softc *));	if (host == NULL)		return (ENOMEM);	*((struct ahd_softc **)host->hostdata) = ahd;	ahd_lock(ahd, &s);#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)	scsi_assign_lock(host, &ahd->platform_data->spin_lock);#elif AHD_SCSI_HAS_HOST_LOCK != 0	host->lock = &ahd->platform_data->spin_lock;#endif	ahd->platform_data->host = host;	host->can_queue = AHD_MAX_QUEUE;	host->cmd_per_lun = 2;	host->sg_tablesize = AHD_NSEG;	host->this_id = ahd->our_id;	host->irq = ahd->platform_data->irq;	host->max_id = (ahd->features & AHD_WIDE) ? 16 : 8;	host->max_lun = AHD_NUM_LUNS;	host->max_channel = 0;	host->sg_tablesize = AHD_NSEG;	ahd_set_unit(ahd, ahd_linux_next_unit());	sprintf(buf, "scsi%d", host->host_no);	new_name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT);	if (new_name != NULL) {		strcpy(new_name, buf);		ahd_set_name(ahd, new_name);	}	host->unique_id = ahd->unit;#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)	scsi_set_pci_device(host, ahd->dev_softc);#endif	ahd_linux_setup_user_rd_strm_settings(ahd);	ahd_linux_initialize_scsi_bus(ahd);	ahd_unlock(ahd, &s);	ahd->platform_data->dv_pid = kernel_thread(ahd_linux_dv_thread, ahd, 0);	ahd_lock(ahd, &s);	if (ahd->platform_data->dv_pid < 0) {		printf("%s: Failed to create DV thread, error= %d\n",		       ahd_name(ahd), ahd->platform_data->dv_pid);		return (-ahd->platform_data->dv_pid);	}	/*	 * Initially allocate *all* of our linux target objects	 * so that the DV thread will scan them all in parallel	 * just after driver initialization.  Any device that	 * does not exist will have its target object destroyed	 * by the selection timeout handler.  In the case of a	 * device that appears after the initial DV scan, async	 * negotiation will occur for the first command, and DV	 * will comence should that first command be successful.	 */	for (target = 0; target < host->max_id; target++) {		/*		 * Skip our own ID.  Some Compaq/HP storage devices		 * have enclosure management devices that respond to		 * single bit selection (i.e. selecting ourselves).		 * It is expected that either an external application		 * or a modified kernel will be used to probe this		 * ID if it is appropriate.  To accommodate these		 * installations, ahc_linux_alloc_target() will allocate		 * for our ID if asked to do so.		 */		if (target == ahd->our_id) 			continue;		ahd_linux_alloc_target(ahd, 0, target);	}	ahd_intr_enable(ahd, TRUE);	ahd_linux_start_dv(ahd);	ahd_unlock(ahd, &s);#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)	scsi_add_host(host, &ahd->dev_softc->dev); /* XXX handle failure */	scsi_scan_host(host);#endif	return (0);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/60a13213840296b1e32d6781653a0eaa83d04382/aic79xx_osm.c/clean/drivers/scsi/aic7xxx/aic79xx_osm.c