zfcp_port_enqueue(struct zfcp_adapter *adapter, wwn_t wwpn, u32 status,		  u32 d_id){	struct zfcp_port *port, *tmp_port;	int check_wwpn;	scsi_id_t scsi_id;	int found;	check_wwpn = !(status & ZFCP_STATUS_PORT_NO_WWPN);	/*	 * check that there is no port with this WWPN already in list	 */	if (check_wwpn) {		read_lock_irq(&zfcp_data.config_lock);		port = zfcp_get_port_by_wwpn(adapter, wwpn);		read_unlock_irq(&zfcp_data.config_lock);		if (port)			return NULL;	}	port = kmalloc(sizeof (struct zfcp_port), GFP_KERNEL);	if (!port)		return NULL;	memset(port, 0, sizeof (struct zfcp_port));	/* initialise reference count stuff */	atomic_set(&port->refcount, 0);	init_waitqueue_head(&port->remove_wq);	INIT_LIST_HEAD(&port->unit_list_head);	INIT_LIST_HEAD(&port->unit_remove_lh);	port->adapter = adapter;	if (check_wwpn)		port->wwpn = wwpn;	atomic_set_mask(status, &port->status);	/* setup for sysfs registration */	if (status & ZFCP_STATUS_PORT_WKA) {		switch (d_id) {		case ZFCP_DID_DIRECTORY_SERVICE:			snprintf(port->sysfs_device.bus_id, BUS_ID_SIZE,				 "directory");			break;		case ZFCP_DID_MANAGEMENT_SERVICE:			snprintf(port->sysfs_device.bus_id, BUS_ID_SIZE,				 "management");			break;		case ZFCP_DID_KEY_DISTRIBUTION_SERVICE:			snprintf(port->sysfs_device.bus_id, BUS_ID_SIZE,				 "key_distribution");			break;		case ZFCP_DID_ALIAS_SERVICE:			snprintf(port->sysfs_device.bus_id, BUS_ID_SIZE,				 "alias");			break;		case ZFCP_DID_TIME_SERVICE:			snprintf(port->sysfs_device.bus_id, BUS_ID_SIZE,				 "time");			break;		default:			kfree(port);			return NULL;		}		port->d_id = d_id;		port->sysfs_device.parent = &adapter->generic_services;	} else {		snprintf(port->sysfs_device.bus_id,			 BUS_ID_SIZE, "0x%016llx", wwpn);	port->sysfs_device.parent = &adapter->ccw_device->dev;	}	port->sysfs_device.release = zfcp_sysfs_port_release;	dev_set_drvdata(&port->sysfs_device, port);	/* mark port unusable as long as sysfs registration is not complete */	atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status);	if (device_register(&port->sysfs_device)) {		kfree(port);		return NULL;	}	if (zfcp_sysfs_port_create_files(&port->sysfs_device, status)) {		device_unregister(&port->sysfs_device);		return NULL;	}	zfcp_port_get(port);	scsi_id = 1;	found = 0;	write_lock_irq(&zfcp_data.config_lock);	list_for_each_entry(tmp_port, &adapter->port_list_head, list) {		if (atomic_test_mask(ZFCP_STATUS_PORT_NO_SCSI_ID,				     &tmp_port->status))			continue;		if (tmp_port->scsi_id != scsi_id) {			found = 1;			break;		}		scsi_id++;	}	port->scsi_id = scsi_id;	if (found)		list_add_tail(&port->list, &tmp_port->list);	else		list_add_tail(&port->list, &adapter->port_list_head);	atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status);	atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, &port->status);	if (d_id == ZFCP_DID_DIRECTORY_SERVICE)		if (!adapter->nameserver_port)			adapter->nameserver_port = port;	adapter->ports++;	write_unlock_irq(&zfcp_data.config_lock);	zfcp_adapter_get(adapter);	return port;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/3859f6a248cbdfbe7b41663f3a2b51f48e30b281/zfcp_aux.c/buggy/drivers/s390/scsi/zfcp_aux.c