while((volatile u32) pHba->state & DPTI_STATE_RESET ) { set_task_state(current,TASK_UNINTERRUPTIBLE); schedule_timeout(2);  } 
while((volatile u32) pHba->state & DPTI_STATE_RESET ) schedule_timeout_uninterruptible(2); 
static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,	      ulong arg){	int minor;	int error = 0;	adpt_hba* pHba;	ulong flags = 0;	void __user *argp = (void __user *)arg;	minor = iminor(inode);	if (minor >= DPTI_MAX_HBA){		return -ENXIO;	}	down(&adpt_configuration_lock);	for (pHba = hba_chain; pHba; pHba = pHba->next) {		if (pHba->unit == minor) {			break;	/* found adapter */		}	}	up(&adpt_configuration_lock);	if(pHba == NULL){		return -ENXIO;	}	while((volatile u32) pHba->state & DPTI_STATE_RESET ) {		set_task_state(current,TASK_UNINTERRUPTIBLE);		schedule_timeout(2);	}	switch (cmd) {	// TODO: handle 3 cases	case DPT_SIGNATURE:		if (copy_to_user(argp, &DPTI_sig, sizeof(DPTI_sig))) {			return -EFAULT;		}		break;	case I2OUSRCMD:		return adpt_i2o_passthru(pHba, argp);	case DPT_CTRLINFO:{		drvrHBAinfo_S HbaInfo;#define FLG_OSD_PCI_VALID 0x0001#define FLG_OSD_DMA	  0x0002#define FLG_OSD_I2O	  0x0004		memset(&HbaInfo, 0, sizeof(HbaInfo));		HbaInfo.drvrHBAnum = pHba->unit;		HbaInfo.baseAddr = (ulong) pHba->base_addr_phys;		HbaInfo.blinkState = adpt_read_blink_led(pHba);		HbaInfo.pciBusNum =  pHba->pDev->bus->number;		HbaInfo.pciDeviceNum=PCI_SLOT(pHba->pDev->devfn); 		HbaInfo.Interrupt = pHba->pDev->irq; 		HbaInfo.hbaFlags = FLG_OSD_PCI_VALID | FLG_OSD_DMA | FLG_OSD_I2O;		if(copy_to_user(argp, &HbaInfo, sizeof(HbaInfo))){			printk(KERN_WARNING"%s: Could not copy HbaInfo TO user\n",pHba->name);			return -EFAULT;		}		break;		}	case DPT_SYSINFO:		return adpt_system_info(argp);	case DPT_BLINKLED:{		u32 value;		value = (u32)adpt_read_blink_led(pHba);		if (copy_to_user(argp, &value, sizeof(value))) {			return -EFAULT;		}		break;		}	case I2ORESETCMD:		if(pHba->host)			spin_lock_irqsave(pHba->host->host_lock, flags);		adpt_hba_reset(pHba);		if(pHba->host)			spin_unlock_irqrestore(pHba->host->host_lock, flags);		break;	case I2ORESCANCMD:		adpt_rescan(pHba);		break;	default:		return -EINVAL;	}	return error;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/a9a3047dd8ae43ff24caae5ec733a93df129568e/dpt_i2o.c/buggy/drivers/scsi/dpt_i2o.c