aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/epca.c
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2005-09-15 17:53:28 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-16 13:38:10 -0400
commitbc9a5154a24d16d41cc79dbf1442de34454bc7db (patch)
treec9633ebe5ed8d20f7e2879e0acd1c991cc320de0 /drivers/char/epca.c
parent6da34a8dc03c9605b03154eacfd2234627cc485a (diff)
[PATCH] epca iomem annotations + several missing readw()
[originally sent to Alan, he had no problems with it] - iomem pointers marked as such - several direct dereferencings of such pointers replaced with read[bw](). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/epca.c')
-rw-r--r--drivers/char/epca.c84
1 files changed, 44 insertions, 40 deletions
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index 58d3738a2b7f..407708a001e4 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -534,7 +534,7 @@ static void shutdown(struct channel *ch)
534 534
535 unsigned long flags; 535 unsigned long flags;
536 struct tty_struct *tty; 536 struct tty_struct *tty;
537 struct board_chan *bc; 537 struct board_chan __iomem *bc;
538 538
539 if (!(ch->asyncflags & ASYNC_INITIALIZED)) 539 if (!(ch->asyncflags & ASYNC_INITIALIZED))
540 return; 540 return;
@@ -618,7 +618,7 @@ static int pc_write(struct tty_struct * tty,
618 struct channel *ch; 618 struct channel *ch;
619 unsigned long flags; 619 unsigned long flags;
620 int remain; 620 int remain;
621 struct board_chan *bc; 621 struct board_chan __iomem *bc;
622 622
623 /* ---------------------------------------------------------------- 623 /* ----------------------------------------------------------------
624 pc_write is primarily called directly by the kernel routine 624 pc_write is primarily called directly by the kernel routine
@@ -685,7 +685,7 @@ static int pc_write(struct tty_struct * tty,
685 ------------------------------------------------------------------- */ 685 ------------------------------------------------------------------- */
686 686
687 dataLen = min(bytesAvailable, dataLen); 687 dataLen = min(bytesAvailable, dataLen);
688 memcpy(ch->txptr + head, buf, dataLen); 688 memcpy_toio(ch->txptr + head, buf, dataLen);
689 buf += dataLen; 689 buf += dataLen;
690 head += dataLen; 690 head += dataLen;
691 amountCopied += dataLen; 691 amountCopied += dataLen;
@@ -726,7 +726,7 @@ static int pc_write_room(struct tty_struct *tty)
726 struct channel *ch; 726 struct channel *ch;
727 unsigned long flags; 727 unsigned long flags;
728 unsigned int head, tail; 728 unsigned int head, tail;
729 struct board_chan *bc; 729 struct board_chan __iomem *bc;
730 730
731 remain = 0; 731 remain = 0;
732 732
@@ -773,7 +773,7 @@ static int pc_chars_in_buffer(struct tty_struct *tty)
773 int remain; 773 int remain;
774 unsigned long flags; 774 unsigned long flags;
775 struct channel *ch; 775 struct channel *ch;
776 struct board_chan *bc; 776 struct board_chan __iomem *bc;
777 777
778 /* --------------------------------------------------------- 778 /* ---------------------------------------------------------
779 verifyChannel returns the channel from the tty struct 779 verifyChannel returns the channel from the tty struct
@@ -830,7 +830,7 @@ static void pc_flush_buffer(struct tty_struct *tty)
830 unsigned int tail; 830 unsigned int tail;
831 unsigned long flags; 831 unsigned long flags;
832 struct channel *ch; 832 struct channel *ch;
833 struct board_chan *bc; 833 struct board_chan __iomem *bc;
834 /* --------------------------------------------------------- 834 /* ---------------------------------------------------------
835 verifyChannel returns the channel from the tty struct 835 verifyChannel returns the channel from the tty struct
836 if it is valid. This serves as a sanity check. 836 if it is valid. This serves as a sanity check.
@@ -976,7 +976,7 @@ static int pc_open(struct tty_struct *tty, struct file * filp)
976 struct channel *ch; 976 struct channel *ch;
977 unsigned long flags; 977 unsigned long flags;
978 int line, retval, boardnum; 978 int line, retval, boardnum;
979 struct board_chan *bc; 979 struct board_chan __iomem *bc;
980 unsigned int head; 980 unsigned int head;
981 981
982 line = tty->index; 982 line = tty->index;
@@ -1041,7 +1041,7 @@ static int pc_open(struct tty_struct *tty, struct file * filp)
1041 ch->statusflags = 0; 1041 ch->statusflags = 0;
1042 1042
1043 /* Save boards current modem status */ 1043 /* Save boards current modem status */
1044 ch->imodem = bc->mstat; 1044 ch->imodem = readb(&bc->mstat);
1045 1045
1046 /* ---------------------------------------------------------------- 1046 /* ----------------------------------------------------------------
1047 Set receive head and tail ptrs to each other. This indicates 1047 Set receive head and tail ptrs to each other. This indicates
@@ -1399,10 +1399,10 @@ static void post_fep_init(unsigned int crd)
1399{ /* Begin post_fep_init */ 1399{ /* Begin post_fep_init */
1400 1400
1401 int i; 1401 int i;
1402 unsigned char *memaddr; 1402 void __iomem *memaddr;
1403 struct global_data *gd; 1403 struct global_data __iomem *gd;
1404 struct board_info *bd; 1404 struct board_info *bd;
1405 struct board_chan *bc; 1405 struct board_chan __iomem *bc;
1406 struct channel *ch; 1406 struct channel *ch;
1407 int shrinkmem = 0, lowwater ; 1407 int shrinkmem = 0, lowwater ;
1408 1408
@@ -1461,7 +1461,7 @@ static void post_fep_init(unsigned int crd)
1461 8 and 64 of these structures. 1461 8 and 64 of these structures.
1462 -------------------------------------------------------------------- */ 1462 -------------------------------------------------------------------- */
1463 1463
1464 bc = (struct board_chan *)(memaddr + CHANSTRUCT); 1464 bc = memaddr + CHANSTRUCT;
1465 1465
1466 /* ------------------------------------------------------------------- 1466 /* -------------------------------------------------------------------
1467 The below assignment will set gd to point at the BEGINING of 1467 The below assignment will set gd to point at the BEGINING of
@@ -1470,7 +1470,7 @@ static void post_fep_init(unsigned int crd)
1470 pointer begins at 0xd10. 1470 pointer begins at 0xd10.
1471 ---------------------------------------------------------------------- */ 1471 ---------------------------------------------------------------------- */
1472 1472
1473 gd = (struct global_data *)(memaddr + GLOBAL); 1473 gd = memaddr + GLOBAL;
1474 1474
1475 /* -------------------------------------------------------------------- 1475 /* --------------------------------------------------------------------
1476 XEPORTS (address 0xc22) points at the number of channels the 1476 XEPORTS (address 0xc22) points at the number of channels the
@@ -1493,6 +1493,7 @@ static void post_fep_init(unsigned int crd)
1493 1493
1494 for (i = 0; i < bd->numports; i++, ch++, bc++) { /* Begin for each port */ 1494 for (i = 0; i < bd->numports; i++, ch++, bc++) { /* Begin for each port */
1495 unsigned long flags; 1495 unsigned long flags;
1496 u16 tseg, rseg;
1496 1497
1497 ch->brdchan = bc; 1498 ch->brdchan = bc;
1498 ch->mailbox = gd; 1499 ch->mailbox = gd;
@@ -1553,50 +1554,53 @@ static void post_fep_init(unsigned int crd)
1553 shrinkmem = 0; 1554 shrinkmem = 0;
1554 } 1555 }
1555 1556
1557 tseg = readw(&bc->tseg);
1558 rseg = readw(&bc->rseg);
1559
1556 switch (bd->type) { 1560 switch (bd->type) {
1557 1561
1558 case PCIXEM: 1562 case PCIXEM:
1559 case PCIXRJ: 1563 case PCIXRJ:
1560 case PCIXR: 1564 case PCIXR:
1561 /* Cover all the 2MEG cards */ 1565 /* Cover all the 2MEG cards */
1562 ch->txptr = memaddr + (((bc->tseg) << 4) & 0x1fffff); 1566 ch->txptr = memaddr + ((tseg << 4) & 0x1fffff);
1563 ch->rxptr = memaddr + (((bc->rseg) << 4) & 0x1fffff); 1567 ch->rxptr = memaddr + ((rseg << 4) & 0x1fffff);
1564 ch->txwin = FEPWIN | ((bc->tseg) >> 11); 1568 ch->txwin = FEPWIN | (tseg >> 11);
1565 ch->rxwin = FEPWIN | ((bc->rseg) >> 11); 1569 ch->rxwin = FEPWIN | (rseg >> 11);
1566 break; 1570 break;
1567 1571
1568 case PCXEM: 1572 case PCXEM:
1569 case EISAXEM: 1573 case EISAXEM:
1570 /* Cover all the 32K windowed cards */ 1574 /* Cover all the 32K windowed cards */
1571 /* Mask equal to window size - 1 */ 1575 /* Mask equal to window size - 1 */
1572 ch->txptr = memaddr + (((bc->tseg) << 4) & 0x7fff); 1576 ch->txptr = memaddr + ((tseg << 4) & 0x7fff);
1573 ch->rxptr = memaddr + (((bc->rseg) << 4) & 0x7fff); 1577 ch->rxptr = memaddr + ((rseg << 4) & 0x7fff);
1574 ch->txwin = FEPWIN | ((bc->tseg) >> 11); 1578 ch->txwin = FEPWIN | (tseg >> 11);
1575 ch->rxwin = FEPWIN | ((bc->rseg) >> 11); 1579 ch->rxwin = FEPWIN | (rseg >> 11);
1576 break; 1580 break;
1577 1581
1578 case PCXEVE: 1582 case PCXEVE:
1579 case PCXE: 1583 case PCXE:
1580 ch->txptr = memaddr + (((bc->tseg - bd->memory_seg) << 4) & 0x1fff); 1584 ch->txptr = memaddr + (((tseg - bd->memory_seg) << 4) & 0x1fff);
1581 ch->txwin = FEPWIN | ((bc->tseg - bd->memory_seg) >> 9); 1585 ch->txwin = FEPWIN | ((tseg - bd->memory_seg) >> 9);
1582 ch->rxptr = memaddr + (((bc->rseg - bd->memory_seg) << 4) & 0x1fff); 1586 ch->rxptr = memaddr + (((rseg - bd->memory_seg) << 4) & 0x1fff);
1583 ch->rxwin = FEPWIN | ((bc->rseg - bd->memory_seg) >>9 ); 1587 ch->rxwin = FEPWIN | ((rseg - bd->memory_seg) >>9 );
1584 break; 1588 break;
1585 1589
1586 case PCXI: 1590 case PCXI:
1587 case PC64XE: 1591 case PC64XE:
1588 ch->txptr = memaddr + ((bc->tseg - bd->memory_seg) << 4); 1592 ch->txptr = memaddr + ((tseg - bd->memory_seg) << 4);
1589 ch->rxptr = memaddr + ((bc->rseg - bd->memory_seg) << 4); 1593 ch->rxptr = memaddr + ((rseg - bd->memory_seg) << 4);
1590 ch->txwin = ch->rxwin = 0; 1594 ch->txwin = ch->rxwin = 0;
1591 break; 1595 break;
1592 1596
1593 } /* End switch bd->type */ 1597 } /* End switch bd->type */
1594 1598
1595 ch->txbufhead = 0; 1599 ch->txbufhead = 0;
1596 ch->txbufsize = bc->tmax + 1; 1600 ch->txbufsize = readw(&bc->tmax) + 1;
1597 1601
1598 ch->rxbufhead = 0; 1602 ch->rxbufhead = 0;
1599 ch->rxbufsize = bc->rmax + 1; 1603 ch->rxbufsize = readw(&bc->rmax) + 1;
1600 1604
1601 lowwater = ch->txbufsize >= 2000 ? 1024 : (ch->txbufsize / 2); 1605 lowwater = ch->txbufsize >= 2000 ? 1024 : (ch->txbufsize / 2);
1602 1606
@@ -1718,11 +1722,11 @@ static void epcapoll(unsigned long ignored)
1718static void doevent(int crd) 1722static void doevent(int crd)
1719{ /* Begin doevent */ 1723{ /* Begin doevent */
1720 1724
1721 void *eventbuf; 1725 void __iomem *eventbuf;
1722 struct channel *ch, *chan0; 1726 struct channel *ch, *chan0;
1723 static struct tty_struct *tty; 1727 static struct tty_struct *tty;
1724 struct board_info *bd; 1728 struct board_info *bd;
1725 struct board_chan *bc; 1729 struct board_chan __iomem *bc;
1726 unsigned int tail, head; 1730 unsigned int tail, head;
1727 int event, channel; 1731 int event, channel;
1728 int mstat, lstat; 1732 int mstat, lstat;
@@ -1817,7 +1821,7 @@ static void doevent(int crd)
1817static void fepcmd(struct channel *ch, int cmd, int word_or_byte, 1821static void fepcmd(struct channel *ch, int cmd, int word_or_byte,
1818 int byte2, int ncmds, int bytecmd) 1822 int byte2, int ncmds, int bytecmd)
1819{ /* Begin fepcmd */ 1823{ /* Begin fepcmd */
1820 unchar *memaddr; 1824 unchar __iomem *memaddr;
1821 unsigned int head, cmdTail, cmdStart, cmdMax; 1825 unsigned int head, cmdTail, cmdStart, cmdMax;
1822 long count; 1826 long count;
1823 int n; 1827 int n;
@@ -2000,7 +2004,7 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
2000 2004
2001 unsigned int cmdHead; 2005 unsigned int cmdHead;
2002 struct termios *ts; 2006 struct termios *ts;
2003 struct board_chan *bc; 2007 struct board_chan __iomem *bc;
2004 unsigned mval, hflow, cflag, iflag; 2008 unsigned mval, hflow, cflag, iflag;
2005 2009
2006 bc = ch->brdchan; 2010 bc = ch->brdchan;
@@ -2010,7 +2014,7 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
2010 ts = tty->termios; 2014 ts = tty->termios;
2011 if ((ts->c_cflag & CBAUD) == 0) { /* Begin CBAUD detected */ 2015 if ((ts->c_cflag & CBAUD) == 0) { /* Begin CBAUD detected */
2012 cmdHead = readw(&bc->rin); 2016 cmdHead = readw(&bc->rin);
2013 bc->rout = cmdHead; 2017 writew(cmdHead, &bc->rout);
2014 cmdHead = readw(&bc->tin); 2018 cmdHead = readw(&bc->tin);
2015 /* Changing baud in mid-stream transmission can be wonderful */ 2019 /* Changing baud in mid-stream transmission can be wonderful */
2016 /* --------------------------------------------------------------- 2020 /* ---------------------------------------------------------------
@@ -2116,7 +2120,7 @@ static void receive_data(struct channel *ch)
2116 unchar *rptr; 2120 unchar *rptr;
2117 struct termios *ts = NULL; 2121 struct termios *ts = NULL;
2118 struct tty_struct *tty; 2122 struct tty_struct *tty;
2119 struct board_chan *bc; 2123 struct board_chan __iomem *bc;
2120 int dataToRead, wrapgap, bytesAvailable; 2124 int dataToRead, wrapgap, bytesAvailable;
2121 unsigned int tail, head; 2125 unsigned int tail, head;
2122 unsigned int wrapmask; 2126 unsigned int wrapmask;
@@ -2154,7 +2158,7 @@ static void receive_data(struct channel *ch)
2154 --------------------------------------------------------------------- */ 2158 --------------------------------------------------------------------- */
2155 2159
2156 if (!tty || !ts || !(ts->c_cflag & CREAD)) { 2160 if (!tty || !ts || !(ts->c_cflag & CREAD)) {
2157 bc->rout = head; 2161 writew(head, &bc->rout);
2158 return; 2162 return;
2159 } 2163 }
2160 2164
@@ -2270,7 +2274,7 @@ static int info_ioctl(struct tty_struct *tty, struct file * file,
2270static int pc_tiocmget(struct tty_struct *tty, struct file *file) 2274static int pc_tiocmget(struct tty_struct *tty, struct file *file)
2271{ 2275{
2272 struct channel *ch = (struct channel *) tty->driver_data; 2276 struct channel *ch = (struct channel *) tty->driver_data;
2273 struct board_chan *bc; 2277 struct board_chan __iomem *bc;
2274 unsigned int mstat, mflag = 0; 2278 unsigned int mstat, mflag = 0;
2275 unsigned long flags; 2279 unsigned long flags;
2276 2280
@@ -2351,7 +2355,7 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file,
2351 unsigned long flags; 2355 unsigned long flags;
2352 unsigned int mflag, mstat; 2356 unsigned int mflag, mstat;
2353 unsigned char startc, stopc; 2357 unsigned char startc, stopc;
2354 struct board_chan *bc; 2358 struct board_chan __iomem *bc;
2355 struct channel *ch = (struct channel *) tty->driver_data; 2359 struct channel *ch = (struct channel *) tty->driver_data;
2356 void __user *argp = (void __user *)arg; 2360 void __user *argp = (void __user *)arg;
2357 2361
@@ -2633,7 +2637,7 @@ static void pc_start(struct tty_struct *tty)
2633 spin_lock_irqsave(&epca_lock, flags); 2637 spin_lock_irqsave(&epca_lock, flags);
2634 /* Just in case output was resumed because of a change in Digi-flow */ 2638 /* Just in case output was resumed because of a change in Digi-flow */
2635 if (ch->statusflags & TXSTOPPED) { /* Begin transmit resume requested */ 2639 if (ch->statusflags & TXSTOPPED) { /* Begin transmit resume requested */
2636 struct board_chan *bc; 2640 struct board_chan __iomem *bc;
2637 globalwinon(ch); 2641 globalwinon(ch);
2638 bc = ch->brdchan; 2642 bc = ch->brdchan;
2639 if (ch->statusflags & LOWWAIT) 2643 if (ch->statusflags & LOWWAIT)
@@ -2727,7 +2731,7 @@ void digi_send_break(struct channel *ch, int msec)
2727static void setup_empty_event(struct tty_struct *tty, struct channel *ch) 2731static void setup_empty_event(struct tty_struct *tty, struct channel *ch)
2728{ /* Begin setup_empty_event */ 2732{ /* Begin setup_empty_event */
2729 2733
2730 struct board_chan *bc = ch->brdchan; 2734 struct board_chan __iomem *bc = ch->brdchan;
2731 2735
2732 globalwinon(ch); 2736 globalwinon(ch);
2733 ch->statusflags |= EMPTYWAIT; 2737 ch->statusflags |= EMPTYWAIT;