rem: LOG(("write: acquiring sem failed: %d, %s\n", (int)status, strerror(status)));
add: LOG(("write: acquiring sem failed: %ld, %s\n", status, strerror(status)));
context: wb840_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes){	wb_device *device = (wb_device*)cookie;	status_t status = B_OK;	uint16 frameSize;	int16 current;	uint32 check;		LOG((DEVICE_NAME ": write()\n"));		atomic_add(&device->txLock, 1);	if (*num_bytes > WB_MAX_FRAMELEN)		*num_bytes = WB_MAX_FRAMELEN;	frameSize = *num_bytes;	current = device->txCurrent;	// block until a free tx descriptor is available	if ((status = acquire_sem_etc(device->txSem, 1, B_TIMEOUT, ETHER_TRANSMIT_TIMEOUT)) < B_OK) {		write32(device->reg_base + WB_TXSTART, 0xFFFFFFFF);		LOG(("write: acquiring sem failed: %d, %s\n", (int)status, strerror(status)));		atomic_add(&device->txLock, -1);		*num_bytes = 0;		return status;	}		check = device->txDescriptor[current].wb_status;		if (check & WB_TXSTAT_OWN) {		// descriptor is still in use		dprintf(DEVICE_NAME ": card owns buffer %d\n", (int)current);		atomic_add(&device->txLock, -1);		*num_bytes = 0;		return B_ERROR;	}	/* Copy data to tx buffer */	memcpy((void *)device->txBuffer[current], buffer, frameSize);	device->txCurrent = (current + 1) & WB_TX_CNT_MASK;	LOG((DEVICE_NAME ": %d bytes written\n", frameSize));	{		cpu_status former;		former = disable_interrupts();		acquire_spinlock(&device->txSpinlock);				device->txDescriptor[current].wb_ctl |= frameSize | WB_TXCTL_FIRSTFRAG | WB_TXCTL_LASTFRAG;		device->txDescriptor[current].wb_status = WB_TXSTAT_OWN;		device->txSent++;		release_spinlock(&device->txSpinlock);   		restore_interrupts(former);	}	// re-enable transmit state machine	write32(device->reg_base + WB_TXSTART, 0xFFFFFFFF);	atomic_add(&device->txLock, -1);		return B_OK;}