while (atomic_read(&chip->data_pending) != 0) { set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(TPM_TIMEOUT); } 
while (atomic_read(&chip->data_pending) != 0) msleep(TPM_TIMEOUT); 
ssize_t tpm_write(struct file * file, const char __user * buf,		  size_t size, loff_t * off){	struct tpm_chip *chip = file->private_data;	int in_size = size, out_size;	/* cannot perform a write until the read has cleared	   either via tpm_read or a user_read_timer timeout */	while (atomic_read(&chip->data_pending) != 0) {		set_current_state(TASK_UNINTERRUPTIBLE);		schedule_timeout(TPM_TIMEOUT);	}	down(&chip->buffer_mutex);	if (in_size > TPM_BUFSIZE)		in_size = TPM_BUFSIZE;	if (copy_from_user	    (chip->data_buffer, (void __user *) buf, in_size)) {		up(&chip->buffer_mutex);		return -EFAULT;	}	/* atomic tpm command send and result receive */	out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE);	atomic_set(&chip->data_pending, out_size);	up(&chip->buffer_mutex);	/* Set a timeout by which the reader must come claim the result */	down(&chip->timer_manipulation_mutex);	init_timer(&chip->user_read_timer);	chip->user_read_timer.function = user_reader_timeout;	chip->user_read_timer.data = (unsigned long) chip;	chip->user_read_timer.expires = jiffies + (60 * HZ);	add_timer(&chip->user_read_timer);	up(&chip->timer_manipulation_mutex);	return in_size;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/700d8bdcd0fa815b08638b1e4d43b66d60cc6a8d/tpm.c/clean/drivers/char/tpm/tpm.c