aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-03-24 06:18:27 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-24 10:33:29 -0500
commite2b3afd676ad3e15ca2efca3b3605c7d817ec6e3 (patch)
treef6b7c9739e20a865b6f1f379ccbab67a63ddec53 /drivers/char
parent27c6e526f34760a9c48a90112242b7165064fa85 (diff)
[PATCH] rio driver rework continued #2
First large chunk of code cleanup. The split between this and #3 and #4 is fairly arbitary and due to the message length limit on the list. These patches continue the process of ripping out macros and typedefs while cleaning up lots of 32bit assumptions. Several inlines for compatibility also get removed and that causes a lot of noise. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/rio/rioparam.c108
-rw-r--r--drivers/char/rio/rioroute.c62
-rw-r--r--drivers/char/rio/riotable.c76
-rw-r--r--drivers/char/rio/riotty.c23
4 files changed, 115 insertions, 154 deletions
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c
index c622f46d6d77..af25d2084f47 100644
--- a/drivers/char/rio/rioparam.c
+++ b/drivers/char/rio/rioparam.c
@@ -157,20 +157,16 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3";
157** NB. for MPX 157** NB. for MPX
158** tty lock must NOT have been previously acquired. 158** tty lock must NOT have been previously acquired.
159*/ 159*/
160int RIOParam(PortP, cmd, Modem, SleepFlag) 160int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag)
161struct Port *PortP;
162int cmd;
163int Modem;
164int SleepFlag;
165{ 161{
166 register struct tty_struct *TtyP; 162 struct tty_struct *TtyP;
167 int retval; 163 int retval;
168 register struct phb_param *phb_param_ptr; 164 struct phb_param *phb_param_ptr;
169 PKT *PacketP; 165 PKT *PacketP;
170 int res; 166 int res;
171 uchar Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0; 167 u8 Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0;
172 uchar TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0; 168 u8 TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0;
173 uchar LNext = 0, TxBaud = 0, RxBaud = 0; 169 u8 LNext = 0, TxBaud = 0, RxBaud = 0;
174 int retries = 0xff; 170 int retries = 0xff;
175 unsigned long flags; 171 unsigned long flags;
176 172
@@ -226,15 +222,12 @@ int SleepFlag;
226 if (retval == RIO_FAIL) { 222 if (retval == RIO_FAIL) {
227 rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n"); 223 rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n");
228 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 224 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
229 pseterr(EINTR);
230 func_exit(); 225 func_exit();
231 226 return -EINTR;
232 return RIO_FAIL;
233 } 227 }
234 if (PortP->State & RIO_DELETED) { 228 if (PortP->State & RIO_DELETED) {
235 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 229 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
236 func_exit(); 230 func_exit();
237
238 return RIO_SUCCESS; 231 return RIO_SUCCESS;
239 } 232 }
240 } 233 }
@@ -247,7 +240,7 @@ int SleepFlag;
247 } 240 }
248 241
249 rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res); 242 rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res);
250 rio_dprintk(RIO_DEBUG_PARAM, "Packet is 0x%x\n", (int) PacketP); 243 rio_dprintk(RIO_DEBUG_PARAM, "Packet is 0x%p\n", PacketP);
251 244
252 phb_param_ptr = (struct phb_param *) PacketP->data; 245 phb_param_ptr = (struct phb_param *) PacketP->data;
253 246
@@ -474,9 +467,6 @@ int SleepFlag;
474 e(115200); /* e(230400);e(460800); e(921600); */ 467 e(115200); /* e(230400);e(460800); e(921600); */
475 } 468 }
476 469
477 /* XXX MIssing conversion table. XXX */
478 /* (TtyP->termios->c_cflag & V_CBAUD); */
479
480 rio_dprintk(RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud); 470 rio_dprintk(RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud);
481 471
482 472
@@ -552,23 +542,23 @@ int SleepFlag;
552 /* 542 /*
553 ** Actually write the info into the packet to be sent 543 ** Actually write the info into the packet to be sent
554 */ 544 */
555 WBYTE(phb_param_ptr->Cmd, cmd); 545 writeb(cmd, &phb_param_ptr->Cmd);
556 WBYTE(phb_param_ptr->Cor1, Cor1); 546 writeb(Cor1, &phb_param_ptr->Cor1);
557 WBYTE(phb_param_ptr->Cor2, Cor2); 547 writeb(Cor2, &phb_param_ptr->Cor2);
558 WBYTE(phb_param_ptr->Cor4, Cor4); 548 writeb(Cor4, &phb_param_ptr->Cor4);
559 WBYTE(phb_param_ptr->Cor5, Cor5); 549 writeb(Cor5, &phb_param_ptr->Cor5);
560 WBYTE(phb_param_ptr->TxXon, TxXon); 550 writeb(TxXon, &phb_param_ptr->TxXon);
561 WBYTE(phb_param_ptr->RxXon, RxXon); 551 writeb(RxXon, &phb_param_ptr->RxXon);
562 WBYTE(phb_param_ptr->TxXoff, TxXoff); 552 writeb(TxXoff, &phb_param_ptr->TxXoff);
563 WBYTE(phb_param_ptr->RxXoff, RxXoff); 553 writeb(RxXoff, &phb_param_ptr->RxXoff);
564 WBYTE(phb_param_ptr->LNext, LNext); 554 writeb(LNext, &phb_param_ptr->LNext);
565 WBYTE(phb_param_ptr->TxBaud, TxBaud); 555 writeb(TxBaud, &phb_param_ptr->TxBaud);
566 WBYTE(phb_param_ptr->RxBaud, RxBaud); 556 writeb(RxBaud, &phb_param_ptr->RxBaud);
567 557
568 /* 558 /*
569 ** Set the length/command field 559 ** Set the length/command field
570 */ 560 */
571 WBYTE(PacketP->len, 12 | PKT_CMD_BIT); 561 writeb(12 | PKT_CMD_BIT, &PacketP->len);
572 562
573 /* 563 /*
574 ** The packet is formed - now, whack it off 564 ** The packet is formed - now, whack it off
@@ -597,15 +587,13 @@ int SleepFlag;
597** We can add another packet to a transmit queue if the packet pointer pointed 587** We can add another packet to a transmit queue if the packet pointer pointed
598** to by the TxAdd pointer has PKT_IN_USE clear in its address. 588** to by the TxAdd pointer has PKT_IN_USE clear in its address.
599*/ 589*/
600int can_add_transmit(PktP, PortP) 590int can_add_transmit(PKT **PktP, struct Port *PortP)
601PKT **PktP;
602struct Port *PortP;
603{ 591{
604 register PKT *tp; 592 PKT *tp;
605 593
606 *PktP = tp = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->TxAdd)); 594 *PktP = tp = (PKT *) RIO_PTR(PortP->Caddr, readw(PortP->TxAdd));
607 595
608 return !((uint) tp & PKT_IN_USE); 596 return !((unsigned long) tp & PKT_IN_USE);
609} 597}
610 598
611/* 599/*
@@ -613,24 +601,21 @@ struct Port *PortP;
613** and then move the TxAdd pointer along one position to point to the next 601** and then move the TxAdd pointer along one position to point to the next
614** packet pointer. You must wrap the pointer from the end back to the start. 602** packet pointer. You must wrap the pointer from the end back to the start.
615*/ 603*/
616void add_transmit(PortP) 604void add_transmit(struct Port *PortP)
617struct Port *PortP;
618{ 605{
619 if (RWORD(*PortP->TxAdd) & PKT_IN_USE) { 606 if (readw(PortP->TxAdd) & PKT_IN_USE) {
620 rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!"); 607 rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!");
621 } 608 }
622 WWORD(*(ushort *) PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE); 609 writew(readw(PortP->TxAdd) | PKT_IN_USE, PortP->TxAdd);
623 PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1; 610 PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1;
624 WWORD(PortP->PhbP->tx_add, RIO_OFF(PortP->Caddr, PortP->TxAdd)); 611 writew(RIO_OFF(PortP->Caddr, PortP->TxAdd), &PortP->PhbP->tx_add);
625} 612}
626 613
627/**************************************** 614/****************************************
628 * Put a packet onto the end of the 615 * Put a packet onto the end of the
629 * free list 616 * free list
630 ****************************************/ 617 ****************************************/
631void put_free_end(HostP, PktP) 618void put_free_end(struct Host *HostP, PKT *PktP)
632struct Host *HostP;
633PKT *PktP;
634{ 619{
635 FREE_LIST *tmp_pointer; 620 FREE_LIST *tmp_pointer;
636 ushort old_end, new_end; 621 ushort old_end, new_end;
@@ -643,21 +628,21 @@ PKT *PktP;
643 * 628 *
644 ************************************************/ 629 ************************************************/
645 630
646 rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%x)\n", (int) PktP); 631 rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%p)\n", PktP);
647 632
648 if ((old_end = RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) { 633 if ((old_end = readw(&HostP->ParmMapP->free_list_end)) != TPNULL) {
649 new_end = RIO_OFF(HostP->Caddr, PktP); 634 new_end = RIO_OFF(HostP->Caddr, PktP);
650 tmp_pointer = (FREE_LIST *) RIO_PTR(HostP->Caddr, old_end); 635 tmp_pointer = (FREE_LIST *) RIO_PTR(HostP->Caddr, old_end);
651 WWORD(tmp_pointer->next, new_end); 636 writew(new_end, &tmp_pointer->next);
652 WWORD(((FREE_LIST *) PktP)->prev, old_end); 637 writew(old_end, &((FREE_LIST *) PktP)->prev);
653 WWORD(((FREE_LIST *) PktP)->next, TPNULL); 638 writew(TPNULL, &((FREE_LIST *) PktP)->next);
654 WWORD(HostP->ParmMapP->free_list_end, new_end); 639 writew(new_end, &HostP->ParmMapP->free_list_end);
655 } else { /* First packet on the free list this should never happen! */ 640 } else { /* First packet on the free list this should never happen! */
656 rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n"); 641 rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n");
657 WWORD(HostP->ParmMapP->free_list_end, RIO_OFF(HostP->Caddr, PktP)); 642 writew(RIO_OFF(HostP->Caddr, PktP), &HostP->ParmMapP->free_list_end);
658 tmp_pointer = (FREE_LIST *) PktP; 643 tmp_pointer = (FREE_LIST *) PktP;
659 WWORD(tmp_pointer->prev, TPNULL); 644 writew(TPNULL, &tmp_pointer->prev);
660 WWORD(tmp_pointer->next, TPNULL); 645 writew(TPNULL, &tmp_pointer->next);
661 } 646 }
662 rio_dprintk(RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock); 647 rio_dprintk(RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock);
663 rio_spin_unlock_irqrestore(&HostP->HostLock, flags); 648 rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
@@ -669,12 +654,10 @@ PKT *PktP;
669** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear, 654** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear,
670** then can_remove_receive() returns 0. 655** then can_remove_receive() returns 0.
671*/ 656*/
672int can_remove_receive(PktP, PortP) 657int can_remove_receive(PKT **PktP, struct Port *PortP)
673PKT **PktP;
674struct Port *PortP;
675{ 658{
676 if (RWORD(*PortP->RxRemove) & PKT_IN_USE) { 659 if (readw(PortP->RxRemove) & PKT_IN_USE) {
677 *PktP = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->RxRemove) & ~PKT_IN_USE); 660 *PktP = (PKT *) RIO_PTR(PortP->Caddr, readw(PortP->RxRemove) & ~PKT_IN_USE);
678 return 1; 661 return 1;
679 } 662 }
680 return 0; 663 return 0;
@@ -685,10 +668,9 @@ struct Port *PortP;
685** and then bump the pointers. Once the pointers get to the end, they must 668** and then bump the pointers. Once the pointers get to the end, they must
686** be wrapped back to the start. 669** be wrapped back to the start.
687*/ 670*/
688void remove_receive(PortP) 671void remove_receive(struct Port *PortP)
689struct Port *PortP;
690{ 672{
691 WWORD(*PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE); 673 writew(readw(PortP->RxRemove) & ~PKT_IN_USE, PortP->RxRemove);
692 PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1; 674 PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1;
693 WWORD(PortP->PhbP->rx_remove, RIO_OFF(PortP->Caddr, PortP->RxRemove)); 675 writew(RIO_OFF(PortP->Caddr, PortP->RxRemove), &PortP->PhbP->rx_remove);
694} 676}
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c
index f98888f52659..874ac7462388 100644
--- a/drivers/char/rio/rioroute.c
+++ b/drivers/char/rio/rioroute.c
@@ -115,7 +115,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
115 /* 115 /*
116 ** Is this unit telling us it's current link topology? 116 ** Is this unit telling us it's current link topology?
117 */ 117 */
118 if (RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY) { 118 if (readb(&PktCmdP->Command) == ROUTE_TOPOLOGY) {
119 MapP = HostP->Mapping; 119 MapP = HostP->Mapping;
120 120
121 /* 121 /*
@@ -151,11 +151,11 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
151 ** it won't lie about network interconnect, total disconnects 151 ** it won't lie about network interconnect, total disconnects
152 ** and no-IDs. (or at least, it doesn't *matter* if it does) 152 ** and no-IDs. (or at least, it doesn't *matter* if it does)
153 */ 153 */
154 if (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort) MAX_RUP) 154 if (readb(&PktCmdP->RouteTopology[ThisLink].Unit) > (ushort) MAX_RUP)
155 continue; 155 continue;
156 156
157 for (NewLink = ThisLinkMin; NewLink < ThisLink; NewLink++) { 157 for (NewLink = ThisLinkMin; NewLink < ThisLink; NewLink++) {
158 if ((RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) == RBYTE(PktCmdP->RouteTopology[NewLink].Unit)) && (RBYTE(PktCmdP->RouteTopology[ThisLink].Link) == RBYTE(PktCmdP->RouteTopology[NewLink].Link))) { 158 if ((readb(&PktCmdP->RouteTopology[ThisLink].Unit) == readb(&PktCmdP->RouteTopology[NewLink].Unit)) && (readb(&PktCmdP->RouteTopology[ThisLink].Link) == readb(&PktCmdP->RouteTopology[NewLink].Link))) {
159 Lies++; 159 Lies++;
160 } 160 }
161 } 161 }
@@ -164,10 +164,10 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
164 if (Lies) { 164 if (Lies) {
165 rio_dprintk(RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n", Lies); 165 rio_dprintk(RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n", Lies);
166 rio_dprintk(RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n", 166 rio_dprintk(RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n",
167 RBYTE(PktCmdP->RouteTopology[0].Unit), 167 readb(&PktCmdP->RouteTopology[0].Unit),
168 'A' + RBYTE(PktCmdP->RouteTopology[0].Link), 168 'A' + readb(&PktCmdP->RouteTopology[0].Link),
169 RBYTE(PktCmdP->RouteTopology[1].Unit), 169 readb(&PktCmdP->RouteTopology[1].Unit),
170 'A' + RBYTE(PktCmdP->RouteTopology[1].Link), RBYTE(PktCmdP->RouteTopology[2].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[2].Link), RBYTE(PktCmdP->RouteTopology[3].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[3].Link)); 170 'A' + readb(&PktCmdP->RouteTopology[1].Link), readb(&PktCmdP->RouteTopology[2].Unit), 'A' + readb(&PktCmdP->RouteTopology[2].Link), readb(&PktCmdP->RouteTopology[3].Unit), 'A' + readb(&PktCmdP->RouteTopology[3].Link));
171 return TRUE; 171 return TRUE;
172 } 172 }
173 173
@@ -184,8 +184,8 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
184 /* 184 /*
185 ** this is what it is now connected to 185 ** this is what it is now connected to
186 */ 186 */
187 NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit); 187 NewUnit = readb(&PktCmdP->RouteTopology[ThisLink].Unit);
188 NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link); 188 NewLink = readb(&PktCmdP->RouteTopology[ThisLink].Link);
189 189
190 if (OldUnit != NewUnit || OldLink != NewLink) { 190 if (OldUnit != NewUnit || OldLink != NewLink) {
191 /* 191 /*
@@ -219,7 +219,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
219 219
220 if (NewUnit == ROUTE_INTERCONNECT) { 220 if (NewUnit == ROUTE_INTERCONNECT) {
221 if (!p->RIONoMessage) 221 if (!p->RIONoMessage)
222 cprintf("%s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink); 222 printk(KERN_DEBUG "rio: %s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink);
223 } 223 }
224 224
225 /* 225 /*
@@ -264,12 +264,12 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
264 /* 264 /*
265 ** The only other command we recognise is a route_request command 265 ** The only other command we recognise is a route_request command
266 */ 266 */
267 if (RBYTE(PktCmdP->Command) != ROUTE_REQUEST) { 267 if (readb(&PktCmdP->Command) != ROUTE_REQUEST) {
268 rio_dprintk(RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n", RBYTE(PktCmdP->Command), Rup, (int) HostP); 268 rio_dprintk(RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %p ROUTE_RUP\n", readb(&PktCmdP->Command), Rup, HostP);
269 return TRUE; 269 return TRUE;
270 } 270 }
271 271
272 RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24); 272 RtaUniq = (readb(&PktCmdP->UniqNum[0])) + (readb(&PktCmdP->UniqNum[1]) << 8) + (readb(&PktCmdP->UniqNum[2]) << 16) + (readb(&PktCmdP->UniqNum[3]) << 24);
273 273
274 /* 274 /*
275 ** Determine if 8 or 16 port RTA 275 ** Determine if 8 or 16 port RTA
@@ -278,7 +278,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
278 278
279 rio_dprintk(RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq); 279 rio_dprintk(RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq);
280 280
281 Mod = RBYTE(PktCmdP->ModuleTypes); 281 Mod = readb(&PktCmdP->ModuleTypes);
282 Mod1 = LONYBLE(Mod); 282 Mod1 = LONYBLE(Mod);
283 if (RtaType == TYPE_RTA16) { 283 if (RtaType == TYPE_RTA16) {
284 /* 284 /*
@@ -348,7 +348,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
348 if ((HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED)) { 348 if ((HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED)) {
349 if (!(HostP->Mapping[ThisUnit].Flags & MSG_DONE)) { 349 if (!(HostP->Mapping[ThisUnit].Flags & MSG_DONE)) {
350 if (!p->RIONoMessage) 350 if (!p->RIONoMessage)
351 cprintf("RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name); 351 printk(KERN_DEBUG "rio: RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name);
352 HostP->Mapping[ThisUnit].Flags |= MSG_DONE; 352 HostP->Mapping[ThisUnit].Flags |= MSG_DONE;
353 } 353 }
354 PktReplyP->Command = ROUTE_FOAD; 354 PktReplyP->Command = ROUTE_FOAD;
@@ -475,7 +475,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
475 475
476 if (!UnknownMesgDone) { 476 if (!UnknownMesgDone) {
477 if (!p->RIONoMessage) 477 if (!p->RIONoMessage)
478 cprintf("One or more unknown RTAs are being updated.\n"); 478 printk(KERN_DEBUG "rio: One or more unknown RTAs are being updated.\n");
479 UnknownMesgDone = 1; 479 UnknownMesgDone = 1;
480 } 480 }
481 481
@@ -527,7 +527,7 @@ uint unit;
527 */ 527 */
528 PortP = p->RIOPortp[HostP->Mapping[dest_unit - 1].SysPort]; 528 PortP = p->RIOPortp[HostP->Mapping[dest_unit - 1].SysPort];
529 529
530 link = RWORD(PortP->PhbP->link); 530 link = readw(&PortP->PhbP->link);
531 531
532 for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { 532 for (port = 0; port < PORTS_PER_RTA; port++, PortN++) {
533 ushort dest_port = port + 8; 533 ushort dest_port = port + 8;
@@ -569,18 +569,18 @@ uint unit;
569 ** card. This needs to be translated into a 32 bit pointer 569 ** card. This needs to be translated into a 32 bit pointer
570 ** so it can be accessed from the driver. 570 ** so it can be accessed from the driver.
571 */ 571 */
572 Pkt = (PKT *) RIO_PTR(HostP->Caddr, RINDW(TxPktP)); 572 Pkt = (PKT *) RIO_PTR(HostP->Caddr, readw(TxPktP));
573 573
574 /* 574 /*
575 ** If the packet is used, reset it. 575 ** If the packet is used, reset it.
576 */ 576 */
577 Pkt = (PKT *) ((uint) Pkt & ~PKT_IN_USE); 577 Pkt = (PKT *) ((unsigned long) Pkt & ~PKT_IN_USE);
578 WBYTE(Pkt->dest_unit, dest_unit); 578 writeb(dest_unit, &Pkt->dest_unit);
579 WBYTE(Pkt->dest_port, dest_port); 579 writeb(dest_port, &Pkt->dest_port);
580 } 580 }
581 rio_dprintk(RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", RWORD(PortP->PhbP->destination) & 0xff, (RWORD(PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port); 581 rio_dprintk(RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", readw(&PortP->PhbP->destination) & 0xff, (readw(&PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port);
582 WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); 582 writew(dest_unit + (dest_port << 8), &PortP->PhbP->destination);
583 WWORD(PortP->PhbP->link, link); 583 writew(link, &PortP->PhbP->link);
584 584
585 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 585 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
586 } 586 }
@@ -590,9 +590,9 @@ uint unit;
590 */ 590 */
591 if (link > 3) 591 if (link > 3)
592 return; 592 return;
593 if (((unit * 8) + 7) > RWORD(HostP->LinkStrP[link].last_port)) { 593 if (((unit * 8) + 7) > readw(&HostP->LinkStrP[link].last_port)) {
594 rio_dprintk(RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7); 594 rio_dprintk(RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7);
595 WWORD(HostP->LinkStrP[link].last_port, (unit * 8) + 7); 595 writew((unit * 8) + 7, &HostP->LinkStrP[link].last_port);
596 } 596 }
597 } 597 }
598} 598}
@@ -818,7 +818,7 @@ int Change;
818 ToType = ToId ? "RTA" : "HOST"; 818 ToType = ToId ? "RTA" : "HOST";
819 819
820 rio_dprintk(RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected"); 820 rio_dprintk(RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected");
821 cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected"); 821 printk(KERN_DEBUG "rio: Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected");
822} 822}
823 823
824/* 824/*
@@ -838,7 +838,7 @@ static int RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
838 */ 838 */
839 for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { 839 for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
840 if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) { 840 if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) {
841 bzero((caddr_t) & p->RIOSavedTable[entry], sizeof(struct Map)); 841 memset(&p->RIOSavedTable[entry], 0, sizeof(struct Map));
842 } 842 }
843 } 843 }
844 return 0; 844 return 0;
@@ -898,7 +898,7 @@ static int RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
898 int nOther = (HostP->Mapping[unit].ID2) - 1; 898 int nOther = (HostP->Mapping[unit].ID2) - 1;
899 899
900 rio_dprintk(RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther); 900 rio_dprintk(RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther);
901 bzero((caddr_t) & HostP->Mapping[nOther], sizeof(struct Map)); 901 memset(&HostP->Mapping[nOther], 0, sizeof(struct Map));
902 } 902 }
903 RIORemoveFromSavedTable(p, &HostP->Mapping[unit]); 903 RIORemoveFromSavedTable(p, &HostP->Mapping[unit]);
904 904
@@ -997,7 +997,7 @@ int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pI
997 /* 997 /*
998 ** Clear out this slot now that we intend to use it. 998 ** Clear out this slot now that we intend to use it.
999 */ 999 */
1000 bzero(&HostP->Mapping[unit], sizeof(struct Map)); 1000 memset(&HostP->Mapping[unit], 0, sizeof(struct Map));
1001 1001
1002 /* 1002 /*
1003 ** If the second ID is not needed then we can return 1003 ** If the second ID is not needed then we can return
@@ -1015,7 +1015,7 @@ int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pI
1015 /* 1015 /*
1016 ** Clear out this slot now that we intend to use it. 1016 ** Clear out this slot now that we intend to use it.
1017 */ 1017 */
1018 bzero(&HostP->Mapping[unit], sizeof(struct Map)); 1018 memset(&HostP->Mapping[unit], 0, sizeof(struct Map));
1019 1019
1020 /* At this point under the right(wrong?) conditions 1020 /* At this point under the right(wrong?) conditions
1021 ** we may have a first unit ID being higher than the 1021 ** we may have a first unit ID being higher than the
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c
index a86b216ab653..f1d50142b91d 100644
--- a/drivers/char/rio/riotable.c
+++ b/drivers/char/rio/riotable.c
@@ -91,8 +91,7 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2";
91** A configuration table has been loaded. It is now up to us 91** A configuration table has been loaded. It is now up to us
92** to sort it out and use the information contained therein. 92** to sort it out and use the information contained therein.
93*/ 93*/
94int RIONewTable(p) 94int RIONewTable(struct rio_info *p)
95struct rio_info *p;
96{ 95{
97 int Host, Host1, Host2, NameIsUnique, Entry, SubEnt; 96 int Host, Host1, Host2, NameIsUnique, Entry, SubEnt;
98 struct Map *MapP; 97 struct Map *MapP;
@@ -298,9 +297,9 @@ struct rio_info *p;
298 */ 297 */
299 for (Host = 0; Host < RIO_HOSTS; Host++) { 298 for (Host = 0; Host < RIO_HOSTS; Host++) {
300 for (Entry = 0; Entry < MAX_RUP; Entry++) { 299 for (Entry = 0; Entry < MAX_RUP; Entry++) {
301 bzero((caddr_t) & p->RIOHosts[Host].Mapping[Entry], sizeof(struct Map)); 300 memset(&p->RIOHosts[Host].Mapping[Entry], 0, sizeof(struct Map));
302 } 301 }
303 bzero((caddr_t) & p->RIOHosts[Host].Name[0], sizeof(p->RIOHosts[Host].Name)); 302 memset(&p->RIOHosts[Host].Name[0], 0, sizeof(p->RIOHosts[Host].Name));
304 } 303 }
305 304
306 /* 305 /*
@@ -409,9 +408,10 @@ struct rio_info *p;
409/* 408/*
410** User process needs the config table - build it from first 409** User process needs the config table - build it from first
411** principles. 410** principles.
411**
412* FIXME: SMP locking
412*/ 413*/
413int RIOApel(p) 414int RIOApel(struct rio_info *p)
414struct rio_info *p;
415{ 415{
416 int Host; 416 int Host;
417 int link; 417 int link;
@@ -419,17 +419,17 @@ struct rio_info *p;
419 int Next = 0; 419 int Next = 0;
420 struct Map *MapP; 420 struct Map *MapP;
421 struct Host *HostP; 421 struct Host *HostP;
422 long oldspl; 422 unsigned long flags;
423
424 disable(oldspl); /* strange but true! */
425 423
426 rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n"); 424 rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n");
427 425
428 bzero((caddr_t) & p->RIOConnectTable[0], sizeof(struct Map) * TOTAL_MAP_ENTRIES); 426 memset(&p->RIOConnectTable[0], 0, sizeof(struct Map) * TOTAL_MAP_ENTRIES);
429 427
430 for (Host = 0; Host < RIO_HOSTS; Host++) { 428 for (Host = 0; Host < RIO_HOSTS; Host++) {
431 rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host); 429 rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host);
432 HostP = &p->RIOHosts[Host]; 430 HostP = &p->RIOHosts[Host];
431 rio_spin_lock_irqsave(&HostP->HostLock, flags);
432
433 MapP = &p->RIOConnectTable[Next++]; 433 MapP = &p->RIOConnectTable[Next++];
434 MapP->HostUniqueNum = HostP->UniqueNum; 434 MapP->HostUniqueNum = HostP->UniqueNum;
435 if ((HostP->Flags & RUN_STATE) != RC_RUNNING) 435 if ((HostP->Flags & RUN_STATE) != RC_RUNNING)
@@ -453,8 +453,8 @@ struct rio_info *p;
453 Next++; 453 Next++;
454 } 454 }
455 } 455 }
456 rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
456 } 457 }
457 restore(oldspl);
458 return 0; 458 return 0;
459} 459}
460 460
@@ -463,9 +463,7 @@ struct rio_info *p;
463** if the entry is suitably inactive, then we can gob on it and remove 463** if the entry is suitably inactive, then we can gob on it and remove
464** it from the table. 464** it from the table.
465*/ 465*/
466int RIODeleteRta(p, MapP) 466int RIODeleteRta(struct rio_info *p, struct Map *MapP)
467struct rio_info *p;
468struct Map *MapP;
469{ 467{
470 int host, entry, port, link; 468 int host, entry, port, link;
471 int SysPort; 469 int SysPort;
@@ -543,7 +541,7 @@ struct Map *MapP;
543 if (PortP->SecondBlock) { 541 if (PortP->SecondBlock) {
544 ushort dest_unit = HostMapP->ID; 542 ushort dest_unit = HostMapP->ID;
545 ushort dest_port = port - SysPort; 543 ushort dest_port = port - SysPort;
546 WORD *TxPktP; 544 u16 *TxPktP;
547 PKT *Pkt; 545 PKT *Pkt;
548 546
549 for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { 547 for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) {
@@ -554,19 +552,19 @@ struct Map *MapP;
554 ** a 32 bit pointer so it can be 552 ** a 32 bit pointer so it can be
555 ** accessed from the driver. 553 ** accessed from the driver.
556 */ 554 */
557 Pkt = (PKT *) RIO_PTR(HostP->Caddr, RWORD(*TxPktP)); 555 Pkt = (PKT *) RIO_PTR(HostP->Caddr, readw(&*TxPktP));
558 rio_dprintk(RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", *TxPktP, Pkt->dest_unit, Pkt->dest_port, dest_unit, dest_port); 556 rio_dprintk(RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", *TxPktP, Pkt->dest_unit, Pkt->dest_port, dest_unit, dest_port);
559 WWORD(Pkt->dest_unit, dest_unit); 557 writew(dest_unit, &Pkt->dest_unit);
560 WWORD(Pkt->dest_port, dest_port); 558 writew(dest_port, &Pkt->dest_port);
561 } 559 }
562 rio_dprintk(RIO_DEBUG_TABLE, "Port %d phb destination: Old %x:%x New %x:%x\n", port, PortP->PhbP->destination & 0xff, (PortP->PhbP->destination >> 8) & 0xff, dest_unit, dest_port); 560 rio_dprintk(RIO_DEBUG_TABLE, "Port %d phb destination: Old %x:%x New %x:%x\n", port, PortP->PhbP->destination & 0xff, (PortP->PhbP->destination >> 8) & 0xff, dest_unit, dest_port);
563 WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); 561 writew(dest_unit + (dest_port << 8), &PortP->PhbP->destination);
564 } 562 }
565 rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags); 563 rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags);
566 } 564 }
567 } 565 }
568 rio_dprintk(RIO_DEBUG_TABLE, "Entry nulled.\n"); 566 rio_dprintk(RIO_DEBUG_TABLE, "Entry nulled.\n");
569 bzero((char *) HostMapP, sizeof(struct Map)); 567 memset(HostMapP, 0, sizeof(struct Map));
570 work_done++; 568 work_done++;
571 } 569 }
572 } 570 }
@@ -576,11 +574,11 @@ struct Map *MapP;
576 /* XXXXX lock me up */ 574 /* XXXXX lock me up */
577 for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { 575 for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
578 if (p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) { 576 if (p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) {
579 bzero((char *) &p->RIOSavedTable[entry], sizeof(struct Map)); 577 memset(&p->RIOSavedTable[entry], 0, sizeof(struct Map));
580 work_done++; 578 work_done++;
581 } 579 }
582 if (p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) { 580 if (p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) {
583 bzero((char *) &p->RIOConnectTable[entry], sizeof(struct Map)); 581 memset(&p->RIOConnectTable[entry], 0, sizeof(struct Map));
584 work_done++; 582 work_done++;
585 } 583 }
586 } 584 }
@@ -742,12 +740,9 @@ int RIOAssignRta(struct rio_info *p, struct Map *MapP)
742} 740}
743 741
744 742
745int RIOReMapPorts(p, HostP, HostMapP) 743int RIOReMapPorts(struct rio_info *p, struct Host *HostP, struct Map *HostMapP)
746struct rio_info *p;
747struct Host *HostP;
748struct Map *HostMapP;
749{ 744{
750 register struct Port *PortP; 745 struct Port *PortP;
751 uint SubEnt; 746 uint SubEnt;
752 uint HostPort; 747 uint HostPort;
753 uint SysPort; 748 uint SysPort;
@@ -794,12 +789,12 @@ struct Map *HostMapP;
794 */ 789 */
795 if ((HostP->Flags & RUN_STATE) == RC_RUNNING) { 790 if ((HostP->Flags & RUN_STATE) == RC_RUNNING) {
796 struct PHB *PhbP = PortP->PhbP = &HostP->PhbP[HostPort]; 791 struct PHB *PhbP = PortP->PhbP = &HostP->PhbP[HostPort];
797 PortP->TxAdd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_add)); 792 PortP->TxAdd = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_add));
798 PortP->TxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_start)); 793 PortP->TxStart = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_start));
799 PortP->TxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_end)); 794 PortP->TxEnd = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_end));
800 PortP->RxRemove = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_remove)); 795 PortP->RxRemove = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_remove));
801 PortP->RxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_start)); 796 PortP->RxStart = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_start));
802 PortP->RxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_end)); 797 PortP->RxEnd = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_end));
803 } else 798 } else
804 PortP->PhbP = NULL; 799 PortP->PhbP = NULL;
805 800
@@ -866,9 +861,6 @@ struct Map *HostMapP;
866 PortP->RxDataStart = 0; 861 PortP->RxDataStart = 0;
867 PortP->Cor2Copy = 0; 862 PortP->Cor2Copy = 0;
868 PortP->Name = &HostMapP->Name[0]; 863 PortP->Name = &HostMapP->Name[0];
869#ifdef STATS
870 bzero((caddr_t) & PortP->Stat, sizeof(struct RIOStats));
871#endif
872 PortP->statsGather = 0; 864 PortP->statsGather = 0;
873 PortP->txchars = 0; 865 PortP->txchars = 0;
874 PortP->rxchars = 0; 866 PortP->rxchars = 0;
@@ -876,10 +868,10 @@ struct Map *HostMapP;
876 PortP->closes = 0; 868 PortP->closes = 0;
877 PortP->ioctls = 0; 869 PortP->ioctls = 0;
878 if (PortP->TxRingBuffer) 870 if (PortP->TxRingBuffer)
879 bzero(PortP->TxRingBuffer, p->RIOBufferSize); 871 memset(PortP->TxRingBuffer, 0, p->RIOBufferSize);
880 else if (p->RIOBufferSize) { 872 else if (p->RIOBufferSize) {
881 PortP->TxRingBuffer = sysbrk(p->RIOBufferSize); 873 PortP->TxRingBuffer = kmalloc(p->RIOBufferSize, GFP_KERNEL);
882 bzero(PortP->TxRingBuffer, p->RIOBufferSize); 874 memset(PortP->TxRingBuffer, 0, p->RIOBufferSize);
883 } 875 }
884 PortP->TxBufferOut = 0; 876 PortP->TxBufferOut = 0;
885 PortP->TxBufferIn = 0; 877 PortP->TxBufferIn = 0;
@@ -890,7 +882,7 @@ struct Map *HostMapP;
890 ** If the same, we have received the same rx pkt from the RTA 882 ** If the same, we have received the same rx pkt from the RTA
891 ** twice. Initialise to a value not equal to PHB_RX_TGL or 0. 883 ** twice. Initialise to a value not equal to PHB_RX_TGL or 0.
892 */ 884 */
893 PortP->LastRxTgl = ~(uchar) PHB_RX_TGL; 885 PortP->LastRxTgl = ~(u8) PHB_RX_TGL;
894 886
895 /* 887 /*
896 ** and mark the port as usable 888 ** and mark the port as usable
@@ -906,9 +898,7 @@ struct Map *HostMapP;
906 return 0; 898 return 0;
907} 899}
908 900
909int RIOChangeName(p, MapP) 901int RIOChangeName(struct rio_info *p, struct Map *MapP)
910struct rio_info *p;
911struct Map *MapP;
912{ 902{
913 int host; 903 int host;
914 struct Map *HostMapP; 904 struct Map *HostMapP;
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
index 6379816ed173..0ca431b4c474 100644
--- a/drivers/char/rio/riotty.c
+++ b/drivers/char/rio/riotty.c
@@ -136,7 +136,7 @@ extern struct rio_info *p;
136 136
137int riotopen(struct tty_struct *tty, struct file *filp) 137int riotopen(struct tty_struct *tty, struct file *filp)
138{ 138{
139 register uint SysPort; 139 unsigned int SysPort;
140 int Modem; 140 int Modem;
141 int repeat_this = 250; 141 int repeat_this = 250;
142 struct Port *PortP; /* pointer to the port structure */ 142 struct Port *PortP; /* pointer to the port structure */
@@ -155,7 +155,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
155 155
156 if (p->RIOFailed) { 156 if (p->RIOFailed) {
157 rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n"); 157 rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n");
158 pseterr(ENXIO);
159 func_exit(); 158 func_exit();
160 return -ENXIO; 159 return -ENXIO;
161 } 160 }
@@ -170,7 +169,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
170 */ 169 */
171 if (SysPort >= RIO_PORTS) { /* out of range ? */ 170 if (SysPort >= RIO_PORTS) { /* out of range ? */
172 rio_dprintk(RIO_DEBUG_TTY, "Illegal port number %d\n", SysPort); 171 rio_dprintk(RIO_DEBUG_TTY, "Illegal port number %d\n", SysPort);
173 pseterr(ENXIO);
174 func_exit(); 172 func_exit();
175 return -ENXIO; 173 return -ENXIO;
176 } 174 }
@@ -187,7 +185,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
187 */ 185 */
188 rio_dprintk(RIO_DEBUG_TTY, "port not mapped into system\n"); 186 rio_dprintk(RIO_DEBUG_TTY, "port not mapped into system\n");
189 func_exit(); 187 func_exit();
190 pseterr(ENXIO);
191 return -ENXIO; 188 return -ENXIO;
192 } 189 }
193 190
@@ -209,7 +206,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
209 */ 206 */
210 if ((PortP->HostP->Flags & RUN_STATE) != RC_RUNNING) { 207 if ((PortP->HostP->Flags & RUN_STATE) != RC_RUNNING) {
211 rio_dprintk(RIO_DEBUG_TTY, "Host not running\n"); 208 rio_dprintk(RIO_DEBUG_TTY, "Host not running\n");
212 pseterr(ENXIO);
213 func_exit(); 209 func_exit();
214 return -ENXIO; 210 return -ENXIO;
215 } 211 }
@@ -429,9 +425,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
429 425
430 rio_dprintk(RIO_DEBUG_TTY, "high level open done\n"); 426 rio_dprintk(RIO_DEBUG_TTY, "high level open done\n");
431 427
432#ifdef STATS
433 PortP->Stat.OpenCnt++;
434#endif
435 /* 428 /*
436 ** Count opens for port statistics reporting 429 ** Count opens for port statistics reporting
437 */ 430 */
@@ -466,10 +459,10 @@ int riotclose(void *ptr)
466 rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum); 459 rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum);
467 460
468 /* PortP = p->RIOPortp[SysPort]; */ 461 /* PortP = p->RIOPortp[SysPort]; */
469 rio_dprintk(RIO_DEBUG_TTY, "Port is at address 0x%x\n", (int) PortP); 462 rio_dprintk(RIO_DEBUG_TTY, "Port is at address 0x%p\n", PortP);
470 /* tp = PortP->TtyP; *//* Get tty */ 463 /* tp = PortP->TtyP; *//* Get tty */
471 tty = PortP->gs.tty; 464 tty = PortP->gs.tty;
472 rio_dprintk(RIO_DEBUG_TTY, "TTY is at address 0x%x\n", (int) tty); 465 rio_dprintk(RIO_DEBUG_TTY, "TTY is at address 0x%p\n", tty);
473 466
474 if (PortP->gs.closing_wait) 467 if (PortP->gs.closing_wait)
475 end_time = jiffies + PortP->gs.closing_wait; 468 end_time = jiffies + PortP->gs.closing_wait;
@@ -536,7 +529,6 @@ int riotclose(void *ptr)
536 529
537 if (!deleted) 530 if (!deleted)
538 while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) { 531 while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) {
539 cprintf("Need to flush the ttyport\n");
540 if (repeat_this-- <= 0) { 532 if (repeat_this-- <= 0) {
541 rv = -EINTR; 533 rv = -EINTR;
542 rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); 534 rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
@@ -615,9 +607,6 @@ int riotclose(void *ptr)
615*/ 607*/
616 PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW); 608 PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW);
617 609
618#ifdef STATS
619 PortP->Stat.CloseCnt++;
620#endif
621 /* 610 /*
622 ** Count opens for port statistics reporting 611 ** Count opens for port statistics reporting
623 */ 612 */
@@ -722,15 +711,15 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len
722 /* 711 /*
723 ** set the command byte and the argument byte 712 ** set the command byte and the argument byte
724 */ 713 */
725 WBYTE(PacketP->data[0], command); 714 writeb(command, &PacketP->data[0]);
726 715
727 if (len == 2) 716 if (len == 2)
728 WBYTE(PacketP->data[1], arg); 717 writeb(arg, &PacketP->data[1]);
729 718
730 /* 719 /*
731 ** set the length of the packet and set the command bit. 720 ** set the length of the packet and set the command bit.
732 */ 721 */
733 WBYTE(PacketP->len, PKT_CMD_BIT | len); 722 writeb(PKT_CMD_BIT | len, &PacketP->len);
734 723
735 add_transmit(PortP); 724 add_transmit(PortP);
736 /* 725 /*