int dma_buf_write(pc300_t * card, int ch, ucchar * ptdata, int len) 
static int dma_buf_write(pc300_t * card, int ch, ucchar * ptdata, int len) 
int dma_buf_write(pc300_t * card, int ch, ucchar * ptdata, int len){	int i, nchar;	volatile pcsca_bd_t __iomem *ptdescr;	int tosend = len;	ucchar nbuf = ((len - 1) / BD_DEF_LEN) + 1;	if (nbuf >= card->chan[ch].nfree_tx_bd) {		return -ENOMEM;	}	for (i = 0; i < nbuf; i++) {		ptdescr = (card->hw.rambase +					  TX_BD_ADDR(ch, card->chan[ch].tx_next_bd));		nchar = cpc_min(BD_DEF_LEN, tosend);		if (cpc_readb(&ptdescr->status) & DST_OSB) {			memcpy_toio((card->hw.rambase + cpc_readl(&ptdescr->ptbuf)),				    &ptdata[len - tosend], nchar);			cpc_writew(&ptdescr->len, nchar);			card->chan[ch].nfree_tx_bd--;			if ((i + 1) == nbuf) {				/* This must be the last BD to be used */				cpc_writeb(&ptdescr->status, DST_EOM);			} else {				cpc_writeb(&ptdescr->status, 0);			}		} else {			return -ENOMEM;		}		tosend -= nchar;		card->chan[ch].tx_next_bd =			(card->chan[ch].tx_next_bd + 1) & (N_DMA_TX_BUF - 1);	}	/* If it gets to here, it means we have sent the whole frame */	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/7665a08928f241247afe8c76865cdbe4ef5489bf/pc300_drv.c/buggy/drivers/net/wan/pc300_drv.c