diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2006-03-24 06:18:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-24 10:33:29 -0500 |
commit | e2b3afd676ad3e15ca2efca3b3605c7d817ec6e3 (patch) | |
tree | f6b7c9739e20a865b6f1f379ccbab67a63ddec53 /drivers/char/rio/rioparam.c | |
parent | 27c6e526f34760a9c48a90112242b7165064fa85 (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/rio/rioparam.c')
-rw-r--r-- | drivers/char/rio/rioparam.c | 108 |
1 files changed, 45 insertions, 63 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 | */ |
160 | int RIOParam(PortP, cmd, Modem, SleepFlag) | 160 | int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag) |
161 | struct Port *PortP; | ||
162 | int cmd; | ||
163 | int Modem; | ||
164 | int 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 | */ |
600 | int can_add_transmit(PktP, PortP) | 590 | int can_add_transmit(PKT **PktP, struct Port *PortP) |
601 | PKT **PktP; | ||
602 | struct 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 | */ |
616 | void add_transmit(PortP) | 604 | void add_transmit(struct Port *PortP) |
617 | struct 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 | ****************************************/ |
631 | void put_free_end(HostP, PktP) | 618 | void put_free_end(struct Host *HostP, PKT *PktP) |
632 | struct Host *HostP; | ||
633 | PKT *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 | */ |
672 | int can_remove_receive(PktP, PortP) | 657 | int can_remove_receive(PKT **PktP, struct Port *PortP) |
673 | PKT **PktP; | ||
674 | struct 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 | */ |
688 | void remove_receive(PortP) | 671 | void remove_receive(struct Port *PortP) |
689 | struct 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 | } |