X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fnet%2Fwan%2Fpc300_tty.c;h=29f84ad087303ee5eb7beaee32a80825b673062d;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=9e50d5d0262d99d753cd673670966b4b1009cf38;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index 9e50d5d02..29f84ad08 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c @@ -120,8 +120,7 @@ int cpc_tty_unreg_flag = 0; /* TTY functions prototype */ static int cpc_tty_open(struct tty_struct *tty, struct file *flip); static void cpc_tty_close(struct tty_struct *tty, struct file *flip); -static int cpc_tty_write(struct tty_struct *tty, int from_user, - const unsigned char *buf, int count); +static int cpc_tty_write(struct tty_struct *tty, const unsigned char *buf, int count); static int cpc_tty_write_room(struct tty_struct *tty); static int cpc_tty_chars_in_buffer(struct tty_struct *tty); static void cpc_tty_flush_buffer(struct tty_struct *tty); @@ -427,8 +426,7 @@ static void cpc_tty_close(struct tty_struct *tty, struct file *flip) * o verify the DCD signal * o send characters to board and start the transmission */ -static int cpc_tty_write(struct tty_struct *tty, int from_user, - const unsigned char *buf, int count) +static int cpc_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) { st_cpc_tty_area *cpc_tty; pc300ch_t *pc300chan; @@ -454,8 +452,7 @@ static int cpc_tty_write(struct tty_struct *tty, int from_user, return -EINVAL; /* frame too big */ } - CPC_TTY_DBG("%s: cpc_tty_write %s data len=%i\n",cpc_tty->name, - (from_user)?"from user" : "from kernel",count); + CPC_TTY_DBG("%s: cpc_tty_write data len=%i\n",cpc_tty->name,count); pc300chan = (pc300ch_t *)((pc300dev_t*)cpc_tty->pc300dev)->chan; stats = hdlc_stats(((pc300dev_t*)cpc_tty->pc300dev)->dev); @@ -482,27 +479,10 @@ static int cpc_tty_write(struct tty_struct *tty, int from_user, return -EINVAL; } - if (from_user) { - unsigned char *buf_tmp; - - buf_tmp = cpc_tty->buf_tx; - if (copy_from_user(buf_tmp, buf, count)) { - /* failed to copy from user */ - CPC_TTY_DBG("%s: error in copy from user\n",cpc_tty->name); - return -EINVAL; - } - - if (cpc_tty_send_to_card(cpc_tty->pc300dev, (void*) buf_tmp,count)) { - /* failed to send */ - CPC_TTY_DBG("%s: transmission error\n",cpc_tty->name); - return 0; - } - } else { - if (cpc_tty_send_to_card(cpc_tty->pc300dev, (void*)buf, count)) { - /* failed to send */ - CPC_TTY_DBG("%s: trasmition error\n", cpc_tty->name); - return 0; - } + if (cpc_tty_send_to_card(cpc_tty->pc300dev, (void*)buf, count)) { + /* failed to send */ + CPC_TTY_DBG("%s: trasmition error\n", cpc_tty->name); + return 0; } return count; } @@ -730,13 +710,13 @@ static void cpc_tty_rx_work(void * data) */ static void cpc_tty_rx_disc_frame(pc300ch_t *pc300chan) { - volatile pcsca_bd_t * ptdescr; + volatile pcsca_bd_t __iomem * ptdescr; volatile unsigned char status; pc300_t *card = (pc300_t *)pc300chan->card; int ch = pc300chan->channel; /* dma buf read */ - ptdescr = (pcsca_bd_t *)(card->hw.rambase + + ptdescr = (pcsca_bd_t __iomem *)(card->hw.rambase + RX_BD_ADDR(ch, pc300chan->rx_first_bd)); while (pc300chan->rx_first_bd != pc300chan->rx_last_bd) { status = cpc_readb(&ptdescr->status); @@ -747,7 +727,7 @@ static void cpc_tty_rx_disc_frame(pc300ch_t *pc300chan) if (status & DST_EOM) { break; /* end of message */ } - ptdescr = (pcsca_bd_t *)(card->hw.rambase + cpc_readl(&ptdescr->next)); + ptdescr = (pcsca_bd_t __iomem *)(card->hw.rambase + cpc_readl(&ptdescr->next)); } } @@ -757,7 +737,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev) pc300ch_t *pc300chan = (pc300ch_t *)pc300dev->chan; pc300_t *card = (pc300_t *)pc300chan->card; int ch = pc300chan->channel; - volatile pcsca_bd_t * ptdescr; + volatile pcsca_bd_t __iomem * ptdescr; struct net_device_stats *stats = hdlc_stats(pc300dev->dev); int rx_len, rx_aux; volatile unsigned char status; @@ -775,14 +755,14 @@ void cpc_tty_receive(pc300dev_t *pc300dev) while (1) { rx_len = 0; - ptdescr = (pcsca_bd_t *)(card->hw.rambase + RX_BD_ADDR(ch, first_bd)); + ptdescr = (pcsca_bd_t __iomem *)(card->hw.rambase + RX_BD_ADDR(ch, first_bd)); while ((status = cpc_readb(&ptdescr->status)) & DST_OSB) { rx_len += cpc_readw(&ptdescr->len); first_bd = (first_bd + 1) & (N_DMA_RX_BUF - 1); if (status & DST_EOM) { break; } - ptdescr=(pcsca_bd_t*)(card->hw.rambase+cpc_readl(&ptdescr->next)); + ptdescr=(pcsca_bd_t __iomem *)(card->hw.rambase+cpc_readl(&ptdescr->next)); } if (!rx_len) { @@ -814,7 +794,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev) } /* dma buf read */ - ptdescr = (pcsca_bd_t *)(card->hw.rambase + + ptdescr = (pcsca_bd_t __iomem *)(card->hw.rambase + RX_BD_ADDR(ch, pc300chan->rx_first_bd)); rx_len = 0; /* counter frame size */ @@ -858,7 +838,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev) /* read the segment of the frame */ if (rx_aux != 0) { memcpy_fromio((new->data + rx_len), - (void *)(card->hw.rambase + + (void __iomem *)(card->hw.rambase + cpc_readl(&ptdescr->ptbuf)), rx_aux); rx_len += rx_aux; } @@ -868,7 +848,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev) (N_DMA_RX_BUF -1); if (status & DST_EOM)break; - ptdescr = (pcsca_bd_t *) (card->hw.rambase + + ptdescr = (pcsca_bd_t __iomem *) (card->hw.rambase + cpc_readl(&ptdescr->next)); } /* update pointer */ @@ -936,7 +916,7 @@ static int cpc_tty_send_to_card(pc300dev_t *dev,void* buf, int len) int ch = chan->channel; struct net_device_stats *stats = hdlc_stats(dev->dev); unsigned long flags; - volatile pcsca_bd_t * ptdescr; + volatile pcsca_bd_t __iomem *ptdescr; int i, nchar; int tosend = len; int nbuf = ((len - 1)/BD_DEF_LEN) + 1; @@ -953,11 +933,11 @@ static int cpc_tty_send_to_card(pc300dev_t *dev,void* buf, int len) CPC_TTY_DBG("%s: call dma_buf_write\n", (st_cpc_tty_area *)dev->cpc_tty->name); for (i = 0 ; i < nbuf ; i++) { - ptdescr = (pcsca_bd_t *)(card->hw.rambase + + ptdescr = (pcsca_bd_t __iomem *)(card->hw.rambase + TX_BD_ADDR(ch, card->chan[ch].tx_next_bd)); nchar = (BD_DEF_LEN > tosend) ? tosend : BD_DEF_LEN; if (cpc_readb(&ptdescr->status) & DST_OSB) { - memcpy_toio((void *)(card->hw.rambase + + memcpy_toio((void __iomem *)(card->hw.rambase + cpc_readl(&ptdescr->ptbuf)), &pdata[len - tosend], nchar);