Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Alan Cox and committed by
Linus Torvalds
e2b3afd6 27c6e526

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