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/rioroute.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/rioroute.c')
-rw-r--r-- | drivers/char/rio/rioroute.c | 62 |
1 files changed, 31 insertions, 31 deletions
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 |