FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_wait_op_done_val - wait until an operation is completed
 *	@adapter: the adapter performing the operation
 *	@reg: the register to check for completion
 *	@mask: a single-bit field within @reg that indicates completion
 *	@polarity: the value of the field when the operation is completed
 *	@attempts: number of check iterations
 *	@delay: delay in usecs between iterations
 *	@valp: where to store the value of the register at completion time
 *
 *	Wait until an operation is completed by checking a bit in a register
 *	up to @attempts times.  If @valp is not NULL the value of the register
 *	at the time it indicated completion is stored there.  Returns 0 if the
 *	operation completes and	-EAGAIN	otherwise.
 */


Wait until an operation is completed by checking a bit in a register
up to @attempts times.  If @valp is not NULL the value of the register
at the time it indicated completion is stored there.  Returns 0 if the
operation completes and -EAGAIN otherwise.
Wait until an operation is completed by checking a bit in a register up to @attempts times . If @valp is not NULL the value of the register at the time it indicated completion is stored there . Returns 0 if the operation completes and - EAGAIN otherwise .
int t3_wait_op_done_val(adapter_t *adapter, int reg, u32 mask, int polarity,
			int attempts, int delay, u32 *valp)
{
	while (1) {
		u32 val = t3_read_reg(adapter, reg);
		if (!!(val & mask) == polarity) {
			if (valp)
				*valp = val;
			return 0;
		}
		if (--attempts == 0)
			return -EAGAIN;
		if (delay)
			udelay(delay);
	}
}
int t3_wait_op_done_val ( adapter_t * adapter , int reg , u32 mask , int polarity , int attempts , int delay , u32 * valp ) { while ( 1 ) { u32 val = t3_read_reg ( adapter , reg ) ; if ( ! ! ( val & mask ) == polarity ) { if ( valp ) * valp = val ; return 0 ; } if ( -- attempts == 0 ) return - EAGAIN ; if ( delay ) udelay ( delay ) ; } }
t3_wait_op_done_val - wait until an operation is completed
      @adapter: the adapter performing the operation
      @reg: the register to check for completion
      @mask: a single-bit field within @reg that indicates completion
      @polarity: the value of the field when the operation is completed
      @attempts: number of check iterations
      @delay: delay in usecs between iterations
      @valp: where to store the value of the register at completion time
t3_wait_op_done_val - wait until an operation is completed @adapter : the adapter performing the operation @reg : the register to check for completion @mask : a single - bit field within @reg that indicates completion @polarity : the value of the field when the operation is completed @attempts : number of check iterations @delay : delay in usecs between iterations @valp : where to store the value of the register at completion time