FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	flash_wait_op - wait for a flash operation to complete
 *	@adapter: the adapter
 *	@attempts: max number of polls of the status register
 *	@delay: delay between polls in ms
 *
 *	Wait for a flash operation to complete by polling the status register.
 */
wait for a flash operation to complete
@adapter: the adapter
@attempts: max number of polls of the status register
@delay: delay between polls in ms

Wait for a flash operation to complete by polling the status register.
wait for a flash operation to complete @adapter : the adapter @attempts : max number of polls of the status register @delay : delay between polls in ms Wait for a flash operation to complete by polling the status register .
static int flash_wait_op(adapter_t *adapter, int attempts, int delay)
{
	int ret;
	u32 status;
	while (1) {
		if ((ret = sf1_write(adapter, 1, 1, SF_RD_STATUS)) != 0 ||
		    (ret = sf1_read(adapter, 1, 0, &status)) != 0)
			return ret;
		if (!(status & 1))
			return 0;
		if (--attempts == 0)
			return -EAGAIN;
		if (delay)
			msleep(delay);
	}
}
static int flash_wait_op ( adapter_t * adapter , int attempts , int delay ) { int ret ; u32 status ; while ( 1 ) { if ( ( ret = sf1_write ( adapter , 1 , 1 , SF_RD_STATUS ) ) != 0 || ( ret = sf1_read ( adapter , 1 , 0 , & status ) ) != 0 ) return ret ; if ( ! ( status & 1 ) ) return 0 ; if ( -- attempts == 0 ) return - EAGAIN ; if ( delay ) msleep ( delay ) ; } }
flash_wait_op - wait for a flash operation to complete
      @adapter: the adapter
      @attempts: max number of polls of the status register
      @delay: delay between polls in ms
flash_wait_op - wait for a flash operation to complete @adapter : the adapter @attempts : max number of polls of the status register @delay : delay between polls in ms