int gfp_mask = GFP_KERNEL, rval; 
gfp_t gfp_mask = GFP_KERNEL; int rval; 
struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize){	struct Scsi_Host *shost;	int gfp_mask = GFP_KERNEL, rval;	if (sht->unchecked_isa_dma && privsize)		gfp_mask |= __GFP_DMA;        /* Check to see if this host has any error handling facilities */        if (!sht->eh_strategy_handler && !sht->eh_abort_handler &&	    !sht->eh_device_reset_handler && !sht->eh_bus_reset_handler &&            !sht->eh_host_reset_handler) {		printk(KERN_ERR "ERROR: SCSI host `%s' has no error handling\n"				"ERROR: This is not a safe way to run your "				        "SCSI host\n"				"ERROR: The error handling must be added to "				"this driver\n", sht->proc_name);		dump_stack();        }	shost = kmalloc(sizeof(struct Scsi_Host) + privsize, gfp_mask);	if (!shost)		return NULL;	memset(shost, 0, sizeof(struct Scsi_Host) + privsize);	spin_lock_init(&shost->default_lock);	scsi_assign_lock(shost, &shost->default_lock);	shost->shost_state = SHOST_CREATED;	INIT_LIST_HEAD(&shost->__devices);	INIT_LIST_HEAD(&shost->__targets);	INIT_LIST_HEAD(&shost->eh_cmd_q);	INIT_LIST_HEAD(&shost->starved_list);	init_waitqueue_head(&shost->host_wait);	init_MUTEX(&shost->scan_mutex);	shost->host_no = scsi_host_next_hn++; /* XXX(hch): still racy */	shost->dma_channel = 0xff;	/* These three are default values which can be overridden */	shost->max_channel = 0;	shost->max_id = 8;	shost->max_lun = 8;	/* Give each shost a default transportt */	shost->transportt = &blank_transport_template;	/*	 * All drivers right now should be able to handle 12 byte	 * commands.  Every so often there are requests for 16 byte	 * commands, but individual low-level drivers need to certify that	 * they actually do something sensible with such commands.	 */	shost->max_cmd_len = 12;	shost->hostt = sht;	shost->this_id = sht->this_id;	shost->can_queue = sht->can_queue;	shost->sg_tablesize = sht->sg_tablesize;	shost->cmd_per_lun = sht->cmd_per_lun;	shost->unchecked_isa_dma = sht->unchecked_isa_dma;	shost->use_clustering = sht->use_clustering;	shost->ordered_flush = sht->ordered_flush;	shost->ordered_tag = sht->ordered_tag;	/*	 * hosts/devices that do queueing must support ordered tags	 */	if (shost->can_queue > 1 && shost->ordered_flush) {		printk(KERN_ERR "scsi: ordered flushes don't support queueing\n");		shost->ordered_flush = 0;	}	if (sht->max_host_blocked)		shost->max_host_blocked = sht->max_host_blocked;	else		shost->max_host_blocked = SCSI_DEFAULT_HOST_BLOCKED;	/*	 * If the driver imposes no hard sector transfer limit, start at	 * machine infinity initially.	 */	if (sht->max_sectors)		shost->max_sectors = sht->max_sectors;	else		shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS;	/*	 * assume a 4GB boundary, if not set	 */	if (sht->dma_boundary)		shost->dma_boundary = sht->dma_boundary;	else		shost->dma_boundary = 0xffffffff;	rval = scsi_setup_command_freelist(shost);	if (rval)		goto fail_kfree;	device_initialize(&shost->shost_gendev);	snprintf(shost->shost_gendev.bus_id, BUS_ID_SIZE, "host%d",		shost->host_no);	shost->shost_gendev.release = scsi_host_dev_release;	class_device_initialize(&shost->shost_classdev);	shost->shost_classdev.dev = &shost->shost_gendev;	shost->shost_classdev.class = &shost_class;	snprintf(shost->shost_classdev.class_id, BUS_ID_SIZE, "host%d",		  shost->host_no);	shost->ehandler = kthread_run(scsi_error_handler, shost,			"scsi_eh_%d", shost->host_no);	if (IS_ERR(shost->ehandler)) {		rval = PTR_ERR(shost->ehandler);		goto fail_destroy_freelist;	}	scsi_proc_hostdir_add(shost->hostt);	return shost; fail_destroy_freelist:	scsi_destroy_command_freelist(shost); fail_kfree:	kfree(shost);	return NULL;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/c53033f6b0bd7cc133b7f433083f0394cf29ac70/hosts.c/clean/drivers/scsi/hosts.c